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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
---
dataset_info:
- config_name: cohort_full
  features:
  - name: subject_id
    dtype: int64
  - name: ed_stay_id
    dtype: int64
  - name: hadm_id
    dtype: int64
  - name: ed_intime
    dtype: timestamp[us]
  - name: ed_outtime
    dtype: timestamp[us]
  - name: disposition
    dtype: large_string
  - name: race
    dtype: large_string
  - name: arrival_transport
    dtype: large_string
  - name: first_careunit
    dtype: large_string
  - name: first_icu_intime
    dtype: timestamp[us]
  - name: cohort_label
    dtype: large_string
  - name: gender
    dtype: large_string
  - name: anchor_age
    dtype: int64
  - name: anchor_year
    dtype: int64
  - name: admittime
    dtype: timestamp[us]
  - name: dischtime
    dtype: timestamp[us]
  - name: admission_type
    dtype: large_string
  - name: discharge_location
    dtype: large_string
  - name: insurance
    dtype: large_string
  - name: language
    dtype: large_string
  - name: marital_status
    dtype: large_string
  - name: ed_stay_id_2
    dtype: float64
  - name: stay_window_start
    dtype: timestamp[us]
  - name: stay_window_end
    dtype: timestamp[us]
  - name: ed_boarding_time_min
    dtype: float64
  - name: time_steps
    dtype: int64
  splits:
  - name: cohort_base
    num_bytes: 108446901
    num_examples: 397670
  download_size: 25727336
  dataset_size: 108446901
- config_name: dispensed_meds
  features:
  - name: ed_stay_id
    dtype: int64
  - name: subject_id
    dtype: int64
  - name: hadm_id
    dtype: int64
  - name: charttime
    dtype: timestamp[us]
  - name: medication
    dtype: large_string
  - name: event_txt
    dtype: large_string
  - name: in_er
    dtype: bool
  - name: drug_class
    dtype: large_string
  - name: action_idx
    dtype: int64
  - name: minutes_into_stay
    dtype: float64
  - name: time_step
    dtype: int64
  splits:
  - name: er_and_ward
    num_bytes: 311238084
    num_examples: 2675531
  download_size: 33872234
  dataset_size: 311238084
- config_name: ecg_results
  features:
  - name: ed_stay_id
    dtype: int64
  - name: subject_id
    dtype: int64
  - name: hadm_id
    dtype: int64
  - name: ecg_time
    dtype: timestamp[us]
  - name: ecg_acuity
    dtype: int64
  splits:
  - name: full_ecg
    num_bytes: 6226839
    num_examples: 155186
  download_size: 4053167
  dataset_size: 6226839
- config_name: empty_patient_state
  features:
  - name: ed_stay_id
    dtype: int64
  - name: subject_id
    dtype: int64
  - name: hadm_id
    dtype: float64
  - name: time_steps
    dtype: int64
  splits:
  - name: empty_patient_state
    num_bytes: 1454310797
    num_examples: 45270375
  download_size: 10265748
  dataset_size: 1454310797
- config_name: height
  features:
  - name: subject_id
    dtype: int64
  - name: chartdate
    dtype: date32
  - name: result_name
    dtype: large_string
  - name: result_value
    dtype: float64
  splits:
  - name: height_full
    num_bytes: 22419409
    num_examples: 656979
  download_size: 3891379
  dataset_size: 22419409
- config_name: lab_results
  features:
  - name: ed_stay_id
    dtype: int64
  - name: category
    dtype: large_string
  - name: fluid
    dtype: large_string
  - name: order_time
    dtype: timestamp[us]
  - name: subject_id
    dtype: int64
  - name: hadm_id
    dtype: int64
  - name: result_time
    dtype: timestamp[us]
  - name: ordered_location
    dtype: large_string
  - name: abnormal
    dtype: bool
  - name: action
    dtype: large_string
  splits:
  - name: labs_full
    num_bytes: 269113124
    num_examples: 2542661
  download_size: 43257327
  dataset_size: 269113124
- config_name: medrecon
  features:
  - name: ed_stay_id
    dtype: int64
  - name: subject_id
    dtype: int64
  - name: recon_ace_inhibitor
    dtype: uint8
  - name: recon_analgesic___nsaid
    dtype: uint8
  - name: recon_analgesic___opioid_nsaid
    dtype: uint8
  - name: recon_antiarrhythmic
    dtype: uint8
  - name: recon_antibiotic
    dtype: uint8
  - name: recon_anticoagulant
    dtype: uint8
  - name: recon_anticonvulsant
    dtype: uint8
  - name: recon_antiemetic
    dtype: uint8
  - name: recon_antiplatelet
    dtype: uint8
  - name: recon_antipsychotic
    dtype: uint8
  - name: recon_benzodiazepine___sedative_anxiolytic
    dtype: uint8
  - name: recon_beta_blocker
    dtype: uint8
  - name: recon_bronchodilator
    dtype: uint8
  - name: recon_calcium_channel_blocker
    dtype: uint8
  - name: recon_corticosteroid
    dtype: uint8
  - name: recon_diuretic
    dtype: uint8
  - name: recon_gi___acid_suppression
    dtype: uint8
  - name: recon_insulin_glucose
    dtype: uint8
  - name: recon_nitrate
    dtype: uint8
  - name: recon_n_total_meds
    dtype: int64
  - name: recon_n_drug_classes
    dtype: int64
  splits:
  - name: medrecon_full
    num_bytes: 15100539
    num_examples: 296089
  download_size: 4092329
  dataset_size: 15100539
