Skip to content

Commit

Permalink
Merge branch 'master' into release-2.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisknoll committed Dec 22, 2020
2 parents 9aaa915 + 6b3796f commit 029e12c
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 58 deletions.
48 changes: 4 additions & 44 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -439,50 +439,10 @@
</build>

<repositories>
<repository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
<repository>
<id>ohdsi</id>
<name>repo.ohdsi.org</name>
<url>http://repo.ohdsi.org:8085/nexus/content/repositories/releases</url>
</repository>
<repository>
<id>ohdsi.thirdparty</id>
<name>repo.ohdsi.org</name>
<url>http://repo.ohdsi.org:8085/nexus/content/repositories/thirdparty</url>
</repository>
<repository>
<id>ohdsi.snapshots</id>
<name>repo.ohdsi.org-snapshots</name>
<url>http://repo.ohdsi.org:8085/nexus/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>springsource.releases</id>
<name>SpringSource GA Repository</name>
<url>https://repo.springsource.org/release</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>redshift</id>
<url>http://redshift-maven-repository.s3-website-us-east-1.amazonaws.com/release</url>
</repository>
<repository>
<id>miredot</id>
<name>Miredot Releases</name>
<url>http://nexus.qmino.com/content/repositories/miredot</url>
<url>http://repo.ohdsi.org:8085/nexus/content/groups/public</url>
</repository>
</repositories>

Expand Down Expand Up @@ -993,9 +953,9 @@
</properties>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>12.1.0.1</version>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.8.0.0</version>
</dependency>
</dependencies>
</profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class CohortSample extends CommonEntity<Integer> {
@Column(name = "gender_concept_ids")
private String genderConceptIds;

@Column
@Column(name = "\"size\"")
private int size;

@Transient
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/ohdsi/webapi/util/PreparedSqlRender.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
ALTER TABLE ${ohdsiSchema}.sec_permission DROP COLUMN for_role_id;
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 029e12c

Please # to comment.