-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPRG000_loading&translating_jipad.R
240 lines (218 loc) · 8.91 KB
/
PRG000_loading&translating_jipad.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
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
# Load required libraries
library(readr)
library(dplyr)
# Load JIPAD
jipad2015_2022 <- read_csv("rawdata/jipad2015_2022.csv",
show_col_types = FALSE,
guess_max = 100000000)
print(jipad2015_2022['入院日'],n=1000)
# Replace column names
jipad_df <- jipad2015_2022 %>%
rename(
facility_number = "施設番号",
facility_unique_id = "施設固有ID",
year = "年度",
age = "年齢",
sex = "性別",
admission_date = "入院日",
discharge_date = "退院日",
hospital_outcome = "退院時転帰",
weight = "体重",
height = "身長",
icu_admission_day = "入室日",
icu_admission_time = "入室日時",
icu_admission_type = "入室形式",
icu_admission_source = "入室経路",
icu_admission_category = "入室区分",
emergency_call = "緊急コール",
post_resuscitation = "心停止蘇生後",
readmission = "再入室",
disease_name_text = "病名テキスト",
surgery_name_text = "手術名テキスト",
main_diagnosis_code = "主病名コード",
sub_diagnosis_code_1 = "副病名コード1",
sub_diagnosis_code_2 = "副病名コード2",
sub_diagnosis_code_3 = "副病名コード3",
sub_diagnosis_code_4 = "副病名コード4",
sub_diagnosis_code_5 = "副病名コード5",
icu_discharge_day = "退室日",
icu_discharge_time = "退室日時",
icu_discharge_outcome = "退室時転帰",
a_line = "動脈圧ライン",
cv_line = "中心静脈ライン",
ventilation_start_day1 = "人工呼吸開始1日",
ventilation_start_time1 = "人工呼吸開始1時刻",
ventilation_end_day1 = "人工呼吸終了1日",
ventilation_end_time1 = "人工呼吸終了1時刻",
ventilation_start_day2 = "人工呼吸開始2日",
ventilation_start_time2 = "人工呼吸開始2時刻",
ventilation_end_day2 = "人工呼吸終了2日",
ventilation_end_time2 = "人工呼吸終了2時刻",
ventilation_start_day3 = "人工呼吸開始3日",
ventilation_start_time3 = "人工呼吸開始3時刻",
ventilation_end_day3 = "人工呼吸終了3日",
ventilation_end_time3 = "人工呼吸終了3時刻",
ventilation_start_day4 = "人工呼吸開始4日",
ventilation_start_time4 = "人工呼吸開始4時刻",
ventilation_end_day4 = "人工呼吸終了4日",
ventilation_end_time4 = "人工呼吸終了4時刻",
ventilation_start_day5 = "人工呼吸開始5日",
ventilation_start_time5 = "人工呼吸開始5時刻",
ventilation_end_day5 = "人工呼吸終了5日",
ventilation_end_time5 = "人工呼吸終了5時刻",
nppv = "NPPV",
tracheostomy = "気管切開",
tracheostomy_date = "気管切開施行日",
iabp = "IABP",
pcps = "PCPS",
vv_ecmo = "VV_ECMO",
intermittent_renal_therapy = "間欠腎代替療法",
continuous_renal_therapy = "持続腎代替療法",
plasmapheresis = "血漿交換",
pmx = "PMX",
other_transfusions = "その他の血液浄化",
aids = "AIDS",
heart_failure = "心不全",
respiratory_failure = "呼吸不全",
hepatic_failure = "肝不全",
cirrhosis = "肝硬変",
aml_mm = "AML_MM",
lymphoma = "リンパ腫",
solid_tumor_with_metastasis = "癌転移",
immunosuppression = "免疫抑制",
continuous_dialysis = "維持透析",
systolic_bp_under16 = "収縮期血圧",
pupil_dilation_under16 = "瞳孔散大",
fio2_under16 = "FiO2_小児",
pao2_under16 = "PaO2_小児",
be_under16 = "BE",
vent_under16 = "人工呼吸_小児",
postoperative_recovery_under16 = "術後の回復目的",
post_pcps_under16 = "人工心肺使用後",
high_risk_diagnosis = "高リスク診断名",
low_risk_diagnosis = "低リスク診断名" ,
heartrate_max = "脈拍ー最高",
heartrate_min = "脈拍ー最低",
sysbp_max = "収縮期血圧ー最高",
sysbp_min = "収縮期血圧ー最低",
mbp_max = "平均血圧ー最高",
mbp_min = "平均血圧ー最低",
diasbp_max = "拡張期血圧ー最高",
diasbp_min = "拡張期血圧ー最低",
temp_max = "体温ー最高",
temp_min = "体温ー最低",
resprate_max = "呼吸数ー最高",
resprate_min = "呼吸数ー最低",
gcs_eyes = "GCS_E",
gcs_verbal = "GCS_V",
gcs_motor = "GCS_M",
hematocrit_max = "ヘマトクリットー最高",
hematocrit_min = "ヘマトクリットー最低",
wbc_max = "白血球数ー最高",
wbc_min = "白血球数ー最低",
creatinine_max = "クレアチニンー最高",
creatinine_min = "クレアチニンー最低",
bun_max = "BUNー最高",
urine_output = "入室後24時間の尿量",
sodium_max = "Naー最高",
sodium_min = "Naー最低",
potassium_max = "Kー最高",
potassium_min = "Kー最低",
albumin_max = "アルブミンー最高",
albumin_min = "アルブミンー最低",
bilirubin_max = "ビリルビンー最高",
glucose_max = "血糖ー最高",
glucose_min = "血糖ー最低",
plt_min = "血小板ー最低",
lactate_max = "乳酸値",
aki_24hrs = "入室後24時間以内のAKI",
vent_24hrs = "入室後24時間以内の人工呼吸",
pac_24hrs = "入室後24時間以内のPAC",
cabg_reoperation = "CABG再手術",
number_of_grafts = "グラフト本数",
fio2_1 = "FiO2_1",
pao2_1 = "PaO2_1",
paco2_1 = "PaCO2_1",
ph_1 = "pH_1",
fio2_2 = "FiO2_2",
pao2_2 = "PaO2_2",
paco2_2 = "PaCO2_2",
ph_2 = "pH_2",
fio2_3 = "FiO2_3",
pao2_3 = "PaO2_3",
paco2_3 = "PaCO2_3",
ph_3 = "pH_3",
fio2_4 = "FiO2_4",
pao2_4 = "PaO2_4",
paco2_4 = "PaCO2_4",
ph_4 = "pH_4",
fio2_5 = "FiO2_5",
pao2_5 = "PaO2_5",
paco2_5 = "PaCO2_5",
ph_5 = "pH_5",
fio2_6 = "FiO2_6",
pao2_6 = "PaO2_6",
paco2_6 = "PaCO2_6",
ph_6 = "pH_6",
apache2_score = "APACHEIIスコア",
apache3_score = "APACHEIIIスコア",
saps2_score = "SAPSIIスコア",
tracheostomy_icu_admit = "入室時気管切開",
hfnc = "HFNC",
dobutamine = "DOB",
dopamine = "DOA",
noradrenaline = "NOR",
adrenaline = "ADR",
pf_ratio_under16 = "PF比",
sofa_score = "SOFAスコア",
psofa_score = "pSOFAスコア",
apache2_mortality = "APACHEII院内予測死亡率",
apache3_mortality = "APACHEIII院内予測死亡率",
saps2_mortality = "SAPSII院内予測死亡率",
pim2_score = "PIM2スコア",
pim2_mortality = "PIM2院内予測死亡率",
pim3_score = "PIM3スコア",
pim3_mortality = "PIM3院内予測死亡率",
super_high_risk_diagnosis = "超高リスク診断名",
post_cardiacsurgery_pci = "心臓手術もしくは心カテ術後",
pediatric_main_diagnosis_code = "小児主病名コード",
pediatric_sub_diagnosis_code_1 = "小児副病名コード1",
pediatric_sub_diagnosis_code_2 = "小児副病名コード2",
pediatric_sub_diagnosis_code_3 = "小児副病名コード3",
pediatric_sub_diagnosis_code_4 = "小児副病名コード4",
pediatric_sub_diagnosis_code_5 = "小児副病名コード5",
pediatric_age = "年齢詳細_小児",
jrod_mortality = "JROD予測死亡率",
admission_hash = "入院hash",
patient_hash = "患者hash",
)
# translate categories
jipad_df$sex <- recode(jipad_df$sex ,
"男性" = "male", "女性" = "female")
jipad_df$hospital_outcome <- recode(jipad_df$hospital_outcome ,
"生存" = "alive", "転院" = "transfer", "死亡" = "death")
jipad_df$icu_admission_type <- recode(jipad_df$icu_admission_type ,
"予定" = "Elective",
"緊急" = "Emergency",
"ICUでの手技" = "Procedures at ICU")
jipad_df$icu_admission_source <- recode(jipad_df$icu_admission_source ,
"手術室" = "Operating Room",
"救急外来" = "Emergency Room",
"病棟" = "Ward",
"転院直入" = "Direct Transfer",
"他のICU" = "Other ICU",
)
jipad_df$icu_admission_category <- recode(jipad_df$icu_admission_category ,
"予定手術" = "Elective_Surgery",
"非手術" = "Non_Surgical",
"緊急手術" = "Emergency_Surgery",
)
jipad_df$icu_discharge_outcome <- recode(jipad_df$icu_discharge_outcome ,
"病棟" = "Ward",
"死亡" = "Death",
"転院" = "Transfer",
"退院" = "Discharge",
"他のICU" = "Other ICU",
)
# save as RData
save(jipad_df, file = "processeddata/main/jipad_df.RData")