Skip to content

Commit

Permalink
Fix for #309: Oracle error on selecting null values (#314)
Browse files Browse the repository at this point in the history
* Fix for #309, Oracle error when using zero-length columns

* Added schema CSV for achilles heel. Converted all remaining null values to "cast(null as" with appropriate data type to help fix #309.
  • Loading branch information
Ajit Londhe authored and t-abdul-basser committed Sep 20, 2018
1 parent d5a0ff7 commit 07c47f3
Show file tree
Hide file tree
Showing 243 changed files with 347 additions and 342 deletions.
5 changes: 5 additions & 0 deletions inst/csv/schemas/schema_achilles_heel.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FIELD_NAME,FIELD_TYPE
analysis_id,int
achilles_heel_warning,varchar(255)
rule_id,int
record_count,bigint
22 changes: 11 additions & 11 deletions inst/sql/sql_server/analyses/0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 0 as analysis_id, CAST('@source_name' AS VARCHAR(255)) as stratum_1, CAST('@achilles_version' AS VARCHAR(255)) as stratum_2,
CAST(GETDATE() AS VARCHAR(255)) as stratum_3,
null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct person_id) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_0
from @cdmDatabaseSchema.PERSON;

--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 0 as analysis_id, CAST('@source_name' AS VARCHAR(255)) as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct person_id) as count_value,
null as min_value,
null as max_value,
null as avg_value,
null as stdev_value,
null as median_value,
null as p10_value,
null as p25_value,
null as p75_value,
null as p90_value
cast(null as float) as min_value,
cast(null as float) as max_value,
cast(null as float) as avg_value,
cast(null as float) as stdev_value,
cast(null as float) as median_value,
cast(null as float) as p10_value,
cast(null as float) as p25_value,
cast(null as float) as p75_value,
cast(null as float) as p90_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_dist_0
from @cdmDatabaseSchema.PERSON;
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- 1 Number of persons

select 1 as analysis_id,
null as stratum_1, null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_1, cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct person_id) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_1
from @cdmDatabaseSchema.PERSON;
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/10.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 10 as analysis_id, CAST(year_of_birth AS VARCHAR(255)) as stratum_1,
CAST(gender_concept_id AS VARCHAR(255)) as stratum_2,
null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct person_id) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_10
from @cdmDatabaseSchema.PERSON
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1000.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 1000 as analysis_id,
CAST(ce1.condition_CONCEPT_ID AS VARCHAR(255)) as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct ce1.PERSON_ID) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_1000
from
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1001.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 1001 as analysis_id,
CAST(ce1.condition_CONCEPT_ID AS VARCHAR(255)) as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(ce1.PERSON_ID) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_1001
from
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1002.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
select 1002 as analysis_id,
CAST(ce1.condition_concept_id AS VARCHAR(255)) as stratum_1,
CAST(YEAR(condition_era_start_date)*100 + month(condition_era_start_date) AS VARCHAR(255)) as stratum_2,
null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct PERSON_ID) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_1002
from
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1003.sql
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ GROUP BY o.total, o.min_value, o.max_value, o.avg_value, o.stdev_value

--HINT DISTRIBUTE_ON_KEY(count_value)
select analysis_id,
null as stratum_1, null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_1, cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
count_value, min_value, max_value, avg_value, stdev_value, median_value, p10_value, p25_value, p75_value, p90_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_dist_1003
from #tempResults
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1004.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ select 1004 as analysis_id,
CAST(YEAR(condition_era_start_date) AS VARCHAR(255)) as stratum_2,
CAST(p1.gender_concept_id AS VARCHAR(255)) as stratum_3,
CAST(floor((year(condition_era_start_date) - p1.year_of_birth)/10) AS VARCHAR(255)) as stratum_4,
null as stratum_5,
cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct p1.PERSON_ID) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_1004
from @cdmDatabaseSchema.PERSON p1
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1006.sql
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ GROUP BY o.stratum1_id, o.stratum2_id, o.total, o.min_value, o.max_value, o.avg_

--HINT DISTRIBUTE_ON_KEY(stratum_1)
select analysis_id, stratum1_id as stratum_1, stratum2_id as stratum_2,
null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
count_value, min_value, max_value, avg_value, stdev_value, median_value, p10_value, p25_value, p75_value, p90_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_dist_1006
from #tempResults
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1007.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ GROUP BY p.stratum1_id, o.total, o.min_value, o.max_value, o.avg_value, o.stdev_

--HINT DISTRIBUTE_ON_KEY(stratum_1)
select analysis_id, stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
count_value, min_value, max_value, avg_value, stdev_value, median_value, p10_value, p25_value, p75_value, p90_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_dist_1007
from #tempResults
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1008.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


select 1008 as analysis_id,
null as stratum_1, null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_1, cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(ce1.PERSON_ID) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_1008
from
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1009.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


select 1009 as analysis_id,
null as stratum_1, null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_1, cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(ce1.PERSON_ID) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_1009
from
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/101.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 101 as analysis_id, CAST(year(op1.index_date) - p1.YEAR_OF_BIRTH AS VARCHAR(255)) as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(p1.person_id) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_101
from @cdmDatabaseSchema.PERSON p1
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1010.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


