-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1981a37
commit d2d8d90
Showing
1 changed file
with
5 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
com_cdr = "" # The comibend dataset | ||
deid_base_cdr = "" # the deid dataset | ||
pipeline = "" # the pipeline tables | ||
run_as = "" # The account used to run checks | ||
run_as = "[email protected]" # The account used to run checks | ||
|
||
# + | ||
impersonation_creds = auth.get_impersonation_credentials( | ||
|
@@ -398,15 +398,15 @@ | |
|
||
# has to be deid_base | ||
query = JINJA_ENV.from_string(""" | ||
WITH multi_select as ( -- participants answered the question with multiple selections | ||
WITH multi_select as ( -- participants answered the question with multiple selections -- | ||
SELECT o1.person_id, o1.value_source_value as primary_answer,o2.value_source_value as secondary_answer | ||
FROM (SELECT person_id, value_source_value FROM `{{project_id}}.{{deid_base_cdr}}.observation` WHERE observation_source_concept_id = 1586140 AND value_source_value NOT LIKE '%ispanic') o1 | ||
JOIN (SELECT person_id, value_source_value FROM `{{project_id}}.{{deid_base_cdr}}.observation` WHERE observation_source_concept_id = 1586140) o2 | ||
USING (person_id) | ||
WHERE o1.value_source_value <> o2.value_source_value | ||
) | ||
, single_select as ( -- participants answered the question with only one selection | ||
, single_select as ( -- participants answered the question with only one selection -- | ||
SELECT person_id, value_source_value as primary_answer, 'None' as secondary_answer | ||
FROM `{{project_id}}.{{deid_base_cdr}}.observation` | ||
WHERE observation_source_concept_id = 1586140 | ||
|
@@ -416,13 +416,13 @@ | |
, all_selections_transformations as ( | ||
(SELECT person_id, | ||
CASE | ||
WHEN primary_answer = 'WhatRaceEthnicity_Hispanic' THEN 'AoUDRC_NoneIndicated' -- only selected hispanic | ||
WHEN primary_answer = 'WhatRaceEthnicity_Hispanic' THEN 'AoUDRC_NoneIndicated' -- only selected hispanic -- | ||
ELSE primary_answer END AS | ||
primary_answer, | ||
CASE | ||
WHEN primary_answer = 'PMI_PreferNotToAnswer' THEN 'PMI_PreferNotToAnswer' | ||
WHEN primary_answer = 'PMI_Skip' THEN 'PMI_Skip' | ||
WHEN primary_answer = 'WhatRaceEthnicity_Hispanic' THEN 'Hispanic' -- only selected hispanic | ||
WHEN primary_answer = 'WhatRaceEthnicity_Hispanic' THEN 'Hispanic' -- only selected hispanic -- | ||
WHEN primary_answer = 'WhatRaceEthnicity_RaceEthnicityNoneOfThese' THEN 'WhatRaceEthnicity_RaceEthnicityNoneOfThese' | ||
ELSE 'Not Hispanic' END AS | ||
secondary_answer, | ||
|