diff --git a/pom.xml b/pom.xml index 9b97e69a70..c19e1260a7 100644 --- a/pom.xml +++ b/pom.xml @@ -439,50 +439,10 @@ - - central - https://repo.maven.apache.org/maven2 - ohdsi repo.ohdsi.org - http://repo.ohdsi.org:8085/nexus/content/repositories/releases - - - ohdsi.thirdparty - repo.ohdsi.org - http://repo.ohdsi.org:8085/nexus/content/repositories/thirdparty - - - ohdsi.snapshots - repo.ohdsi.org-snapshots - http://repo.ohdsi.org:8085/nexus/content/repositories/snapshots - - false - - - true - - - - springsource.releases - SpringSource GA Repository - https://repo.springsource.org/release - - true - - - false - - - - redshift - http://redshift-maven-repository.s3-website-us-east-1.amazonaws.com/release - - - miredot - Miredot Releases - http://nexus.qmino.com/content/repositories/miredot + http://repo.ohdsi.org:8085/nexus/content/groups/public @@ -993,9 +953,9 @@ - com.oracle - ojdbc6 - 12.1.0.1 + com.oracle.database.jdbc + ojdbc8 + 19.8.0.0 diff --git a/src/main/java/org/ohdsi/webapi/cohortsample/CohortSample.java b/src/main/java/org/ohdsi/webapi/cohortsample/CohortSample.java index 4bacd82e4f..a5a105603c 100644 --- a/src/main/java/org/ohdsi/webapi/cohortsample/CohortSample.java +++ b/src/main/java/org/ohdsi/webapi/cohortsample/CohortSample.java @@ -51,7 +51,7 @@ public class CohortSample extends CommonEntity { @Column(name = "gender_concept_ids") private String genderConceptIds; - @Column + @Column(name = "\"size\"") private int size; @Transient diff --git a/src/main/java/org/ohdsi/webapi/util/PreparedSqlRender.java b/src/main/java/org/ohdsi/webapi/util/PreparedSqlRender.java index a43917d302..5ff589d37a 100644 --- a/src/main/java/org/ohdsi/webapi/util/PreparedSqlRender.java +++ b/src/main/java/org/ohdsi/webapi/util/PreparedSqlRender.java @@ -7,7 +7,7 @@ import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.ohdsi.webapi.source.Source; public class PreparedSqlRender { diff --git a/src/main/resources/db/migration/oracle/V2.8.0.20200109100200__cohort_sample_tables.sql b/src/main/resources/db/migration/oracle/V2.8.0.20200109100200__cohort_sample_tables.sql index dbc2915aff..ff1972e61f 100644 --- a/src/main/resources/db/migration/oracle/V2.8.0.20200109100200__cohort_sample_tables.sql +++ b/src/main/resources/db/migration/oracle/V2.8.0.20200109100200__cohort_sample_tables.sql @@ -5,7 +5,7 @@ CREATE TABLE ${ohdsiSchema}.cohort_sample( name VARCHAR(255) NOT NULL, cohort_definition_id NUMBER(10) NOT NULL, source_id NUMBER(10) NOT NULL, - size NUMBER(9) NOT NULL, + "size" NUMBER(9) NOT NULL, age_min NUMBER(4), age_max NUMBER(4), age_mode VARCHAR(24), diff --git a/src/main/resources/db/migration/oracle/V2.8.0.20200122173000__insert_cohort_sample_permissions.sql b/src/main/resources/db/migration/oracle/V2.8.0.20200122173000__insert_cohort_sample_permissions.sql index e019c66c3d..294fff1b7b 100644 --- a/src/main/resources/db/migration/oracle/V2.8.0.20200122173000__insert_cohort_sample_permissions.sql +++ b/src/main/resources/db/migration/oracle/V2.8.0.20200122173000__insert_cohort_sample_permissions.sql @@ -1,13 +1,18 @@ INSERT INTO ${ohdsiSchema}.sec_permission(id, value, description) VALUES -(${ohdsiSchema}.sec_permission_id_seq.nextval, 'cohortsample:*:*:get', 'List cohort samples'), -(${ohdsiSchema}.sec_permission_id_seq.nextval, 'cohortsample:*:*:*:get', 'Get single cohort samples'), -(${ohdsiSchema}.sec_permission_id_seq.nextval, 'cohortsample:*:*:*:delete', 'Delete cohort sample'), -(${ohdsiSchema}.sec_permission_id_seq.nextval, 'cohortsample:*:*:delete', 'Delete all cohort samples of a cohort.'), -(${ohdsiSchema}.sec_permission_id_seq.nextval, 'cohortsample:*:*:post', 'Create cohort sample') -(${ohdsiSchema}.sec_permission_id_seq.nextval, 'cohortsample:*:*:*:refresh:post', 'Refresh cohort sample'); + (${ohdsiSchema}.sec_permission_id_seq.nextval, 'cohortsample:*:*:get', 'List cohort samples'); +INSERT INTO ${ohdsiSchema}.sec_permission(id, value, description) VALUES + (${ohdsiSchema}.sec_permission_id_seq.nextval, 'cohortsample:*:*:*:get', 'Get single cohort samples'); +INSERT INTO ${ohdsiSchema}.sec_permission(id, value, description) VALUES + (${ohdsiSchema}.sec_permission_id_seq.nextval, 'cohortsample:*:*:*:delete', 'Delete cohort sample'); +INSERT INTO ${ohdsiSchema}.sec_permission(id, value, description) VALUES + (${ohdsiSchema}.sec_permission_id_seq.nextval, 'cohortsample:*:*:delete', 'Delete all cohort samples of a cohort.'); +INSERT INTO ${ohdsiSchema}.sec_permission(id, value, description) VALUES + (${ohdsiSchema}.sec_permission_id_seq.nextval, 'cohortsample:*:*:post', 'Create cohort sample'); +INSERT INTO ${ohdsiSchema}.sec_permission(id, value, description) VALUES + (${ohdsiSchema}.sec_permission_id_seq.nextval, 'cohortsample:*:*:*:refresh:post', 'Refresh cohort sample'); INSERT INTO ${ohdsiSchema}.sec_role_permission(id, role_id, permission_id) -SELECT NEXT VALUE FOR ${ohdsiSchema}.sec_role_permission_sequence, sr.id, sp.id +SELECT ${ohdsiSchema}.sec_role_permission_sequence.nextval, sr.id, sp.id FROM ${ohdsiSchema}.sec_permission SP, ${ohdsiSchema}.sec_role sr WHERE sp.value IN ( 'cohortsample:*:*:get', diff --git a/src/main/resources/db/migration/oracle/V2.8.0.20200130124345__fe_analysis_aggregate.sql b/src/main/resources/db/migration/oracle/V2.8.0.20200130124345__fe_analysis_aggregate.sql index e98f532651..da2cee585e 100644 --- a/src/main/resources/db/migration/oracle/V2.8.0.20200130124345__fe_analysis_aggregate.sql +++ b/src/main/resources/db/migration/oracle/V2.8.0.20200130124345__fe_analysis_aggregate.sql @@ -94,7 +94,7 @@ INSERT INTO ${ohdsiSchema}.fe_analysis_aggregate(id, name, domain, agg_function, INSERT INTO ${ohdsiSchema}.fe_analysis_aggregate(id, name, domain, agg_function, criteria_columns, expression, join_table, join_type, join_condition, is_default, missing_means_zero) VALUES (${ohdsiSchema}.fe_aggregate_sequence.nextval, 'Gap days (min)', 'DRUG_ERA', 'MIN', 'GAP_DAYS', 'gap_days', null, null, null, 0, 0); INSERT INTO ${ohdsiSchema}.fe_analysis_aggregate(id, name, domain, agg_function, criteria_columns, expression, join_table, join_type, join_condition, is_default, missing_means_zero) VALUES - (${ohdsiSchema}.fe_aggregate_sequence.nextval, 'Gap days (average)', 'DRUG_ERA', 'AVG', 'GAP_DAYS', 'gap_days', null, null, null, 0, 0; + (${ohdsiSchema}.fe_aggregate_sequence.nextval, 'Gap days (average)', 'DRUG_ERA', 'AVG', 'GAP_DAYS', 'gap_days', null, null, null, 0, 0); INSERT INTO ${ohdsiSchema}.fe_analysis_aggregate(id, name, domain, agg_function, criteria_columns, expression, join_table, join_type, join_condition, is_default, missing_means_zero) VALUES (${ohdsiSchema}.fe_aggregate_sequence.nextval, 'Condition occurrence count', 'CONDITION_ERA', null, 'ERA_OCCURRENCES', 'era_occurrences', null, null, null, 0, 0); INSERT INTO ${ohdsiSchema}.fe_analysis_aggregate(id, name, domain, agg_function, criteria_columns, expression, join_table, join_type, join_condition, is_default, missing_means_zero) VALUES diff --git a/src/main/resources/db/migration/oracle/V2.8.0.20201022120031__concept_ancestor_and_descendants.sql b/src/main/resources/db/migration/oracle/V2.8.0.20201022120031__concept_ancestor_and_descendants.sql index 6233bc268f..5c9c5368ed 100644 --- a/src/main/resources/db/migration/oracle/V2.8.0.20201022120031__concept_ancestor_and_descendants.sql +++ b/src/main/resources/db/migration/oracle/V2.8.0.20201022120031__concept_ancestor_and_descendants.sql @@ -2,15 +2,15 @@ ALTER TABLE ${ohdsiSchema}.sec_permission ADD for_role_id INTEGER; INSERT INTO ${ohdsiSchema}.sec_permission (id, value, for_role_id) SELECT ${ohdsiSchema}.sec_permission_id_seq.nextval, - REPLACE(''vocabulary:%s:concept:*:ancestorAndDescendant:get'', ''%s'', REPLACE(REPLACE(value, ''source:'', ''''), '':access'', '''')), + REPLACE('vocabulary:%s:concept:*:ancestorAndDescendant:get', '%s', REPLACE(REPLACE(value, 'source:', ''), ':access', '')), role_id FROM ${ohdsiSchema}.sec_permission sp JOIN ${ohdsiSchema}.sec_role_permission srp on sp.id = srp.permission_id -WHERE sp.value LIKE ''source:%:access''; +WHERE sp.value LIKE 'source:%:access'; INSERT INTO ${ohdsiSchema}.sec_role_permission (id, role_id, permission_id) SELECT ${ohdsiSchema}.sec_role_permission_sequence.nextval, sp.for_role_id, sp.id FROM ${ohdsiSchema}.sec_permission sp WHERE sp.for_role_id IS NOT NULL; -ALTER TABLE ${ohdsiSchema}.sec_permission DROP COLUMN for_role_id; \ No newline at end of file +ALTER TABLE ${ohdsiSchema}.sec_permission DROP COLUMN for_role_id; diff --git a/src/main/resources/db/migration/sqlserver/V2.8.0.202012220000__fix_generation_view_try_cast.sql b/src/main/resources/db/migration/sqlserver/V2.8.0.202012220000__fix_generation_view_try_cast.sql new file mode 100644 index 0000000000..258f39676c --- /dev/null +++ b/src/main/resources/db/migration/sqlserver/V2.8.0.202012220000__fix_generation_view_try_cast.sql @@ -0,0 +1,123 @@ +DROP VIEW ${ohdsiSchema}.cc_generation; +DROP VIEW ${ohdsiSchema}.estimation_analysis_generation; +DROP VIEW ${ohdsiSchema}.pathway_analysis_generation; +DROP VIEW ${ohdsiSchema}.prediction_analysis_generation; +DROP VIEW ${ohdsiSchema}.user_import_job_history; + +GO + +CREATE VIEW ${ohdsiSchema}.cc_generation as ( + SELECT + -- Spring batch based + job.job_execution_id id, + job.create_time start_time, + job.end_time end_time, + job.status status, + job.exit_message exit_message, + TRY_CAST(cc_id_param.string_val AS INTEGER) cc_id, + TRY_CAST(source_param.string_val AS INTEGER) source_id, + -- Generation info based + gen_info.hash_code hash_code, + gen_info.created_by_id created_by_id + FROM ${ohdsiSchema}.batch_job_execution job + JOIN ${ohdsiSchema}.batch_job_execution_params cc_id_param + ON job.job_execution_id = cc_id_param.job_execution_id AND cc_id_param.key_name = 'cohort_characterization_id' + JOIN ${ohdsiSchema}.batch_job_execution_params source_param + ON job.job_execution_id = source_param.job_execution_id AND source_param.key_name = 'source_id' + LEFT JOIN ${ohdsiSchema}.analysis_generation_info gen_info + ON job.job_execution_id = gen_info.job_execution_id +); +GO + +CREATE VIEW ${ohdsiSchema}.estimation_analysis_generation as + SELECT + job.job_execution_id id, + job.create_time start_time, + job.end_time end_time, + job.status status, + job.exit_message exit_message, + TRY_CAST(estimation_id_param.string_val AS INTEGER) estimation_id, + TRY_CAST(source_param.string_val AS INTEGER) source_id, + passwd_param.string_val update_password, + -- Generation info based + gen_info.hash_code hash_code, + gen_info.created_by_id created_by_id, + -- Execution info based + exec_info.id analysis_execution_id + FROM ${ohdsiSchema}.batch_job_execution job + JOIN ${ohdsiSchema}.batch_job_execution_params estimation_id_param ON job.job_execution_id = estimation_id_param.job_execution_id AND estimation_id_param.key_name = 'estimation_analysis_id' + JOIN ${ohdsiSchema}.batch_job_execution_params source_param ON job.job_execution_id = source_param.job_execution_id AND source_param.key_name = 'source_id' + JOIN ${ohdsiSchema}.batch_job_execution_params passwd_param ON job.job_execution_id = passwd_param.job_execution_id AND passwd_param.key_name = 'update_password' + LEFT JOIN ${ohdsiSchema}.ee_analysis_status exec_info ON job.job_execution_id = exec_info.job_execution_id + LEFT JOIN ${ohdsiSchema}.analysis_generation_info gen_info ON job.job_execution_id = gen_info.job_execution_id; +GO + +CREATE VIEW ${ohdsiSchema}.pathway_analysis_generation as + (SELECT + job.job_execution_id id, + job.create_time start_time, + job.end_time end_time, + job.status status, + job.exit_message exit_message, + TRY_CAST(pa_id_param.string_val AS INTEGER) pathway_analysis_id, + TRY_CAST(source_param.string_val AS INTEGER) source_id, + -- Generation info based + gen_info.hash_code hash_code, + gen_info.created_by_id created_by_id + FROM ${ohdsiSchema}.batch_job_execution job + JOIN ${ohdsiSchema}.batch_job_execution_params pa_id_param + ON job.job_execution_id = pa_id_param.job_execution_id AND pa_id_param.key_name = 'pathway_analysis_id' + JOIN ${ohdsiSchema}.batch_job_execution_params source_param + ON job.job_execution_id = source_param.job_execution_id AND source_param.key_name = 'source_id' + LEFT JOIN ${ohdsiSchema}.analysis_generation_info gen_info + ON job.job_execution_id = gen_info.job_execution_id); +GO + +CREATE VIEW ${ohdsiSchema}.prediction_analysis_generation as + SELECT + job.job_execution_id id, + job.create_time start_time, + job.end_time end_time, + job.status status, + job.exit_message exit_message, + TRY_CAST(plp_id_param.string_val AS INTEGER) prediction_id, + TRY_CAST(source_param.string_val AS INTEGER) source_id, + passwd_param.string_val update_password, + -- Generation info based + gen_info.hash_code hash_code, + gen_info.created_by_id created_by_id, + -- Execution info based + exec_info.id analysis_execution_id + FROM ${ohdsiSchema}.batch_job_execution job + JOIN ${ohdsiSchema}.batch_job_execution_params plp_id_param ON job.job_execution_id = plp_id_param.job_execution_id AND plp_id_param.key_name = 'prediction_analysis_id' + JOIN ${ohdsiSchema}.batch_job_execution_params source_param ON job.job_execution_id = source_param.job_execution_id AND source_param.key_name = 'source_id' + JOIN ${ohdsiSchema}.batch_job_execution_params passwd_param ON job.job_execution_id = passwd_param.job_execution_id AND passwd_param.key_name = 'update_password' + LEFT JOIN ${ohdsiSchema}.ee_analysis_status exec_info ON job.job_execution_id = exec_info.job_execution_id + LEFT JOIN ${ohdsiSchema}.analysis_generation_info gen_info ON job.job_execution_id = gen_info.job_execution_id; +GO + + +CREATE VIEW ${ohdsiSchema}.user_import_job_history + AS + SELECT + job.job_execution_id as id, + job.start_time as start_time, + job.end_time as end_time, + job.status as status, + job.exit_code as exit_code, + job.exit_message as exit_message, + name_param.STRING_VAL as job_name, + TRY_CAST(user_import_param.string_val AS INTEGER) user_import_id, + author_param.STRING_VAL as author + FROM + ${ohdsiSchema}.BATCH_JOB_EXECUTION job + JOIN ${ohdsiSchema}.BATCH_JOB_INSTANCE instance ON instance.JOB_INSTANCE_ID = job.JOB_INSTANCE_ID + JOIN ${ohdsiSchema}.batch_job_execution_params name_param + ON job.job_execution_id = name_param.job_execution_id AND name_param.KEY_NAME = 'jobName' + JOIN ${ohdsiSchema}.batch_job_execution_params user_import_param + ON job.job_execution_id = user_import_param.job_execution_id AND user_import_param.key_name = 'user_import_id' + JOIN ${ohdsiSchema}.BATCH_JOB_EXECUTION_PARAMS author_param + ON job.JOB_EXECUTION_ID = author_param.JOB_EXECUTION_ID AND author_param.KEY_NAME = 'jobAuthor' + WHERE + instance.JOB_NAME = 'usersImport'; +GO \ No newline at end of file