Skip to content

Commit

Permalink
[DC-3635] Remove portion of query checking primary consent (#1834)
Browse files Browse the repository at this point in the history
* [DC-3635] Remove portion of query checking primary consent

* [DC-3635] Remove fitbit check in CT
  • Loading branch information
Michael Schmidt authored and ratuagga committed Jan 29, 2024
1 parent b680735 commit ed403e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,6 @@ def query_template(table_era):
# **If check fails:**<br>
# * The issue `participant with multiple records` means that those participants have multiple rows in the wear_study table, which should not be possible. Investigate the issue. Start with the CR that creates the wear_study table. <br>
# * The issue `not in person table` means that participants exist in the wear_study table that aren't in the person table, which should not be possible. Investigate the issue. Start with the CR that creates the wear_study table.<br>
# * The issue `no primary consent` means that participants exist in the wear_study table that do not have proper primary consent. Investigate the issue. It is possible that there is another way to determine primary consent. <br>

# +
query = JINJA_ENV.from_string("""
Expand Down Expand Up @@ -1329,26 +1328,6 @@ def query_template(table_era):
SELECT person_id
FROM `{{project_id}}.{{ct_dataset}}.person` o
)
UNION ALL
SELECT
'no primary consent' as issue,
COUNT(person_id) as bad_rows
FROM `{{project_id}}.{{ct_dataset}}.wear_study` ws
WHERE person_id not in ( -- aou consenting participants --
SELECT cte.person_id
FROM latest_primary_consent_records cte
LEFT JOIN ( -- any positive primary consent --
SELECT *
FROM `{{project_id}}.{{ct_dataset}}.observation`
WHERE REGEXP_CONTAINS(observation_source_value, '(?i)extraconsent_agreetoconsent')
AND value_as_concept_id = 45877994) o
ON cte.person_id = o.person_id
AND cte.latest_date = o.observation_date
WHERE o.person_id IS NOT NULL
)
""")
q = query.render(project_id=project_id, ct_dataset=ct_dataset)
df1 = execute(client, q)
Expand All @@ -1371,6 +1350,7 @@ def query_template(table_era):
ignore_index=True)
# -


df1

# +
Expand Down Expand Up @@ -1530,4 +1510,4 @@ def highlight_cells(val):
return f'background-color: {color}'


df.style.applymap(highlight_cells).set_properties(**{'text-align': 'left'})
df.style.applymap(highlight_cells).set_properties(**{'text-align': 'left'})
Original file line number Diff line number Diff line change
Expand Up @@ -864,26 +864,6 @@ def my_sql(table_name, column_name):
SELECT person_id
FROM `{{project_id}}.{{rt_cdr_deid}}.person` o
)
UNION ALL
SELECT
'no primary consent' as issue,
COUNT(person_id) as bad_rows
FROM `{{project_id}}.{{rt_cdr_deid}}.wear_study` ws
WHERE person_id not in ( -- aou consenting participants --
SELECT cte.person_id
FROM latest_primary_consent_records cte
LEFT JOIN ( -- any positive primary consent --
SELECT *
FROM `{{project_id}}.{{rt_cdr_deid}}.observation`
WHERE REGEXP_CONTAINS(observation_source_value, '(?i)extraconsent_agreetoconsent')
AND value_as_concept_id = 45877994) o
ON cte.person_id = o.person_id
AND cte.latest_date = o.observation_date
WHERE o.person_id IS NOT NULL
)
""")
q = query.render(project_id=project_id,
rt_cdr_deid=rt_cdr_deid)
Expand Down

0 comments on commit ed403e4

Please sign in to comment.