select 1010 as analysis_id,
null as stratum_1, null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_1, cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(ce1.PERSON_ID) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_1010
from
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/102.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 102 as analysis_id, CAST(p1.gender_concept_id AS VARCHAR(255)) as stratum_1,
CAST(year(op1.index_date) - p1.YEAR_OF_BIRTH AS VARCHAR(255)) as stratum_2,
null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(p1.person_id) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_102
from @cdmDatabaseSchema.PERSON p1
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1020.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 1020 as analysis_id,
CAST(YEAR(condition_era_start_date)*100 + month(condition_era_start_date) AS VARCHAR(255)) as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(PERSON_ID) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_1020
from
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/103.sql
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ tempResults as
GROUP BY o.total, o.min_value, o.max_value, o.avg_value, o.stdev_value
)
select analysis_id,
null as stratum_1, null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_1, cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
count_value, min_value, max_value, avg_value, stdev_value, median_value, p10_value, p25_value, p75_value, p90_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_dist_103
from tempResults
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/104.sql
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ GROUP BY o.gender_concept_id, o.total, o.min_value, o.max_value, o.avg_value, o.

--HINT DISTRIBUTE_ON_KEY(stratum_1)
select analysis_id, stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
count_value, min_value, max_value, avg_value, stdev_value, median_value, p10_value, p25_value, p75_value, p90_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_dist_104
from #tempResults
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/105.sql
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ GROUP BY o.total, o.min_value, o.max_value, o.avg_value, o.stdev_value

--HINT DISTRIBUTE_ON_KEY(count_value)
select analysis_id,
null as stratum_1, null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5, count_value,
cast(null as varchar(255)) as stratum_1, cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5, count_value,
min_value, max_value, avg_value, stdev_value, median_value, p10_value, p25_value, p75_value, p90_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_dist_105
from #tempResults
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/106.sql
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ GROUP BY o.gender_concept_id, o.total, o.min_value, o.max_value, o.avg_value, o.

--HINT DISTRIBUTE_ON_KEY(stratum_1)
select analysis_id, gender_concept_id as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
count_value, min_value, max_value, avg_value, stdev_value, median_value, p10_value, p25_value, p75_value, p90_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_dist_106
FROM #tempResults
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/107.sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ GROUP BY o.age_decile, o.total, o.min_value, o.max_value, o.avg_value, o.stdev_v

--HINT DISTRIBUTE_ON_KEY(stratum_1)
select analysis_id, age_decile as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
count_value, min_value, max_value, avg_value, stdev_value, median_value, p10_value, p25_value, p75_value, p90_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_dist_107
FROM #tempResults
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/108.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 108 as analysis_id, CAST(floor(DATEDIFF(dd, op1.observation_period_start_date, op1.observation_period_end_date)/30) AS VARCHAR(255)) as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct p1.person_id) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_108
from @cdmDatabaseSchema.PERSON p1
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/109.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ FROM @cdmDatabaseSchema.observation_period
SELECT
109 AS analysis_id,
CAST(obs_year AS VARCHAR(255)) AS stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(DISTINCT person_id) AS count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_109
FROM @cdmDatabaseSchema.observation_period,
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/11.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 11 as analysis_id, CAST(year_of_birth AS VARCHAR(255)) as stratum_1,
CAST(gender_concept_id AS VARCHAR(255)) as stratum_2,
null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct person_id) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_11
from @cdmDatabaseSchema.PERSON
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/110.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
SELECT
110 as analysis_id,
CAST(t1.obs_month AS VARCHAR(255)) as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct op1.PERSON_ID) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_110
FROM
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1100.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 1100 as analysis_id,
CAST(left(l1.zip,3) AS VARCHAR(255)) as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct person_id) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_1100
from @cdmDatabaseSchema.PERSON p1
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1101.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 1101 as analysis_id,
CAST(l1.state AS VARCHAR(255)) as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct person_id) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_1101
from @cdmDatabaseSchema.PERSON p1
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1102.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 1102 as analysis_id,
CAST(left(l1.zip,3) AS VARCHAR(255)) as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct care_site_id) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_1102
from @cdmDatabaseSchema.care_site cs1
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/1103.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 1103 as analysis_id,
CAST(l1.state AS VARCHAR(255)) as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct care_site_id) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_1103
from @cdmDatabaseSchema.care_site cs1
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/111.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 111 as analysis_id,
CAST(YEAR(observation_period_start_date)*100 + month(OBSERVATION_PERIOD_START_DATE) AS VARCHAR(255)) as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct op1.PERSON_ID) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_111
from
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/112.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 112 as analysis_id,
CAST(YEAR(observation_period_end_date)*100 + month(observation_period_end_date) AS VARCHAR(255)) as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct op1.PERSON_ID) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_112
from
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/113.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--HINT DISTRIBUTE_ON_KEY(stratum_1)
select 113 as analysis_id,
CAST(op1.num_periods AS VARCHAR(255)) as stratum_1,
null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct op1.PERSON_ID) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_113
from
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/114.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- 114 Number of persons with observation period before year-of-birth

select 114 as analysis_id,
null as stratum_1, null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_1, cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct p1.PERSON_ID) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_114
from
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/115.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- 115 Number of persons with observation period end < start

select 115 as analysis_id,
null as stratum_1, null as stratum_2, null as stratum_3, null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_1, cast(null as varchar(255)) as stratum_2, cast(null as varchar(255)) as stratum_3, cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(op1.PERSON_ID) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_115
from
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/analyses/116.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ select 116 as analysis_id,
CAST(t1.obs_year AS VARCHAR(255)) as stratum_1,
CAST(p1.gender_concept_id AS VARCHAR(255)) as stratum_2,
CAST(floor((t1.obs_year - p1.year_of_birth)/10) AS VARCHAR(255)) as stratum_3,
null as stratum_4, null as stratum_5,
cast(null as varchar(255)) as stratum_4, cast(null as varchar(255)) as stratum_5,
COUNT_BIG(distinct p1.PERSON_ID) as count_value
into @scratchDatabaseSchema@schemaDelim@tempAchillesPrefix_116
from
Expand Down
Loading

0 comments on commit 07c47f3

Please sign in to comment.