You can find what participants have given consent to their EHR by querying the observation table for participants who have observation_source_concept_id = 1586099 (EHRConsentPII_ConsentPermission) with value_source_concept_id = 1586100 (Yes).
You can use the following code in python to get this information:
SELECT DISTINCT person_id
FROM `{CDR_DATASET}.observation`
WHERE observation_source_concept_id = 1586099
and value_source_concept_id = 1586100 #ConsentPermission_Yes
You can use the following code in R to get this information:
library(bigrquery)
library(tidyverse)
CDR_DATASET= Sys.getenv('WORKSPACE_CDR')
# helper function
download_data <- function(query) {
tb <- bq_project_query(Sys.getenv('GOOGLE_PROJECT'), query)
bq_table_download(tb)
}
query = str_glue("
SELECT DISTINCT person_id
FROM `{CDR_DATASET}.observation`
WHERE observation_concept_id = 1586099
AND value_source_concept_id = 1586100 #ConsentPermission_Yes"
)
ehr_consented_pids_df = download_data(query)
head(ehr_consented_pids_df)
Comments
0 comments
Article is closed for comments.