Original source-extraction scripts — archival disclosure, not an executable submission-folder workflow

Scope
This folder restores three original scripts omitted from the earlier aggregate/code package: extract.py, refresh_eicu_screen.py and their direct local dependency common.py. They are byte-identical copies of the retained working sources. The manifest records SHA256, direct imports and a syntax-only check. No script was imported or executed, no database was reread, and no clinical data or patient-level cache was copied during this revision.

What each script does
• common.py defines paths, compressed-table readers, hashing helpers, the final retrospective clinical-code/text mapping, and inherited pairing specifications.
• extract.py accepts mimic or eicu as its command-line argument, reads licensed source tables and creates adult-stay, diagnostic-evidence, laboratory, pulse-oximetry and provenance caches. The large laboratory/monitor tables are scanned in chunks; some smaller metadata/diagnosis tables are loaded fully.
• refresh_eicu_screen.py restores original ICD-code strings by reading eICU diagnosis.csv.gz, reapplies the conservative final diagnosis mapping to the retained evidence, and updates eicu/stays.csv.gz, diagnosis_screen_evidence.csv.gz and extraction_manifest.json. It must follow eICU extraction to recreate the final cached screen. Despite its short header, it is not entirely cache-only: the original diagnosis table is required.

Dependencies and configuration prerequisites
The only direct local module dependency is common.py in the same directory. The direct third-party dependency is pandas; the original retained environment used pandas3.0.1. Other imports are Python standard-library modules. The parent requirements.txt additionally records packages used by downstream pairing/modelling/figures; these extraction scripts alone do not need a trained model.

common.py has hard-coded original Windows locations:
M = D:\BaiduNetdiskDownload\ICU医疗数据集合集\mimic数据库\mimic-iv-3.1.zip
E = D:\BaiduNetdiskDownload\ICU医疗数据集合集\eicu数据库\EICU 2.0数据
MIMIC archive entries are found by suffix; eICU inputs are individual compressed CSV files in E. A replicator needs their own credentialed, appropriately licensed MIMIC-IV3.1/eICU2.0 access and an isolated working directory. Data are not distributed in this package. Versions, source layout, units and available fields must be checked locally. Original paths are disclosure of implementation, not a promise that the scripts run on another machine without configuration.

IMPORTANT: do not run these archival copies from inside the submission folder.
common.py derives B from its own file location and immediately creates an output directory on import. extract.py and refresh_eicu_screen.py write or overwrite caches in B/mimic or B/eicu. The original expected layout was <new_workspace>/work/oxygen_feasibility/{common.py,extract.py,refresh_eicu_screen.py}, with outputs under <new_workspace>/outputs. To review execution independently, copy the sources into that layout in a NEW workspace, configure M and E only in those working copies, and retain a diff/log of path-only changes. Do not point this workflow at the frozen analysis outputs. There is no dry-run switch or automatic resume guarantee.

Required source tables
MIMIC-IV3.1 ZIP:
  hosp/patients.csv.gz; icu/icustays.csv.gz; hosp/diagnoses_icd.csv.gz;
  hosp/d_icd_diagnoses.csv.gz; hosp/d_icd_procedures.csv.gz;
  hosp/procedures_icd.csv.gz; hosp/d_labitems.csv.gz;
  hosp/labevents.csv.gz; icu/chartevents.csv.gz.
eICU2.0 directory:
  patient.csv.gz; diagnosis.csv.gz; admissionDx.csv.gz; treatment.csv.gz;
  lab.csv.gz; customLab.csv.gz; vitalPeriodic.csv.gz.

Documented execution sequence for a separately authorized reproduction
1. Configure the new workspace, licensed input paths and Python environment; allocate disk/RAM/time for large compressed-table scans and derived caches.
2. In the reconstructed work/oxygen_feasibility directory: python extract.py mimic
3. In that directory: python extract.py eicu
4. After successful eICU extraction: python refresh_eicu_screen.py
5. Inspect the generated completion/provenance manifests and compare definitions, row counts and documented source signatures before downstream use. The instructions above were not executed during this revision.

Connection to the existing model code
The separate reproducibility_code.zip already contains work/oxygen_feasibility/common.py and pair.py, plus the frozen model feature transformations, fitting, evaluation and tests under work/oxygen_formal. This added common.py should match that archived version; do not silently replace one version with another. Pairing depends on the caches generated above, and formal preparation additionally reads MIMIC calendar-era metadata. Fitting/evaluation scripts have analysis-lock safeguards and are not a command to rerun the published study in place. Patient-level derived files and predictions are intentionally absent from the shareable package. Independent investigators must produce such data under their own authorized access.

Interpretation and limitations
This addition closes the identified omission of the initial extraction scripts and documents their direct dependencies. It does not demonstrate a fresh end-to-end rerun, guarantee machine-independent reproducibility, validate clinical eligibility or establish specimen provenance. Clinical-code review still requires a genuine clinical author. The original source files, frozen models, thresholds and numerical results were not changed.
