diff --git a/README.md b/README.md index 28bff0b885..35e657b92a 100644 --- a/README.md +++ b/README.md @@ -35,4 +35,6 @@ It was chosen to use embedded PG instead of H2 for unit tests since H2 doesn't s - Only Non-SNAPSHOT dependencies should be presented in POM.xml on release branches/tags. ## License -OHDSI WebAPI is licensed under Apache License 2.0 \ No newline at end of file +OHDSI WebAPI is licensed under Apache License 2.0 + + diff --git a/pom.xml b/pom.xml index 5749d10cde..85eeb5757d 100644 --- a/pom.xml +++ b/pom.xml @@ -144,7 +144,7 @@ - 1.15.0-SNAPSHOT + 1.16.0-SNAPSHOT 2.25.1 600000 12 @@ -192,13 +192,15 @@ true 7 60000 + 1.6.3-SNAPSHOT + 3.1.2 WebAPI ${basedir}/src/main/java ${basedir}/src/test/java ${basedir}/target/classes - ${basedir}/target/test-classes + ${basedir}/target/test-classes src/main/resources @@ -276,7 +278,7 @@ -Xpkginfo:always - + @@ -507,7 +509,7 @@ org.ohdsi.sql SqlRender - 1.6.3-SNAPSHOT + ${SqlRender.version} commons-dbutils @@ -781,6 +783,10 @@ org.ohdsi featureExtraction + + org.ohdsi.sql + SqlRender + @@ -1118,5 +1124,95 @@ + + webapi-hive + + + org.apache.hive + hive-jdbc + ${hive-jdbc.version} + + + org.apache.tomcat + * + + + org.eclipse.jetty + * + + + slf4j-log4j12 + org.slf4j + + + log4j + log4j + + + servlet-api + javax.servlet + + + com.zaxxer + HikariCP + + + com.zaxxer + HikariCP-java7 + + + javax.ws.rs + javax.ws.rs-api + + + com.sun.jersey + jersey-server + + + com.sun.jersey + jersey-core + + + com.sun.jersey + jersey-client + + + com.sun.jersey + jersey-json + + + com.tdunning + json + + + + + com.sun.jersey + jersey-server + 1.19.4 + + + com.sun.jersey + jersey-core + 1.19.4 + + + javax.ws.rs + jsr311-api + + + + + com.sun.jersey + jersey-client + 1.19.4 + + + com.sun.jersey + jersey-json + 1.19.4 + + + diff --git a/src/main/extras/bigquery/README.md b/src/main/extras/bigquery/README.md index 1ba409964c..1b52d3fe98 100644 --- a/src/main/extras/bigquery/README.md +++ b/src/main/extras/bigquery/README.md @@ -1,6 +1,6 @@ To build WebAPI with Google BigQuery support do the following: 1. Go to https://cloud.google.com/bigquery/partners/simba-drivers/ and 2. Download the JDBC 4.2 driver -3. Unpack archive and and set the bigquery.classpath property in your settings.xml to the unpacked archive location (ie: C://downloads/bigquery) inside the webapi-bigquery profile. +3. Unpack archive and set the bigquery.classpath property in your settings.xml to the unpacked archive location (ie: C://downloads/bigquery) inside the webapi-bigquery profile. 4. Build WebAPI with webapi-bigquery profile. * mvn -Pwebapi-postgresql,webapi-bigquery clean package diff --git a/src/main/extras/impala/README.md b/src/main/extras/impala/README.md index 69c8b3db19..dabb854b23 100644 --- a/src/main/extras/impala/README.md +++ b/src/main/extras/impala/README.md @@ -1,7 +1,7 @@ To build WebAPI with Impala support do the following: 1. Go to the https://www.cloudera.com/downloads/connectors/impala/jdbc/2-6-15.html -2. Register to clouder if you did not registered earlier or sign in to your Cloudera account +2. Register to Cloudera if you did not registered earlier or sign in to your Cloudera account 3. Download the latest Impala JDBC drivers -4. Unpack archive and and set the impala.classpath property in your settings.xml to the unpacked archive location (ie: C://downloads/impalaJDBC) inside the webapi-impala profile. +4. Unpack archive and set the impala.classpath property in your settings.xml to the unpacked archive location (ie: C://downloads/impalaJDBC) inside the webapi-impala profile. 5. Build WebAPI with webapi-impala profile. * mvn -Pwebapi-postgresql,webapi-impala clean package diff --git a/src/main/java/org/ohdsi/webapi/DataAccessConfig.java b/src/main/java/org/ohdsi/webapi/DataAccessConfig.java index 64b7a06ba0..ce98042fc1 100644 --- a/src/main/java/org/ohdsi/webapi/DataAccessConfig.java +++ b/src/main/java/org/ohdsi/webapi/DataAccessConfig.java @@ -78,7 +78,7 @@ public DataSource primaryDataSource() { //note autocommit defaults vary across vendors. use provided @Autowired TransactionTemplate String[] supportedDrivers; - supportedDrivers = new String[]{"org.postgresql.Driver", "com.microsoft.sqlserver.jdbc.SQLServerDriver", "oracle.jdbc.driver.OracleDriver", "com.amazon.redshift.jdbc.Driver", "com.cloudera.impala.jdbc.Driver", "net.starschema.clouddb.jdbc.BQDriver", "org.netezza.Driver", "com.simba.googlebigquery.jdbc42.Driver"}; + supportedDrivers = new String[]{"org.postgresql.Driver", "com.microsoft.sqlserver.jdbc.SQLServerDriver", "oracle.jdbc.driver.OracleDriver", "com.amazon.redshift.jdbc.Driver", "com.cloudera.impala.jdbc.Driver", "net.starschema.clouddb.jdbc.BQDriver", "org.netezza.Driver", "com.simba.googlebigquery.jdbc42.Driver", "org.apache.hive.jdbc.HiveDriver"}; for (String driverName : supportedDrivers) { try { Class.forName(driverName); diff --git a/src/main/java/org/ohdsi/webapi/cohortcharacterization/CcServiceImpl.java b/src/main/java/org/ohdsi/webapi/cohortcharacterization/CcServiceImpl.java index 67564ea3f9..e7a125d05e 100644 --- a/src/main/java/org/ohdsi/webapi/cohortcharacterization/CcServiceImpl.java +++ b/src/main/java/org/ohdsi/webapi/cohortcharacterization/CcServiceImpl.java @@ -12,6 +12,7 @@ import org.ohdsi.circe.helper.ResourceHelper; import org.ohdsi.featureExtraction.FeatureExtraction; import org.ohdsi.hydra.Hydra; +import org.ohdsi.sql.SqlSplit; import org.ohdsi.sql.SqlTranslate; import org.ohdsi.webapi.JobInvalidator; import org.ohdsi.webapi.cohortcharacterization.converter.SerializedCcToCcConverter; @@ -825,6 +826,10 @@ public List getPrevalenceStatsByGenerationId(Long id, Long ana String prevalenceStats = sourceAwareSqlRender.renderSql(source.getSourceId(), QUERY_PREVALENCE_STATS, PREVALENCE_STATS_PARAMS, new String[]{ cdmSchema, resultSchema, String.valueOf(id), String.valueOf(analysisId), String.valueOf(cohortId), String.valueOf(covariateId) }); String translatedSql = SqlTranslate.translateSql(prevalenceStats, source.getSourceDialect(), SessionUtils.sessionId(), tempSchema); + String[] stmts = SqlSplit.splitSql(translatedSql); + if (stmts.length == 1) { // Some DBMS like HIVE fails when a single statement ends with dot-comma + translatedSql = StringUtils.removeEnd(translatedSql.trim(), ";"); + } return getSourceJdbcTemplate(source).query(translatedSql, (rs, rowNum) -> { CcPrevalenceStat stat = new CcPrevalenceStat(); stat.setAvg(rs.getDouble("stat_value")); diff --git a/src/main/java/org/ohdsi/webapi/cohortcharacterization/DropCohortTableListener.java b/src/main/java/org/ohdsi/webapi/cohortcharacterization/DropCohortTableListener.java index ae2ce920fd..0b176ed258 100644 --- a/src/main/java/org/ohdsi/webapi/cohortcharacterization/DropCohortTableListener.java +++ b/src/main/java/org/ohdsi/webapi/cohortcharacterization/DropCohortTableListener.java @@ -1,5 +1,8 @@ package org.ohdsi.webapi.cohortcharacterization; +import com.odysseusinc.arachne.commons.types.DBMSType; +import java.util.Objects; +import org.apache.commons.lang3.StringUtils; import org.ohdsi.circe.helper.ResourceHelper; import org.ohdsi.sql.SqlTranslate; import org.ohdsi.webapi.source.SourceService; @@ -44,8 +47,12 @@ private Object doTask(JobParameters parameters) { final Source source = sourceService.findBySourceId(sourceId); final String resultsQualifier = SourceUtils.getResultsQualifier(source); final String tempQualifier = SourceUtils.getTempQualifier(source, resultsQualifier); - jdbcTemplate.execute(SqlTranslate.translateSql(sql, source.getSourceDialect(), null, tempQualifier)); + String toRemove = SqlTranslate.translateSql(sql, source.getSourceDialect(), null, tempQualifier); + if (Objects.equals(DBMSType.HIVE.getOhdsiDB(), source.getSourceDialect())){ + toRemove = StringUtils.remove(toRemove, ';'); + } + jdbcTemplate.execute(toRemove); return null; } diff --git a/src/main/java/org/ohdsi/webapi/cohortcharacterization/GenerateCohortCharacterizationTasklet.java b/src/main/java/org/ohdsi/webapi/cohortcharacterization/GenerateCohortCharacterizationTasklet.java index 3aa3e90410..2cba14008e 100644 --- a/src/main/java/org/ohdsi/webapi/cohortcharacterization/GenerateCohortCharacterizationTasklet.java +++ b/src/main/java/org/ohdsi/webapi/cohortcharacterization/GenerateCohortCharacterizationTasklet.java @@ -91,7 +91,7 @@ protected String[] prepareQueries(ChunkContext chunkContext, CancelableJdbcTempl * * Therefore, there are two ways: * - either precisely group SQLs into statements so that temp tables aren't re-used in a single statement, - * - or use ‘permenant temporary tables’ + * - or use ‘permanent temporary tables’ * * The second option looks better since such SQL could be exported and executed manually, * which is not the case with the first option. diff --git a/src/main/java/org/ohdsi/webapi/common/generation/GenerationUtils.java b/src/main/java/org/ohdsi/webapi/common/generation/GenerationUtils.java index a287732841..0d6d401609 100644 --- a/src/main/java/org/ohdsi/webapi/common/generation/GenerationUtils.java +++ b/src/main/java/org/ohdsi/webapi/common/generation/GenerationUtils.java @@ -169,11 +169,15 @@ public SimpleJobBuilder buildJobForExecutionEngineBasedAnalysisTasklet(String an Step waitCallbackStep = stepBuilderFactory.get(analysisTypeName + ".waitForCallback") .tasklet(callbackTasklet) .build(); + + DropCohortTableListener dropCohortTableListener = new DropCohortTableListener(getSourceJdbcTemplate(source), + transactionTemplate, sourceService, sourceAwareSqlRender); return jobBuilders.get(analysisTypeName) .start(createAnalysisExecutionStep) .next(runExecutionStep) .next(waitCallbackStep) + .listener(dropCohortTableListener) .listener(new AutoremoveJobListener(jobService)); } } diff --git a/src/main/java/org/ohdsi/webapi/pathway/PathwayServiceImpl.java b/src/main/java/org/ohdsi/webapi/pathway/PathwayServiceImpl.java index 2413b59b29..f1a98abbe8 100644 --- a/src/main/java/org/ohdsi/webapi/pathway/PathwayServiceImpl.java +++ b/src/main/java/org/ohdsi/webapi/pathway/PathwayServiceImpl.java @@ -2,6 +2,7 @@ import com.cosium.spring.data.jpa.entity.graph.domain.EntityGraph; import com.google.common.base.MoreObjects; +import com.odysseusinc.arachne.commons.types.DBMSType; import org.hibernate.Hibernate; import org.ohdsi.circe.helper.ResourceHelper; import org.ohdsi.sql.SqlRender; @@ -325,7 +326,8 @@ public String buildAnalysisSql(Long generationId, PathwayAnalysisEntity pathwayA "pathway_target_cohort_id", "max_depth", "combo_window", - "allow_repeats" + "allow_repeats", + "isHive" }; String[] values = new String[]{ generationId.toString(), @@ -336,7 +338,8 @@ public String buildAnalysisSql(Long generationId, PathwayAnalysisEntity pathwayA tc.getCohortDefinition().getId().toString(), pathwayAnalysis.getMaxDepth().toString(), MoreObjects.firstNonNull(pathwayAnalysis.getCombinationWindow(), 1).toString(), - String.valueOf(pathwayAnalysis.isAllowRepeats()) + String.valueOf(pathwayAnalysis.isAllowRepeats()), + String.valueOf(Objects.equals(DBMSType.HIVE.getOhdsiDB(), source.getSourceDialect())) }; String renderedSql = SqlRender.renderSql(analysisSql, params, values); diff --git a/src/main/java/org/ohdsi/webapi/service/DDLService.java b/src/main/java/org/ohdsi/webapi/service/DDLService.java index e0a5df29be..0e35b0c401 100644 --- a/src/main/java/org/ohdsi/webapi/service/DDLService.java +++ b/src/main/java/org/ohdsi/webapi/service/DDLService.java @@ -20,11 +20,13 @@ import static org.ohdsi.webapi.service.SqlRenderService.translateSQL; +import com.odysseusinc.arachne.commons.types.DBMSType; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -89,9 +91,14 @@ public class DDLService { "/ddl/results/pathway_analysis_stats.sql" ); + private static final String INIT_HERACLES_PERIODS = "/ddl/results/init_heracles_periods.sql"; + public static final Collection RESULT_INIT_FILE_PATHS = Arrays.asList( - "/ddl/results/init_heracles_analysis.sql", - "/ddl/results/init_heracles_periods.sql" + "/ddl/results/init_heracles_analysis.sql", INIT_HERACLES_PERIODS + ); + + public static final Collection HIVE_RESULT_INIT_FILE_PATHS = Arrays.asList( + "/ddl/results/init_hive_heracles_analysis.sql", INIT_HERACLES_PERIODS ); public static final Collection INIT_CONCEPT_HIERARCHY_FILE_PATHS = Arrays.asList( @@ -136,7 +143,15 @@ public String generateResultSQL( put(TEMP_SCHEMA, oracleTempSchema); }}; - return generateSQL(dialect, params, resultDDLFilePaths, RESULT_INIT_FILE_PATHS, RESULT_INDEX_FILE_PATHS); + return generateSQL(dialect, params, resultDDLFilePaths, getResultInitFilePaths(dialect), RESULT_INDEX_FILE_PATHS); + } + + private Collection getResultInitFilePaths(String dialect) { + if (Objects.equals(DBMSType.HIVE.getOhdsiDB(), dialect)) { + return HIVE_RESULT_INIT_FILE_PATHS; + } else { + return RESULT_INIT_FILE_PATHS; + } } @GET diff --git a/src/main/java/org/ohdsi/webapi/source/Source.java b/src/main/java/org/ohdsi/webapi/source/Source.java index 4b512f8912..9bc6282262 100644 --- a/src/main/java/org/ohdsi/webapi/source/Source.java +++ b/src/main/java/org/ohdsi/webapi/source/Source.java @@ -118,12 +118,14 @@ public String getTableQualifier(DaimonType daimonType) { } public String getTableQualifierOrNull(DaimonType daimonType) { - for (SourceDaimon sourceDaimon : this.getDaimons()) { - if (sourceDaimon.getDaimonType() == daimonType) { - return sourceDaimon.getTableQualifier(); + if (this.getDaimons() != null){ + for (SourceDaimon sourceDaimon : this.getDaimons()) { + if (sourceDaimon.getDaimonType() == daimonType) { + return sourceDaimon.getTableQualifier(); + } } } - return null; + return null; } public String getSourceKey() { diff --git a/src/main/resources/ddl/results/heracles_results.sql b/src/main/resources/ddl/results/heracles_results.sql index 3fd8431ce2..431b115aea 100644 --- a/src/main/resources/ddl/results/heracles_results.sql +++ b/src/main/resources/ddl/results/heracles_results.sql @@ -1,3 +1,5 @@ +--HINT PARTITION(cohort_definition_id int) +--HINT BUCKET(analysis_id, 64) IF OBJECT_ID('@results_schema.heracles_results', 'U') IS NULL create table @results_schema.heracles_results ( diff --git a/src/main/resources/ddl/results/heracles_results_dist.sql b/src/main/resources/ddl/results/heracles_results_dist.sql index d6e6307e2f..ae214b4083 100644 --- a/src/main/resources/ddl/results/heracles_results_dist.sql +++ b/src/main/resources/ddl/results/heracles_results_dist.sql @@ -1,3 +1,5 @@ +--HINT PARTITION(cohort_definition_id int) +--HINT BUCKET(analysis_id, 64) IF OBJECT_ID('@results_schema.heracles_results_dist', 'U') IS NULL create table @results_schema.heracles_results_dist ( diff --git a/src/main/resources/ddl/results/init_hive_heracles_analysis.sql b/src/main/resources/ddl/results/init_hive_heracles_analysis.sql new file mode 100644 index 0000000000..99e75122b5 --- /dev/null +++ b/src/main/resources/ddl/results/init_hive_heracles_analysis.sql @@ -0,0 +1,215 @@ +TRUNCATE TABLE @results_schema.heracles_analysis; + +insert into table @results_schema.heracles_analysis (analysis_id,analysis_name,stratum_1_name,stratum_2_name,stratum_3_name,stratum_4_name,stratum_5_name,analysis_type) +values + (0, CAST('Source name' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PERSON' as VARCHAR(255))), + (1, CAST('Number of persons' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PERSON' as VARCHAR(255))), + (2, CAST('Number of persons by gender' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PERSON' as VARCHAR(255))), + (3, CAST('Number of persons by year of birth' as VARCHAR(255)), CAST('year_of_birth' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PERSON' as VARCHAR(255))), + (4, CAST('Number of persons by race' as VARCHAR(255)), CAST('race_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PERSON' as VARCHAR(255))), + (5, CAST('Number of persons by ethnicity' as VARCHAR(255)), CAST('ethnicity_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PERSON' as VARCHAR(255))), + (7, CAST('Number of persons with invalid provider_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PERSON' as VARCHAR(255))), + (8, CAST('Number of persons with invalid location_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PERSON' as VARCHAR(255))), + (9, CAST('Number of persons with invalid care_site_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PERSON' as VARCHAR(255))), + (101, CAST('Number of persons by age, with age at first observation period' as VARCHAR(255)), CAST('age' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (102, CAST('Number of persons by gender by age, with age at first observation period' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST('age' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (103, CAST('Distribution of age at first observation period' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (104, CAST('Distribution of age at first observation period by gender' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (105, CAST('Length of observation (days) of first observation period' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (106, CAST('Length of observation (days) of first observation period by gender' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (107, CAST('Length of observation (days) of first observation period by age decile' as VARCHAR(255)), CAST('age decile' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (108, CAST('Number of persons by length of first observation period, in 30d increments' as VARCHAR(255)), CAST('Observation period length 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (109, CAST('Number of persons with continuous observation in each year' as VARCHAR(255)), CAST('calendar year' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (110, CAST('Number of persons with continuous observation in each month' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (111, CAST('Number of persons by observation period start month' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (112, CAST('Number of persons by observation period end month' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (113, CAST('Number of persons by number of observation periods' as VARCHAR(255)), CAST('number of observation periods' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (114, CAST('Number of persons with observation period before year-of-birth' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (115, CAST('Number of persons with observation period end < observation period start' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (116, CAST('Number of persons with at least one day of observation in each year by gender and age decile' as VARCHAR(255)), CAST('calendar year' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST('age decile' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (117, CAST('Number of persons with at least one day of observation in each month' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (200, CAST('Number of persons with at least one visit occurrence, by visit_concept_id' as VARCHAR(255)), CAST('visit_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('VISITS' as VARCHAR(255))), + (201, CAST('Number of visit occurrence records, by visit_concept_id' as VARCHAR(255)), CAST('visit_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('VISITS' as VARCHAR(255))), + (202, CAST('Number of persons by visit occurrence start month, by visit_concept_id' as VARCHAR(255)), CAST('visit_concept_id' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('VISITS' as VARCHAR(255))), + (203, CAST('Number of distinct visit occurrence concepts per person' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('VISITS' as VARCHAR(255))), + (204, CAST('Number of persons with at least one visit occurrence, by visit_concept_id by calendar year by gender by age decile' as VARCHAR(255)), CAST('visit_concept_id' as VARCHAR(255)), CAST('calendar year' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST('age decile' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('VISITS' as VARCHAR(255))), + (206, CAST('Distribution of age by visit_concept_id' as VARCHAR(255)), CAST('visit_concept_id' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('VISITS' as VARCHAR(255))), + (207, CAST('Number of visit records with invalid person_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('VISITS' as VARCHAR(255))), + (208, CAST('Number of visit records outside valid observation period' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('VISITS' as VARCHAR(255))), + (209, CAST('Number of visit records with end date < start date' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('VISITS' as VARCHAR(255))), + (210, CAST('Number of visit records with invalid care_site_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('VISITS' as VARCHAR(255))), + (211, CAST('Distribution of length of stay by visit_concept_id' as VARCHAR(255)), CAST('visit_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('VISITS' as VARCHAR(255))), + (220, CAST('Number of visit occurrence records by visit occurrence start month' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('VISITS' as VARCHAR(255))), + (400, CAST('Number of persons with at least one condition occurrence, by condition_concept_id' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION' as VARCHAR(255))), + (401, CAST('Number of condition occurrence records, by condition_concept_id' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION' as VARCHAR(255))), + (402, CAST('Number of persons by condition occurrence start month, by condition_concept_id' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION' as VARCHAR(255))), + (403, CAST('Number of distinct condition occurrence concepts per person' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION' as VARCHAR(255))), + (404, CAST('Number of persons with at least one condition occurrence, by condition_concept_id by calendar year by gender by age decile' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST('calendar year' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST('age decile' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION' as VARCHAR(255))), + (405, CAST('Number of condition occurrence records, by condition_concept_id by condition_type_concept_id' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST('condition_type_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION' as VARCHAR(255))), + (406, CAST('Distribution of age by condition_concept_id' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION' as VARCHAR(255))), + (409, CAST('Number of condition occurrence records with invalid person_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION' as VARCHAR(255))), + (410, CAST('Number of condition occurrence records outside valid observation period' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION' as VARCHAR(255))), + (411, CAST('Number of condition occurrence records with end date < start date' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION' as VARCHAR(255))), + (412, CAST('Number of condition occurrence records with invalid provider_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION' as VARCHAR(255))), + (413, CAST('Number of condition occurrence records with invalid visit_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION' as VARCHAR(255))), + (420, CAST('Number of condition occurrence records by condition occurrence start month' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION' as VARCHAR(255))), + (500, CAST('Number of persons with death, by cause_of_death_concept_id' as VARCHAR(255)), CAST('cause_of_death_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DEATH' as VARCHAR(255))), + (501, CAST('Number of records of death, by cause_of_death_concept_id' as VARCHAR(255)), CAST('cause_of_death_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DEATH' as VARCHAR(255))), + (502, CAST('Number of persons by death month' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DEATH' as VARCHAR(255))), + (504, CAST('Number of persons with a death, by calendar year by gender by age decile' as VARCHAR(255)), CAST('calendar year' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST('age decile' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DEATH' as VARCHAR(255))), + (505, CAST('Number of death records, by death_type_concept_id' as VARCHAR(255)), CAST('death_type_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DEATH' as VARCHAR(255))), + (506, CAST('Distribution of age at death by gender' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DEATH' as VARCHAR(255))), + (509, CAST('Number of death records with invalid person_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DEATH' as VARCHAR(255))), + (510, CAST('Number of death records outside valid observation period' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DEATH' as VARCHAR(255))), + (511, CAST('Distribution of time from death to last condition' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DEATH' as VARCHAR(255))), + (512, CAST('Distribution of time from death to last drug' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DEATH' as VARCHAR(255))), + (513, CAST('Distribution of time from death to last visit' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DEATH' as VARCHAR(255))), + (514, CAST('Distribution of time from death to last procedure' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DEATH' as VARCHAR(255))), + (515, CAST('Distribution of time from death to last observation' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DEATH' as VARCHAR(255))), + (600, CAST('Number of persons with at least one procedure occurrence, by procedure_concept_id' as VARCHAR(255)), CAST('procedure_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PROCEDURE' as VARCHAR(255))), + (601, CAST('Number of procedure occurrence records, by procedure_concept_id' as VARCHAR(255)), CAST('procedure_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PROCEDURE' as VARCHAR(255))), + (602, CAST('Number of persons by procedure occurrence start month, by procedure_concept_id' as VARCHAR(255)), CAST('procedure_concept_id' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PROCEDURE' as VARCHAR(255))), + (603, CAST('Number of distinct procedure occurrence concepts per person' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PROCEDURE' as VARCHAR(255))), + (604, CAST('Number of persons with at least one procedure occurrence, by procedure_concept_id by calendar year by gender by age decile' as VARCHAR(255)), CAST('procedure_concept_id' as VARCHAR(255)), CAST('calendar year' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST('age decile' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PROCEDURE' as VARCHAR(255))), + (605, CAST('Number of procedure occurrence records, by procedure_concept_id by procedure_type_concept_id' as VARCHAR(255)), CAST('procedure_concept_id' as VARCHAR(255)), CAST('procedure_type_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PROCEDURE' as VARCHAR(255))), + (606, CAST('Distribution of age by procedure_concept_id' as VARCHAR(255)), CAST('procedure_concept_id' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PROCEDURE' as VARCHAR(255))), + (609, CAST('Number of procedure occurrence records with invalid person_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PROCEDURE' as VARCHAR(255))), + (610, CAST('Number of procedure occurrence records outside valid observation period' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PROCEDURE' as VARCHAR(255))), + (612, CAST('Number of procedure occurrence records with invalid provider_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PROCEDURE' as VARCHAR(255))), + (613, CAST('Number of procedure occurrence records with invalid visit_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PROCEDURE' as VARCHAR(255))), + (620, CAST('Number of procedure occurrence records by procedure occurrence start month' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('PROCEDURE' as VARCHAR(255))), + (700, CAST('Number of persons with at least one drug exposure, by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (701, CAST('Number of drug exposure records, by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (702, CAST('Number of persons by drug exposure start month, by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (703, CAST('Number of distinct drug exposure concepts per person' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (704, CAST('Number of persons with at least one drug exposure, by drug_concept_id by calendar year by gender by age decile' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST('calendar year' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST('age decile' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (705, CAST('Number of drug exposure records, by drug_concept_id by drug_type_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST('drug_type_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (706, CAST('Distribution of age by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (709, CAST('Number of drug exposure records with invalid person_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (710, CAST('Number of drug exposure records outside valid observation period' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (711, CAST('Number of drug exposure records with end date < start date' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (712, CAST('Number of drug exposure records with invalid provider_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (713, CAST('Number of drug exposure records with invalid visit_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (715, CAST('Distribution of days_supply by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (716, CAST('Distribution of refills by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (717, CAST('Distribution of quantity by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (720, CAST('Number of drug exposure records by drug exposure start month' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG' as VARCHAR(255))), + (800, CAST('Number of persons with at least one observation occurrence, by observation_concept_id' as VARCHAR(255)), CAST('observation_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (801, CAST('Number of observation occurrence records, by observation_concept_id' as VARCHAR(255)), CAST('observation_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (802, CAST('Number of persons by observation occurrence start month, by observation_concept_id' as VARCHAR(255)), CAST('observation_concept_id' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (803, CAST('Number of distinct observation occurrence concepts per person' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (804, CAST('Number of persons with at least one observation occurrence, by observation_concept_id by calendar year by gender by age decile' as VARCHAR(255)), CAST('observation_concept_id' as VARCHAR(255)), CAST('calendar year' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST('age decile' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (805, CAST('Number of observation occurrence records, by observation_concept_id by observation_type_concept_id' as VARCHAR(255)), CAST('observation_concept_id' as VARCHAR(255)), CAST('observation_type_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (806, CAST('Distribution of age by observation_concept_id' as VARCHAR(255)), CAST('observation_concept_id' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (807, CAST('Number of observation occurrence records, by observation_concept_id and unit_concept_id' as VARCHAR(255)), CAST('observation_concept_id' as VARCHAR(255)), CAST('unit_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (809, CAST('Number of observation records with invalid person_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (810, CAST('Number of observation records outside valid observation period' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (812, CAST('Number of observation records with invalid provider_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (813, CAST('Number of observation records with invalid visit_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (814, CAST('Number of observation records with no value (numeric, string, or concept)' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (815, CAST('Distribution of numeric values, by observation_concept_id and unit_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (816, CAST('Distribution of low range, by observation_concept_id and unit_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (817, CAST('Distribution of high range, by observation_concept_id and unit_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (818, CAST('Number of observation records below/within/above normal range, by observation_concept_id and unit_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (820, CAST('Number of observation records by observation start month' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('OBSERVATION' as VARCHAR(255))), + (900, CAST('Number of persons with at least one drug era, by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG_ERA' as VARCHAR(255))), + (901, CAST('Number of drug era records, by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG_ERA' as VARCHAR(255))), + (902, CAST('Number of persons by drug era start month, by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG_ERA' as VARCHAR(255))), + (903, CAST('Number of distinct drug era concepts per person' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG_ERA' as VARCHAR(255))), + (904, CAST('Number of persons with at least one drug era, by drug_concept_id by calendar year by gender by age decile' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST('calendar year' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST('age decile' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG_ERA' as VARCHAR(255))), + (906, CAST('Distribution of age by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG_ERA' as VARCHAR(255))), + (907, CAST('Distribution of drug era length, by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG_ERA' as VARCHAR(255))), + (908, CAST('Number of drug eras without valid person' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG_ERA' as VARCHAR(255))), + (909, CAST('Number of drug eras outside valid observation period' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG_ERA' as VARCHAR(255))), + (910, CAST('Number of drug eras with end date < start date' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG_ERA' as VARCHAR(255))), + (920, CAST('Number of drug era records by drug era start month' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('DRUG_ERA' as VARCHAR(255))), + (1000, CAST('Number of persons with at least one condition era, by condition_concept_id' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION_ERA' as VARCHAR(255))), + (1001, CAST('Number of condition era records, by condition_concept_id' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION_ERA' as VARCHAR(255))), + (1002, CAST('Number of persons by condition era start month, by condition_concept_id' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION_ERA' as VARCHAR(255))), + (1003, CAST('Number of distinct condition era concepts per person' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION_ERA' as VARCHAR(255))), + (1004, CAST('Number of persons with at least one condition era, by condition_concept_id by calendar year by gender by age decile' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST('calendar year' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST('age decile' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION_ERA' as VARCHAR(255))), + (1006, CAST('Distribution of age by condition_concept_id' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION_ERA' as VARCHAR(255))), + (1007, CAST('Distribution of condition era length, by condition_concept_id' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION_ERA' as VARCHAR(255))), + (1008, CAST('Number of condition eras without valid person' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION_ERA' as VARCHAR(255))), + (1009, CAST('Number of condition eras outside valid observation period' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION_ERA' as VARCHAR(255))), + (1010, CAST('Number of condition eras with end date < start date' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION_ERA' as VARCHAR(255))), + (1020, CAST('Number of condition era records by condition era start month' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CONDITION_ERA' as VARCHAR(255))), + (1100, CAST('Number of persons by location 3-digit zip' as VARCHAR(255)), CAST('3-digit zip' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('LOCATION' as VARCHAR(255))), + (1101, CAST('Number of persons by location state' as VARCHAR(255)), CAST('state' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('LOCATION' as VARCHAR(255))), + (1200, CAST('Number of persons by place of service' as VARCHAR(255)), CAST('place_of_service_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CARE_SITE' as VARCHAR(255))), + (1201, CAST('Number of visits by place of service' as VARCHAR(255)), CAST('place_of_service_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('CARE_SITE' as VARCHAR(255))), + (1300, CAST('Number of persons with at least one measurement occurrence, by measurement_concept_id' as VARCHAR(255)), CAST('measurement_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1301, CAST('Number of measurement occurrence records, by measurement_concept_id' as VARCHAR(255)), CAST('measurement_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1302, CAST('Number of persons by measurement occurrence start month, by measurement_concept_id' as VARCHAR(255)), CAST('measurement_concept_id' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1303, CAST('Number of distinct measurement occurrence concepts per person' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1304, CAST('Number of persons with at least one measurement occurrence, by measurement_concept_id by calendar year by gender by age decile' as VARCHAR(255)), CAST('measurement_concept_id' as VARCHAR(255)), CAST('calendar year' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST('age decile' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1305, CAST('Number of measurement occurrence records, by measurement_concept_id by measurement_type_concept_id' as VARCHAR(255)), CAST('measurement_concept_id' as VARCHAR(255)), CAST('measurement_type_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1306, CAST('Distribution of age by measurement_concept_id' as VARCHAR(255)), CAST('measurement_concept_id' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1307, CAST('Number of measurement occurrence records, by measurement_concept_id and unit_concept_id' as VARCHAR(255)), CAST('measurement_concept_id' as VARCHAR(255)), CAST('unit_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1309, CAST('Number of measurement records with invalid person_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1310, CAST('Number of measurement records outside valid measurement period' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1312, CAST('Number of measurement records with invalid provider_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1313, CAST('Number of measurement records with invalid visit_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1314, CAST('Number of measurement records with no value (numeric, string, or concept)' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1315, CAST('Distribution of numeric values, by measurement_concept_id and unit_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1316, CAST('Distribution of low range, by measurement_concept_id and unit_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1317, CAST('Distribution of high range, by measurement_concept_id and unit_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1318, CAST('Number of measurement records below/within/above normal range, by measurement_concept_id and unit_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1320, CAST('Number of measurement records by measurement start month' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('MEASUREMENT' as VARCHAR(255))), + (1700, CAST('Number of records by cohort_definition_id' as VARCHAR(255)), CAST('cohort_definition_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT' as VARCHAR(255))), + (1701, CAST('Number of records with cohort end date < cohort start date' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT' as VARCHAR(255))), + (1800, CAST('Number of persons by age, with age at cohort start' as VARCHAR(255)), CAST('age' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1801, CAST('Distribution of age at cohort start' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1802, CAST('Distribution of age at cohort start by gender' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1803, CAST('Distribution of age at cohort start by cohort start year' as VARCHAR(255)), CAST('calendar year' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1804, CAST('Number of persons by duration from cohort start to cohort end, in 30d increments' as VARCHAR(255)), CAST('Cohort period length 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1805, CAST('Number of persons by duration from observation start to cohort start, in 30d increments' as VARCHAR(255)), CAST('Baseline period length 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1806, CAST('Number of persons by duration from cohort start to observation end, in 30d increments' as VARCHAR(255)), CAST('Follow-up period length 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1807, CAST('Number of persons by duration from cohort end to observation end, in 30d increments' as VARCHAR(255)), CAST('Post-cohort period length 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1808, CAST('Distribution of duration (days) from cohort start to cohort end' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1809, CAST('Distribution of duration (days) from cohort start to cohort end, by gender' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)),CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1810, CAST('Distribution of duration (days) from cohort start to cohort end, by age decile' as VARCHAR(255)), CAST('age decile' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1811, CAST('Distribution of duration (days) from observation start to cohort start' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1812, CAST('Distribution of duration (days) from cohort start to observation end' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1813, CAST('Distribution of duration (days) from cohort end to observation end' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1814, CAST('Number of persons by cohort start year by gender by age decile' as VARCHAR(255)), CAST('calendar year' as VARCHAR(255)), CAST('gender_concept_id' as VARCHAR(255)), CAST('age decile' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1815, CAST('Number of persons by cohort start month' as VARCHAR(255)), CAST('calendar month' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1816, CAST('Number of persons by number of cohort periods' as VARCHAR(255)), CAST('number of cohort periods' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1820, CAST('Number of persons by duration from cohort start to first occurrence of condition occurrence, by condition_concept_id' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST('time-to-event 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1821, CAST('Number of events by duration from cohort start to all occurrences of condition occurrence, by condition_concept_id' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST('time-to-event 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1830, CAST('Number of persons by duration from cohort start to first occurrence of procedure occurrence, by procedure_concept_id' as VARCHAR(255)), CAST('procedure_concept_id' as VARCHAR(255)), CAST('time-to-event 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1831, CAST('Number of events by duration from cohort start to all occurrences of procedure occurrence, by procedure_concept_id' as VARCHAR(255)), CAST('procedure_concept_id' as VARCHAR(255)), CAST('time-to-event 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1840, CAST('Number of persons by duration from cohort start to first occurrence of drug exposure, by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST('time-to-event 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1841, CAST('Number of events by duration from cohort start to all occurrences of drug exposure, by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST('time-to-event 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1850, CAST('Number of persons by duration from cohort start to first occurrence of observation, by observation_concept_id' as VARCHAR(255)), CAST('observation_concept_id' as VARCHAR(255)), CAST('time-to-event 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1851, CAST('Number of events by duration from cohort start to all occurrences of observation, by observation_concept_id' as VARCHAR(255)), CAST('observation_concept_id' as VARCHAR(255)), CAST('time-to-event 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1860, CAST('Number of persons by duration from cohort start to first occurrence of condition era, by condition_concept_id' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST('time-to-event 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1861, CAST('Number of events by duration from cohort start to all occurrences of condition era, by condition_concept_id' as VARCHAR(255)), CAST('condition_concept_id' as VARCHAR(255)), CAST('time-to-event 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1870, CAST('Number of persons by duration from cohort start to first occurrence of drug era, by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST('time-to-event 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (1871, CAST('Number of events by duration from cohort start to all occurrences of drug era, by drug_concept_id' as VARCHAR(255)), CAST('drug_concept_id' as VARCHAR(255)), CAST('time-to-event 30d increments' as VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST(NULL AS VARCHAR(255)), CAST('COHORT_SPECIFIC_ANALYSES' as VARCHAR(255))), + (4000, CAST('Distribution of observation period days by period_id in the 365 days prior to first cohort_start_date' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL,CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4001, CAST('Number of subjects with visits by period_id, by visit_concept_id, by visit_type_concept_id in the 365d prior to first cohort start date' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4002, CAST('Distribution of number of visit occurrence records per subject by period_id, by visit_concept_id, by visit_type_concept_id in 365d prior to cohort start date' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4003, CAST('Distribution of number of visit dates per subject by period_id, by visit_concept_id, by visit_type_concept_id in 365d prior to first cohort start date' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4003, CAST('Distribution of number of visit dates per subject by period_id, by visit_concept_id, by visit_type_concept_id in 365d prior to first cohort start date' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4004, CAST('Distribution of number of care_site+visit dates per subject by period_id, by visit_concept_id, by visit_type_concept_id in 365d prior to first cohort start date' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4005, CAST('Distribution of length of stay for inpatient visits per subject by period_id, by visit_concept_id, by visit_type_concept_id in the 365 days prior to first cohort_start_date' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4006, CAST('Distribution of observation period days per subject, by period_id during cohort period' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4007, CAST('Number of subjects with visits by period_id, by visit_concept_id, by visit_type_concept_id during the cohort period' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4008, CAST('Distribution of number of visit occurrence records per subject by period_id, by visit_concept_id, by visit_type_concept_id during the cohort period' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4009, CAST('Distribution of number of visit dates per subject by period_id, by visit_concept_id, by visit_type_concept_id during the cohort period' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4010, CAST('Distribution of number of care_site+visit dates per subject by period_id, by visit_concept_id, by visit_type_concept_id during the cohort period' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4011, CAST('Distribution of length of stay for inpatient visits per subject by period_id, by visit_concept_id, by visit_type_concept_id during cohort period' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4012, CAST('Number of subjects with Drug Exposure by period_id, by drug_concept_id, by drug_type_concept_id in the 365d prior to first cohort start date' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4013, CAST('Distribution of number of Drug Exposure records per subject, by period_id, by drug_concept_id in 365d prior to first cohort start date' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4014, CAST('Distribution of greater than 0 drug day supply per subject by period_id, by drug_concept_id in the 365d prior to first cohort start date' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4015, CAST('Distribution of greater than 0 drug quantity per subject by period_id, by drug_concept_id in the 365d prior to first cohort start date' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4016, CAST('Number of subjects with Drug Exposure by period_id, by drug_concept_id, by drug_type_concept_id during the cohort period' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4017, CAST('Distribution of number of Drug Exposure records per subject, by period_id, by drug_concept_id during the cohort period' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4018, CAST('Distribution of greater than 0 drug day supply per subject by period_id, by drug_concept_id during the cohort period' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4019, CAST('Distribution of greater than 0 drug quantity per subject by period_id, by drug_concept_id during the cohort period' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4020, CAST('Distribution of greater than 0 US$ cost per subject by period_id, by visit_concept_id, by visit_type_concept_id, by cost_concept_id, by cost_type_concept_id in the 365d prior to first cohort start date' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4021, CAST('Distribution of greater than 0 US$ cost per subject by period_id, by visit_concept_id, by visit_type_concept_id, by cost_concept_id, by cost_type_concept_id during the cohort period' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4022, CAST('Distribution of greater than 0 US$ cost per subject by period_id, by drug_concept_id, by drug_type_concept_id, by cost_concept_id, by cost_type_concept_id in the 365d prior to first cohort start date' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))), + (4023, CAST('Distribution of greater than 0 US$ cost per subject by period_id, by drug_concept_id, by drug_type_concept_id, by cost_concept_id, by cost_type_concept_id, by cost_type_concept_id during the cohort period' as VARCHAR(255)), NULL, NULL, NULL, NULL, NULL, CAST('HEALTHCARE_UTILIZATION' as VARCHAR(255))) +; \ No newline at end of file diff --git a/src/main/resources/resources/cohortcharacterizations/sql/queryCovariateStatsVocab.sql b/src/main/resources/resources/cohortcharacterizations/sql/queryCovariateStatsVocab.sql index 686b840958..e354c38322 100644 --- a/src/main/resources/resources/cohortcharacterizations/sql/queryCovariateStatsVocab.sql +++ b/src/main/resources/resources/cohortcharacterizations/sql/queryCovariateStatsVocab.sql @@ -37,8 +37,18 @@ WITH main_table AS ( WHERE fr.covariate_id = @covariate_id and fr.cc_generation_id = @cc_generation_id and fr.cohort_definition_id = @cohort_id and min_levels_of_separation > 0 ) +-- Hive does not support DISTINCT * select distinct - mt.* + mt.covariate_id + , mt.covariate_name + , mt.analysis_id + , mt.analysis_name + , mt.concept_id + , mt.count_value + , mt.stat_value + , mt.strata_id + , mt.strata_name + , mt.fa_type , ar.concept_name , ar.ancestry_status , ar.min_levels_of_separation diff --git a/src/main/resources/resources/pathway/runPathwayAnalysis.sql b/src/main/resources/resources/pathway/runPathwayAnalysis.sql index c85a4d9c08..f602eef582 100644 --- a/src/main/resources/resources/pathway/runPathwayAnalysis.sql +++ b/src/main/resources/resources/pathway/runPathwayAnalysis.sql @@ -89,35 +89,35 @@ into |A--|A--| |B--|B--| -or +or |A--------------| |B-----| -into +into |A--|A-----|A---| |B-----| */ -WITH +WITH cohort_dates AS ( - SELECT DISTINCT subject_id, cohort_date + SELECT DISTINCT subject_id, cohort_date FROM ( - SELECT subject_id, cohort_start_date cohort_date FROM #collapsed_dates_events - UNION + SELECT subject_id, cohort_start_date cohort_date FROM #collapsed_dates_events + UNION SELECT subject_id,cohort_end_date cohort_date FROM #collapsed_dates_events ) all_dates ), time_periods AS ( SELECT subject_id, cohort_date, LEAD(cohort_date,1) over (PARTITION BY subject_id ORDER BY cohort_date ASC) next_cohort_date - FROM cohort_dates + FROM cohort_dates GROUP BY subject_id, cohort_date ), events AS ( - SELECT tp.subject_id, event_cohort_index, cohort_date cohort_start_date, next_cohort_date cohort_end_date + SELECT tp.subject_id, event_cohort_index, cohort_date cohort_start_date, next_cohort_date cohort_end_date FROM time_periods tp LEFT JOIN #collapsed_dates_events e ON e.subject_id = tp.subject_id WHERE (e.cohort_start_date <= tp.cohort_date AND e.cohort_end_date >= tp.next_cohort_date) -) +) SELECT cast(SUM(POWER(cast(2 as bigint), e.event_cohort_index)) as bigint) as combo_id, subject_id , cohort_start_date, cohort_end_date into #combo_events FROM events e diff --git a/src/test/java/org/ohdsi/webapi/util/DataSourceDTOParserTest.java b/src/test/java/org/ohdsi/webapi/util/DataSourceDTOParserTest.java index b78547e209..40fa1b3a70 100644 --- a/src/test/java/org/ohdsi/webapi/util/DataSourceDTOParserTest.java +++ b/src/test/java/org/ohdsi/webapi/util/DataSourceDTOParserTest.java @@ -28,6 +28,7 @@ public class DataSourceDTOParserTest { "OAuthPvtKeyPath=C:\\SecureFiles\\ServiceKeyFile.p12;"; public static final String ORACLE_WO_PWD_CONN_STR = "jdbc:oracle:thin:@myhost:1521:orcl"; public static final String ORACLE_WITH_PWD_CONN_STR = "jdbc:oracle:thin:scott/tiger@myhost:1521:orcl"; + public static final String HIVE_CONN_STR = "jdbc:hive2://sandbox-hdp.hortonworks.com:2181/synpuf_531_orc;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2"; @Test public void parseDTO() { @@ -103,6 +104,12 @@ public void parseDTO() { assertThat(dto.getConnectionString(), is(ORACLE_WITH_PWD_CONN_STR)); assertThat(dto.getUsername(), is("scott")); assertThat(dto.getPassword(), is("tiger")); + + dto = DataSourceDTOParser.parseDTO(getHiveSource()); + assertThat(dto.getType(), is(DBMSType.HIVE)); + assertThat(dto.getConnectionString(), is(HIVE_CONN_STR)); + assertThat(dto.getUsername(), is(nullValue())); + assertThat(dto.getPassword(), is(nullValue())); } private Source getPostgreSQLPasswordSource() { @@ -190,4 +197,11 @@ private Source getPostgreSQLSource() { source.setSourceConnection(PGSQL_CONN_STR); return source; } + + private Source getHiveSource() { + Source source = new Source(); + source.setSourceDialect("hive"); + source.setSourceConnection(HIVE_CONN_STR); + return source; + } } \ No newline at end of file