- config_name: microbiology
  features:
  - name: subject_id
    dtype: int64
  - name: ed_stay_id
    dtype: int64
  - name: hadm_id
    dtype: int64
  - name: charttime
    dtype: timestamp[us]
  - name: storetime
    dtype: timestamp[us]
  - name: action_space
    dtype: large_string
  - name: culture_result
    dtype: large_string
  splits:
  - name: microbiology_full
    num_bytes: 13591066
    num_examples: 185552
  download_size: 5278498
  dataset_size: 13591066
- config_name: rad_results
  features:
  - name: ed_stay_id
    dtype: int64
  - name: subject_id
    dtype: int64
  - name: hadm_id
    dtype: int64
  - name: exam_time
    dtype: timestamp[us]
  - name: rad_acuity_level
    dtype: int64
  splits:
  - name: rad_full
    num_bytes: 10801289
    num_examples: 269191
  download_size: 6246623
  dataset_size: 10801289
- config_name: triage_vitals
  features:
  - name: charttime
    dtype: timestamp[us]
  - name: ed_stay_id
    dtype: int64
  - name: subject_id
    dtype: int64
  - name: current_temperature
    dtype: float64
  - name: current_heartrate
    dtype: float64
  - name: current_resprate
    dtype: float64
  - name: current_o2sat
    dtype: float64
  - name: current_sbp
    dtype: float64
  - name: current_dbp
    dtype: float64
  - name: current_pain
    dtype: float64
  - name: acuity
    dtype: float64
  - name: chiefcomplaint
    dtype: large_string
  - name: source
    dtype: large_string
  - name: time_since_last_min
    dtype: float64
  - name: pain_missing
    dtype: int64
  - name: heartrate_missing
    dtype: int64
  - name: o2sat_missing
    dtype: int64
  - name: acuity_missing
    dtype: int64
  - name: chiefcomplaint_missing
    dtype: int64
  - name: resprate_missing
    dtype: int64
  - name: sbp_missing
    dtype: int64
  - name: dbp_missing
    dtype: int64
  - name: temperature_missing
    dtype: int64
  - name: temperature_delta
    dtype: float64
  - name: heartrate_delta
    dtype: float64
  - name: resprate_delta
    dtype: float64
  - name: o2sat_delta
    dtype: float64
  - name: sbp_delta
    dtype: float64
  - name: dbp_delta
    dtype: float64
  - name: pain_delta
    dtype: float64
  - name: temperature_rate_per_min
    dtype: float64
  - name: heartrate_rate_per_min
    dtype: float64
  - name: resprate_rate_per_min
    dtype: float64
  - name: o2sat_rate_per_min
    dtype: float64
  - name: sbp_rate_per_min
    dtype: float64
  - name: dbp_rate_per_min
    dtype: float64
  - name: current_mean_arterial_pressure
    dtype: float64
  - name: temperature_rolling1h
    dtype: float64
  - name: heartrate_rolling1h
    dtype: float64
  - name: resprate_rolling1h
    dtype: float64
  - name: o2sat_rolling1h
    dtype: float64
  - name: sbp_rolling1h
    dtype: float64
  - name: dbp_rolling1h
    dtype: float64
  splits:
  - name: triage_vitals_full
    num_bytes: 661714092
    num_examples: 1811202
  download_size: 88016187
  dataset_size: 661714092
- config_name: weight
  features:
  - name: subject_id
    dtype: int64
  - name: chartdate
    dtype: date32
  - name: result_name
    dtype: large_string
  - name: result_value
    dtype: float64
  splits:
  - name: weight_full
    num_bytes: 56211758
    num_examples: 1647231
  download_size: 9166863
  dataset_size: 56211758
configs:
- config_name: cohort_full
  data_files:
  - split: cohort_base
    path: cohort/cohort_base-*
- config_name: dispensed_meds
  data_files:
  - split: er_and_ward
    path: dispensed_meds/er_and_ward-*
- config_name: ecg_results
  data_files:
  - split: full_ecg
    path: ecg/full_ecg-*
- config_name: empty_patient_state
  data_files:
  - split: empty_patient_state
    path: patient_state/empty_patient_state-*
- config_name: height
  data_files:
  - split: height_full
    path: height_data/height_full-*
- config_name: lab_results
  data_files:
  - split: labs_full
    path: labs/labs_full-*
- config_name: medrecon
  data_files:
  - split: medrecon_full
    path: medrecon_data/medrecon_full-*
