-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecp_execute.R
136 lines (114 loc) · 6.01 KB
/
ecp_execute.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
pcd <- site_cdm_tbl('procedure_occurrence') %>% select(person_id) %>% distinct()
drg <- site_cdm_tbl('drug_exposure') %>% select(person_id) %>% distinct()
ml <- site_cdm_tbl('measurement_labs') %>% select(person_id) %>% distinct()
pdl_pts <- pcd %>%
inner_join(drg) %>%
inner_join(ml) %>% compute_new()
#' List of inputs for check_ecp
#'
#' Each element of the parent list should be named after the concept and domain of interest
#'
#' Within each of those list elements, a second list should be constructed with the
#' following elements in this exact order:
#'
#' 1. the fact table that contains the concept of interest.
#'
#' this can be filtered as needed within the list to tailor the fact table
#' (i.e. selecting only outpatient labs)
#'
#' 2. the table with the desired population of patients to be used as the denominator
#'
#' this can be filtered as needed within the list to tailor the denominator
#' (i.e. selecting only patients with a drug) and can differ between list elements
#'
#' 3. the name of the column within the fact table that contains the relevant
#' concept_ids (i.e. measurement_concept_id, condition_source_concept_id, etc.)
#'
#' 4. a codeset that contains or is filtered down to codes for the concept of interest
#'
#' 5. a string identifier for the check, prefixed with the check name like `ecp_*`
#'
ecp_codeset_list <- list(
'hemoglobin_labs' = list(site_cdm_tbl('measurement_labs'),
pdl_pts,
'measurement_concept_id',
load_codeset('ecp_concepts', 'ciccc') %>% filter(concept_group == 'hemoglobin'),
'ecp_hemoglobin'),
'platelet_labs' = list(site_cdm_tbl('measurement_labs'),
pdl_pts,
'measurement_concept_id',
load_codeset('ecp_concepts', 'ciccc') %>%
filter(concept_group == 'platelets'),
'ecp_platelet_count'),
'anc_labs' = list(site_cdm_tbl('measurement_labs'),
pdl_pts,
'measurement_concept_id',
load_codeset('ecp_concepts', 'ciccc') %>% filter(concept_group == 'anc'),
'ecp_anc'),
'scr_labs' = list(site_cdm_tbl('measurement_labs'),
pdl_pts,
'measurement_concept_id',
load_codeset('ecp_concepts', 'ciccc') %>% filter(concept_group == 'creatinine_serum'),
'ecp_scr'),
'sodium_labs' = list(site_cdm_tbl('measurement_labs'),
pdl_pts,
'measurement_concept_id',
load_codeset('ecp_concepts', 'ciccc') %>% filter(concept_group == 'sodium'),
'ecp_sodium'),
'alanine_transaminase_labs' = list(site_cdm_tbl('measurement_labs'),
pdl_pts,
'measurement_concept_id',
load_codeset('ecp_concepts', 'ciccc') %>%
filter(concept_group == 'alanine_transaminase'),
'ecp_alanine_transaminase'),
'urine_protein_qual_labs' = list(site_cdm_tbl('measurement_labs'),
pdl_pts,
'measurement_concept_id',
load_codeset('ecp_concepts', 'ciccc') %>%
filter(concept_group == 'urine_protein_qual'),
'ecp_urine_protein_qual'),
# 'cholesterol_labs' = list(site_cdm_tbl('measurement_labs'),
# pdl_pts,
# 'measurement_concept_id',
# load_codeset('ecp_concepts', 'ciccc') %>% filter(concept_group == 'cholesterol_all'),
# 'ecp_cholesterol'),
'rapid_strep_labs' = list(site_cdm_tbl('measurement_labs'),
pdl_pts,
'measurement_concept_id',
load_codeset('ecp_concepts', 'ciccc') %>% filter(concept_group == 'rapid_strep'),
'ecp_rapid_strep'),
'flu_labs' = list(site_cdm_tbl('measurement_labs'),
pdl_pts,
'measurement_concept_id',
load_codeset('ecp_concepts', 'ciccc') %>% filter(concept_group == 'influenza'),
'ecp_flu'),
'rsv_labs' = list(site_cdm_tbl('measurement_labs'),
pdl_pts,
'measurement_concept_id',
load_codeset('ecp_concepts', 'ciccc') %>% filter(concept_group == 'rsv'),
'ecp_rsv'),
'head_circumference' = list(site_cdm_tbl('measurement_anthro'),
pdl_pts,
'measurement_concept_id',
load_codeset('ecp_concepts', 'ciccc') %>%
filter(concept_group == 'head_circumference'),
'ecp_head_circumference'),
'smoking_tobacco' = list(site_cdm_tbl('observation'),
pdl_pts,
'observation_concept_id',
load_codeset('ecp_concepts', 'ciccc') %>%
filter(concept_group == 'smoking_tobacco'),
'ecp_smoking_tobacco'),
'height' = list(site_cdm_tbl('measurement_anthro'),
pdl_pts,
'measurement_concept_id',
load_codeset('ecp_concepts', 'ciccc') %>%
filter(concept_group == 'height'),
'ecp_height'),
'weight' = list(site_cdm_tbl('measurement_anthro'),
pdl_pts,
'measurement_concept_id',
load_codeset('ecp_concepts', 'ciccc') %>%
filter(concept_group == 'weight'),
'ecp_weight')
)