-
Notifications
You must be signed in to change notification settings - Fork 0
/
readME.Rmd
317 lines (297 loc) · 14.9 KB
/
readME.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
---
title: "PAPER TILE"
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(
echo = TRUE,
fig.align = "center",
fig.width = 12,
fig.height = 8
)
```
```{r, warning = F, message = F, include = F, echo = F}
myColour <- "#8a2587"
```
This is the landing page for the supplementary materials for the paper "X". Processing and Analysis are decribed in separate files found in the relevent folders in this repository.
```{r load libraries, warning = F, message = F, include = F}
# packages for analysis and processing
library(tidyverse)
library(tidybayes)
library(brms)
library(lubridate)
# packages for figures and tables in this document
library(reactable)
library(see)
library(ggridges)
library(icd)
```
```{r figure settings, echo = F}
# Sort out the theme
textSize <- 17:20
theme_set(theme_bw())
theme_update(
title = element_text(size = textSize[3]),
axis.text = element_text(size = textSize[2]),
axis.title = element_text(size = textSize[3]),
legend.text = element_text(size = textSize[1])
)
```
Here are all the ICD-10 codes for Serious Infection, Cardiovascular Disease, and Cancer that were screened for in the analysis regarding the rate of these events ocurring.
```{r sort ICD table, echo = F}
Codes_SI <- c("A01", "A011", "A02", "A020", "A021", "A022", "A028", "A029", "A03", "A033", "A039",
"A04", "A044", "A045", "A046", "A047", "A048", "A049",
"A15",
# "A150", "A152", "A153", # "A156", "A157", "A159",
# "A16", # this one is weird since it's just A15 but without confirmation
# "A162", "A164", "A165", "A169",
"A170", "A171", "A192", "A199",
"A270", "A279", "A321", "A327", "A329", "A379", "A390", "A394", "A398", "A400", "A401",
# "A402",
"A403", "A408", "A409",
"A41", "A410", # other sepsis
# "A4100", "A4101",
"A4102",
# "A4103", "A4109",
"A420", "A422", "A428", "A46", "A481", "A483", "A4901",
# "A4903", "A4909",
"A561", "A681", "A692", "A70",
"B59",
"G001", "G002",
# "G0039",
"G008", "G009", "G01", "G01", "G02", "G042", "G060", "G061", "G062",
"H600", "H601", "H602", "H603", "H660", "H664", "H669", "H700", "H709", "H730",
"I00", "I330", "I339",
"J010", "J011", "J012", "J018", "J019", "J020", "J029", "J030", "J039", "J051", "J069", "J13",
"J14", "J150", "J151", "J152", "J153", "J154", "J155", "J156", "J157", "J158", "J159",
"J168", "J180", "J181", "J182", "J188", "J189", "J208", "J209", "J22", "J36", "J390", "J391", "J440",
"J690", "J698", "J849", "J851", "J852", "J860", "J869", "J950", "J985", "J698", "J849",
"K223", "K353", "K358", "K37", "K570", "K571", "K572", "K574", "K610", "K611", "K612", "K613",
"K614", "K630", "K631", "K650", "K658", "K659", "K750", "K800", "K803", "K804", "K810",
"K811",
# "K818",
"K819", "K822", "K830", "K832",
"L010", "L011", "L020", "L021", "L022", "L023", "L024", "L028", "L029", "L030", "L031",
"L032", "L033", "L038", "L039", "L050", "L080",
"M000", "M0002", "M0008", "M0080",
# "M0090",
"M009", # This is a code that can be found like the above
# "M011",
"M01",
# "M4260,
"M4640", "M650", "M6510",
"M710", # same as above
# "M7260",
"M726", # same as above
"M860", "M861", "M8630", "M8640", "M8650", "M8660",
# "M8680", "M8690",
"M868", "M869", # same as above
"N10", "N110", "N111", "N118", "N119", "N12", "N136", "N151", "N159", "N300", "N308", "N309",
"N340", "N390", "N410", "N431",
# "N450", "N459",
"N45", # same as above
"N481", "N482", "N499", "N61", "N700", "N709", "N711", "N719",
"N730", "N731", "N739", "N751", "N760", "N761", "N763", "N764", "N768",
"O080", "O2330", "O231", "O233", "O234", "O235", "O239", "O411", "O85","O860", "O861",
"O862",
# "O863",
"O864", "O868", "O911",
"R572", # this is septic shock... probably quite important to include
"T814", "T845")
Codes_Cancer <- c("C00", "C000", "C001", "C002", "C003", "C004", "C005", "C006", "C008", "C009",
"C01", #"C01X",
"C02", "C020", "C021", "C023", "C024", "C028", "C029",
"C03", "C030", "C031", "C039",
"C04", "C040", "C041", "C048", "C049",
"C05", "C050", "C051", "C052", "C058", "C059",
"C06", "C060", "C061", "C062", "C068", "C069",
"C07", #"C07X",
"C08", "C080", "C081", "C088", "C089",
"C09", "C090", "C091", "C098", "C099",
"C10", "C100", "C101", "C102", "C103", "C104", "C108", "C109",
"C11", "C110", "C111", "C112", "C113", "C118", "C119",
"C12",# "C12X",
"C13", "C130", "C131", "C132", "C138", "C139",
"C14", "C140",
# "C141",
"C142", "C148",
"C15", "C150", "C151", "C152", "C153", "C154", "C155", "C158", "C159",
"C16", "C160", "C161", "C162", "C163", "C164", "C165", "C166", "C168", "C169",
"C17", "C170", "C171", "C172", "C173", "C178", "C179",
"C18", "C180",
# "C1801", "C1809",
"C181", "C1811", "C1819",
"C182",
# "C1821",
# "C1829",
"C183",
# "C1831", "C1839",
"C184", # "C1841", "C1849",
"C185", #"C1851",
"C1859", "C186",# "C1861", "C1869",
"C187", #"C1871", "C1879",
"C188",# "C1881","C1889",
"C189", #"C1891", "C1899",
"C19", #"C19X", "C19X1", "C19X9",
"C20", #"C20x", "C20x1", "C20x9",
"C21", "C210", "C211", "C212", "C218",
"C22", "C220", "C221", "C222", "C223", "C224", "C227", "C229",
"C23", #"C23X",
"C24", "C240", "C241", "C248", "C249",
"C25", "C250", "C251", "C252", "C253", "C254", "C257", "C258", "C259",
"C26", "C260", "C261", #"C268",
"C269",
"C30", "C300", "C301",
"C31", "C310", "C311", "C312", "C313", "C318", "C319",
"C32", "C320", "C321", "C322", "C323", "C328", "C329",
"C33", #"C33X",
"C34", "C340", "C341", "C342", "C343", "C348", "C349",
"C37", #"C37X",
"C38", "C380", "C381", "C382", "C383", "C384", "C388",
"C39", "C390", #"C398",
"C399",
"C40", "C400", "C401", "C402", "C403", "C408", "C409",
"C41", "C410", "C411", "C412", "C413", "C414", #"C418",
"C419",
"C43", "C430",# "C4301", "C4309",
"C431", "C4311", # "C4319",
"C432", "C4321", #"C4329",
"C433", "C4331", "C4339",
"C434", #"C4341", "C4349",
"C435", "C4351", "C4359",
"C436", "C4361", # "C4369",
"C437", "C4371", # "C4379",
"C438", "C4381", "C4389",
"C439", # "C4391", "C4399",
"C44", "C440", "C441", #"C424",
"C443", "C444", "C445", "C446", "C447", "C448", "C449",
"C45", "C450", "C451", "C452", "C457", "C459",
"C46", "C460", "C461", "C462", "C463", "C467", #"C468",
"C469",
"C47", "C470", "C471", "C472", "C473", "C474", "C475", "C476", "C478", "C479",
"C48", "C408", "C481", "C482", "C488",
"C49", "C490", "C491", "C492", "C493", "C494", "C495", "C496", "C498", "C499",
"C50", "C500", "C5001", # "C5009",
"C501", "C5011", # "C5019",
"C5021", #"C5029",
"C503", "C5031",# "C5039",
"C504", "C5041",# "C5049",
"C505", "C5051",# "C5059",
"C506", "C5061",# "C5069",
"C508", "C5081",# "C5089",
"C509", "C5091",# "C5099",
"C51", "C510", "C511", "C512", "C518", "C519",
"C52",# "C52X",
"C53", "C530", "C531", "C538", "C539",
"C54", "C540", "C541", "C542", "C543", "C548", "C549",
"C55",# "C55X",
"C56",# "C56X",
"C57", "C570", "C571", "C572", "C573", "C574", "C577", "C578", "C579",
"C58", #"C58X",
"C60", "C600", "C601", "C602", "C608", "C609",
"C61",# "C61X",
"C62", "C620", "C621", "C629",
"C63", "C630", "C631", "C632", "C637", "C638", "C639",
"C64",# "C64X",
"C65",# "C65X",
"C66",# "C66X",
"C67", "C670", "C671", "C672", "C673", "C674", "C675", "C676", "C677", "C678", "C679",
"C68", "C680", "C681", "C688", "C689",
"C69", "C690", "C691", "C692", "C693", "C694", "C695", "C696", "C698", "C699",
"C70", "C700", "C701", "C709",
"C71", "C710", "C711", "C712", "C713", "C714", "C715", "C716", "C717", "C718", "C719",
"C72", "C720", "C721", "C722", "C723", "C724", "C725", #"C728",
"C729",
"C73", #"C73X",
"C74", "C740", "C741", "C749",
"C75", "C750", "C751", "C752", "C753", "C754", "C755", "C758", "C759",
"C76", "C760", "C761", "C762", "C763", "C764", "C765", #"C767",
"C768",
"C77", "C770", "C771", "C772", "C773", "C774", "C775", "C778", "C779",
"C78", "C780", "C781", "C782", "C783", "C784", "C785", "C786", "C787", "C788",
"C79", "C790", "C791", "C792", "C793", "C794", "C795", "C796", "C797", "C798", "C799",
"C80", #"C809", "C809", "C80X",
"C81", "C810", "C811", "C812", "C813", "C814", "C817", "C819",
"C82", "C820", "C821", "C822", "C823", "C824", "C825", "C862",# "C827",
"C829",
"C83", "C830", "C831",# "C832",
"C833", "C834", "C835", "C836", "C837", "C838", "C839",
"C84", "C840", "C841", #"C842", "C843",
"C844", #"C845",
"C846", "C847", #"C848",
"C849",
"C85", #"C850",
"C851", "C852", #"C857",
"C859",
"C86", "C860", "C861", "C862", "C863", "C864", "C865", "C866",
"C88", "C880", #"C881",
"C882", "C883", "C884", #"C887",
"C889",
"C90", "C900", "C901", "C902", "C903",
"C91", "C910", "C911", #"C912",
"C913", "C914", "C915", "C916", #"C917", "C918",
"C919",
"C92", "C920", "C921", "C922", "C923", "C924", "C925", "C926", #"C927", "C928",
"C929",
"C93", "C930", "C931", #"C932",
"C933", #"C937",
"C939",
"C94", "C940", #"C941",
"C942", "C943", "C944", #"C945",
"C946", #"C947",
"C95", "C950", "C951", #"C952", "C957",
"C959",
"C96", "C960", #"C961",
"C962",# "C963",
"C964", "C965", "C966", #"C967", "C968",
"C969",
"C97", "C97X")
Codes_CVD <- c("I21", "I22", "I252", "I099", "I110", "I130",
# "I1320",
"I132", # same as above
"I255", "I420", "I425",
"I426", "I427", "I428", "I429", "I43", "I50", "P290", "I70", "I71", "I731", "I738",
"I739", "I771", "I790",
# "I792",
"I79", # same as above
"K551", "K558", "K559", "Z958", "Z959", "G45", "G46",
"H340", "H341", "I60", "I61", "I62", "I63",
# "I64",
"I65", "I66", "I67", "I68")
thisTable <- tibble(`Outcome Group` = rep(c("Serious Infection",
"Cancer",
"Cardiovascular Disease"),
c(length(Codes_SI),
length(Codes_Cancer),
length(Codes_CVD))),
`ICD-10 Code` = c(Codes_SI,
Codes_Cancer,
Codes_CVD))
# map_chr(c(thisTable$`ICD-10 Code`), ~{
# toReturn <- explain_code(.x, condense = F)
# if(length(toReturn) == 0){
# return(NA_character_)
# } else {
# return(toReturn)
# }
# })
# thisTable$Description <- explain_code(thisTable$`ICD-10 Code`, condense = F)
thisTable$Description <- sapply(1:nrow(thisTable), function(i){
explain_code(thisTable$`ICD-10 Code`[i], condense = F)
})
thisTable$Description <- ifelse(thisTable$`ICD-10 Code` == "R572", "Septic Shock", thisTable$Description)
thisTable$Description <- ifelse(thisTable$`ICD-10 Code` == "C088", "Overlapping lesion of major salivary glands", thisTable$Description)
thisTable$Description <- ifelse(thisTable$`ICD-10 Code` == "C150", "Cervical part of oesophagus", thisTable$Description)
thisTable$Description <- ifelse(thisTable$`ICD-10 Code` == "C151", "Thoracic part of oesophagus", thisTable$Description)
thisTable$Description <- ifelse(thisTable$`ICD-10 Code` == "C152", "Abdominal part of oesophagus", thisTable$Description)
thisTable$Description <- ifelse(thisTable$`ICD-10 Code` == "C1801", "Abdominal part of oesophagus", thisTable$Description)
thisTable$Description <- ifelse(thisTable$`ICD-10 Code` == "C1809", "Abdominal part of oesophagus", thisTable$Description)
thisTable$Description <- ifelse(thisTable$`ICD-10 Code` == "C1811", "Abdominal part of oesophagus", thisTable$Description)
thisTable$Description <- ifelse(thisTable$`ICD-10 Code` == "C1819", "Abdominal part of oesophagus", thisTable$Description)
kableExtra::kable(thisTable)
```
```{r, include=FALSE}
# add this chunk to end of mycode.rmd
# file.rename(from="scripts/mycode.md",
# to="README.md")
```