- config_name: microbiology
  data_files:
  - split: microbiology_full
    path: microbiology_data/microbiology_full-*
- config_name: rad_results
  data_files:
  - split: rad_full
    path: rad_data/rad_full-*
- config_name: triage_vitals
  data_files:
  - split: triage_vitals_full
    path: triage_vitals_data/triage_vitals_full-*
- config_name: weight
  data_files:
  - split: weight_full
    path: weight_data/weight_full-*
---

# Cohort Data

Processed ED patient cohort derived from MIMIC-IV. One row per ED visit (`ed_stay_id`). Built from cohort_base (BigQuery) with the following post-processing steps: 

- AGAINST ADVICE discharge_location records removed — patient-driven departures are out of scope. 
- Consecutive ED visits sharing a hadm_id collapsed into single rows; second ed_stay_id stored in `ed_stay_id_2`. 
- `stay_window_start`/`stay_window_end` columns added covering ED arrival to final discharge. 
- `ed_boarding_time_min` added: minutes in ED after admission decision (null for ED-only patients).

Intended as the primary cohort table for feature engineering and RL state construction.  

# Dispensed Meds

Dispensed medication records for all cohort patients across two phases and two populations. 

ED phase (`in_er`=True): Pyxis dispenses for all patients (admitted and ED-only) while physically in the ED, derived from `ed.pyxis`.  
Ward phase (`in_er`=False): eMAR administration records for admitted patients from ED departure up to ICU transfer, derived from `hosp.emar`. 

`event_txt` filtered to administration and rate-change events only. 

Medication names mapped to a 22-class drug vocabulary via regex. Each record includes `minutes_into_stay` (time since ED arrival) and time_step bucket (floor(minutes / time_block)).

# ECG Data

ECG acuity labels derived from `mimiciv_ecg.machine_measurements` for cohort patients. Each of the 18 report columns is classified independently 
via regex with priority order: abnormal (2) > neutral (1) > normal (0) > empty (-1). 

Row-level max across all 18 columns gives `ecg_acuity`: 0=normal, 1=neutral/unknown, 2=abnormal. 

Patients with all 18 columns empty are assigned 1 (missing ECG ≠ normal ECG). 

Multiple ECGs per ED stay resolved to one row: highest acuity kept, ties broken by earliest ecg_time. 

Window covers ED arrival through hospital ward stay (capped at ICU transfer if applicable), with ±1 hour buffer for ECG machine clock drift.

# Labs Data

Laboratory results from `hosp.labevents` for cohort patients during their stay window. 

Grouped by category x fluid (19 unique combinations) rather than individual test label to reduce action space. 

Each result includes the abnormal flag for worst-case aggregation. Intended as the primary lab state feature source.  

# Medrecon Data

Medication reconciliation records from `ed.medrecon` — medications the patient was taking prior to ED arrival. 
One row per medication per ED visit. Represents pre-arrival medication state, not actions taken during the visit.  

# Microbiology Data


Microbiology culture events from `hosp.microbiologyevents` for cohort patients during their stay window. 
Includes culture order time, specimen type, organism name, and antibiotic sensitivity results. 

`culture_ordered` is the real-time state signal; culture_positive is a retrospective label only (~2% of results available before ED discharge).

# OMR Data

Height and weight measurement records from `hosp.omr` for cohort patients — separated to take single measurements of height as an average of all available height measurements for a patient and retaining all separate weight measurements. 
Duplicates were dropped. Used to supplement ED and inpatient state features with recent baseline measurements.  

# Radiology Data

Radiology report text from `mimiciv_note.radiology` for cohort patients. Covers all imaging modalities (CXR, CT, MRI, ultrasound, etc.). 
Primary reports only (note_type=RR). Window covers ED arrival through hospital ward stay (capped at ICU transfer if applicable).  
`hadm_id` is NULL for ED-only patients and populated for admitted patients. `exam_name` and `cpt_code` included from radiology_detail to identify 
imaging modality.  

# Triage_Vitals

Combined triage and vital signs time series — one row per (`ed_stay_id`, `charttime`) timestep. 
Triage records (ed.triage) provide the baseline reading at `ed_intime`; subsequent vitals (`ed.vitalsign`) provide follow-up readings. 
`stay_id` remapping applied so that vitals from a patient's second consecutive ED visit are attributed to the canonical (first) stay_id. 
Rows recorded before `ed_intime` are dropped; records from vitals with `charttime` == `ed_intime` are dropped as duplicates of the triage records. 

**Preprocessing**: `pain` column normalized and coerced to numeric, physiologically implausible vital values nulled. Missing indicators created before forward-fill. 
Vitals forward-filled within stay, then mean-imputed for any remaining NaN. 

**Feature engineering**: `time_since_last_min`, per-column deltas and rates of change (units/min), 1-hour rolling averages, mean arterial pressure (dbp + (sbp - dbp) / 3). 
Triage rows get 0 for all delta/rate columns. Final vital columns renamed to current_{col}.