-
Notifications
You must be signed in to change notification settings - Fork 0
/
00-process-lists.Rmd
329 lines (241 loc) · 7.74 KB
/
00-process-lists.Rmd
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
---
title: "Process various data lists"
date: "`r Sys.Date()`"
output:
html_document:
df_print: paged
knit: (function(inputFile, encoding) { rmarkdown::render(inputFile, encoding = encoding, output_dir = "docs") })
---
By **Christian McDonald**, Assistant Professor of Practice\
School of Journalism and Media, Moody College of Communication\
University of Texas at Austin
---
This THCIC analysis will need various lists of columns and ICD-10 codes. This notebook defines them and write them to rds where they can be use in later analysis.
Of note, to turn a single-column rds import into a vector, use the following:
```txt
new_list <- read_rds("procedures-lists/filename.rds") %>% .$col_name_from_df
```
```{r setup, echo=T, results='hide', message=F, warning=F}
library(tidyverse)
library(janitor)
```
## THCIC column lists
The diagnostic and surgical procedure columns from the THCIC data are frequently used in `case_when()` statements and other vectors. This writes them to csv and rds for use later. I use my test data as a base point to find the columns.
There is an example data dictionary in the `resources` directory of this repo, or avialable online labeled as [User Manual, 2019](https://www.dshs.texas.gov/thcic/hospitals/Inpatientpudf.shtm).
### Import test data for column generation
```{r data_test}
testdata <- read_rds("data-test/ahrq_del_all_loop_test.rds")
```
### Diagnostic columns
Values are all the names of diagnostics columns from the data in a singe tibble with column named `diag`.
```{r cols_diag}
cols_diag <- testdata %>%
select(contains("_DIAG"), -starts_with("POA")) %>%
names() %>%
tibble::enframe(name = NULL) %>%
rename(diag = value)
cols_diag %>%
write_csv("procedures-lists/cols_diag.csv")
cols_diag %>%
write_rds("procedures-lists/cols_diag.rds")
```
### Surgical procedure columns
Values are all the names of surgical procedure columns from the data in a singe tibble with column named `surg`.
```{r cols_surg}
cols_surg <- testdata %>%
select(contains("SURG_PROC_CODE")) %>%
names() %>%
tibble::enframe(name = NULL) %>%
rename(surg = value)
cols_surg %>%
write_csv("procedures-lists/cols_surg.csv")
cols_surg %>%
write_rds("procedures-lists/cols_surg.rds")
```
## AHRQ lists
These can come from AHRQ IQI 22 and 33. Some are in both. In addition to the links below they available in the `resources` directory of this repo.
- [IQI 22 Vaginal Birth After Cesarean (VBAC) Delivery Rate, Uncomplicated](https://www.qualityindicators.ahrq.gov/Downloads/Modules/IQI/V2020/TechSpecs/IQI_22_Vaginal_Birth_After_Cesarean_(VBAC)_Delivery_Rate_Uncomplicated.pdf)
- [IQI 33 Primary Cesarean Delivery Rate, Uncomplicated](https://www.qualityindicators.ahrq.gov/Downloads/Modules/IQI/V2020/TechSpecs/IQI_33_Primary_Cesarean_Delivery_Rate_Uncomplicated.pdf)
### All deliveries (DELOCMD)
All deliveries, identified by any-listed ICD-10-CM diagnosis code for outcome of delivery (DELOCMD). In IQI 33 (2020).
```{r delocmd}
delocmd_list <- c(
"Z370",
"Z371",
"Z372",
"Z373",
"Z374",
"Z3750",
"Z3751",
"Z3752",
"Z3753",
"Z3754",
"Z3759",
"Z3760",
"Z3761",
"Z3762",
"Z3763",
"Z3764",
"Z3769",
"Z377",
"Z379"
) %>%
tibble::enframe(name = NULL) %>%
rename(delocmd = value)
delocmd_list %>%
write_rds("procedures-lists/ahrq_delocmd.rds")
delocmd_list %>% nrow()
```
### Abnormal presentations (PRCSECD)
We first need the list of PRCSECD codes from `resources/IQI_Appendix_A_v2020.pdf`: "Abnormal presentation, fetal death, and multiple gestation diagnosis codes: (PRCSECD)."
The list of codes was extracted from the PDF and cleaned in OpenRefine to get the full list. The OpenRefine project is available in the `procedures/iqi-appendex-a` folder.
```{r prcsecd}
prcsecd_list <- read_csv("procedures-lists/IQI_Appendix_A.csv") %>% rename(prcsecd = codes)
prcsecd_list %>%
write_rds("procedures-lists/ahrq_prcsecd.rds")
prcsecd_list %>% nrow()
```
### Cesarean delivery procedure codes: (PRCSECP)
As defined in 1Q1 33 Primary Cesarean Delivery Rate, Uncomplicated (2020). These values update those above. Need to ensure they catch cesarean deliveries in prior years. Basically in 2020 they removed one of the previous options to use MS-DRG codes (which was easier.)
```{r prcsecp}
prcsecp_list <- c(
"10D00Z0",
"10D00Z1",
"10D00Z2"
) %>%
tibble::enframe(name = NULL) %>%
rename(prcsecp = value)
prcsecp_list %>%
write_rds("procedures-lists/ahrq_prcsecp.rds")
prcsecp_list %>% nrow()
```
### Hysterotomy procedure codes: (PRCSE2P)
As defined in 1Q1 33 Primary Cesarean Delivery Rate, Uncomplicated. (2020)
```{r prcse2p}
prcse2p_list <- c(
"10A00ZZ",
"10A03ZZ",
"10A04ZZ"
) %>%
tibble::enframe(name = NULL) %>%
rename(prcse2p = value)
prcse2p_list %>%
write_rds("procedures-lists/ahrq_prcse2p.rds")
prcse2p_list %>% nrow()
```
### Previous Cesarean delivery diagnosis codes: (PRVBACD)
As defined in 1Q1 33 Primary Cesarean Delivery Rate, Uncomplicated (2020). Also used for IQI 22 Vaginal Birth After Cesarean (VBAC) Delivery Rate, Uncomplicated (2020).
- with any-listed ICD-10-CM diagnosis codes for previous Cesarean delivery (PRVBACD*)
```{r prvbacd}
prvbacd_list <- c(
"O3421",
"O34211",
"O34212",
"O34219",
"O6641"
) %>%
tibble::enframe(name = NULL) %>%
rename(prvbacd = value)
prvbacd_list %>%
write_rds("procedures-lists/ahrq_prvbacd.rds")
prvbacd_list %>% nrow()
```
### Vaginal delivery procedure codes: (VAGDELP)
From IQI 22 Vaginal Birth After Cesarean (VBAC) Delivery Rate, Uncomplicated (2020).
```{r vagdelp}
vagdelp_list <- c(
"10D07Z3",
"10D07Z4",
"10D07Z5",
"10D07Z6",
"10D07Z7",
"10D07Z8",
"10E0XZZ"
) %>%
tibble::enframe(name = NULL) %>%
rename(vagdelp = value)
vagdelp_list %>%
write_rds("procedures-lists/ahrq_vagdelp.rds")
vagdelp_list %>% nrow()
```
## Leapfrog Episiotomy lists
These definitions come from [Leapfrog Hospital survey measure specifications](https://www.leapfroggroup.org/sites/default/files/Files/2020HospitalSurvey_20200413_8.1%20%28version%201%29.pdf). There is also a copy in the `resources` directory of this repo.
### Vaginal MS_DRG codes
```{r vag_msdrg}
vag_msdrg_list <- c(
"768",
"796",
"797",
"798",
"805",
"806",
"807"
) %>%
tibble::enframe(name = NULL) %>%
rename(vag_msdrg = value)
vag_msdrg_list %>%
write_rds("procedures-lists/lf_vag_msdrg.rds")
vag_msdrg_list %>% nrow()
```
### Vaginal APR_DRG codes
```{r vag_aprdrg}
vag_aprdrg_list <- c(
"541",
"542",
"560"
) %>%
tibble::enframe(name = NULL) %>%
rename(vag_aprdrg = value)
vag_aprdrg_list %>%
write_rds("procedures-lists/lf_vag_aprdrg.rds")
vag_aprdrg_list %>% nrow()
```
### Vaginal birth exclusions
Obstructed labor due to shoulder dystocia.
```{r vag_excl}
vag_excl_list <- c(
"O660"
) %>%
tibble::enframe(name = NULL) %>%
rename(vag_excl = value)
vag_excl_list %>%
write_rds("procedures-lists/lf_vag_excl.rds")
vag_excl_list %>% nrow()
```
### Episiotomy
```{r epi}
epi_list <- c(
"0W8NXZZ"
) %>%
tibble::enframe(name = NULL) %>%
rename(epi = value)
epi_list %>%
write_rds("procedures-lists/lf_epi.rds")
epi_list %>% nrow()
```
## Other lists used
### Child-bearing age codes
Researchers at the Office of Health Affairs-Population Health, The University of Texas System work with the THCIC file daily and they suggest filtering deliveries to women of normal child-bearing age, 15-49.
The codes for the ages 15-49 include 05-12. For HIV or drug patients it includes 23 (18-44 yrs).
```{r age}
age_list <- c(
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
"23"
) %>%
tibble::enframe(name = NULL) %>%
rename(age = value)
age_list %>%
write_rds("procedures-lists/utoha_age.rds")
age_list %>% nrow()
```
## Closing out
```{r end}
beepr::beep(4)
```