How stefan-gustafsson-work/omi works
This repository implements an OMI ECG prediction research workflow: prepare cohort labels and ECG inputs, train/validate a ResNet model, evaluate external and held-out sets, then generate results tables and figures. The README documents SwED/PTB-XL preparation, Brazil prediction evaluation and reporting capabilities; these script-level branches are shown at directory or exact script paths where available. Source excerpts establish Python data conversion and model interactions; unsampled R and shell implementations are not inferred beyond the documented workflow.
Main entry points: main.py Training orchestration · model.py ECG model · generate_hdf5.py ECG HDF5 builder · 02.02-build-omi-hdf5.sh SwED HDF5 prep
Components 23
Study preparation
- Study population
02.01-define-study-pop.R - ECG normalization
ecg_processing.py - ECG HDF5 builder
generate_hdf5.py - SwED HDF5 prep
02.02-build-omi-hdf5.sh
Modeling
- Training orchestration
model/main.py - OMI dataset loader
model/dataloader.py - ECG model
model/model.py - Residual network
model/resnet.py - Age-sex encoding
model/age_sex_encoding.py - Prediction stage
model/prediction_stage.py - Train and validate
03.01-train.sh - Hyperparameter search
03.02-hp-search-validation.sh - Seed sensitivity
03.04-train-with-different-seeds.sh
Evaluation
- Discrimination metrics
model/metrics.py - SwED test evaluation
04.01-test-model-swed.sh - Additional variables
04.02-add-additional-variables.R - Brazil prediction
01.01-predict-from-brazil-model.sh - Brazil evaluation
01.02-eval-prediction-results-brazil-model.R - Test evaluation
04.03-eval-test-swed.R
Reporting
- Results tables
05.01-numbers-and-tables.R - Additional figures
05.02-additional-figures.R - Coronary heatmap
05.03-coronary-heatmap.R
Other components
- Researcher
Connections 24
- Researcher → Study population: defines cohort
README.md - Researcher → SwED HDF5 prep: prepares ECGs
README.md - SwED HDF5 prep → ECG HDF5 builder: builds HDF5
- ECG HDF5 builder → ECG normalization: normalizes traces
generate_hdf5.py - Researcher → Train and validate: starts training
README.md - Train and validate → Training orchestration: invokes model
- Training orchestration → OMI dataset loader: loads batches
model/main.py - Training orchestration → ECG model: trains and tests
model/main.py - Training orchestration → Discrimination metrics: computes metrics
model/main.py - ECG model → Residual network: encodes ECG
model/model.py - ECG model → Age-sex encoding: encodes demographics
model/model.py - ECG model → Prediction stage: produces logits
model/model.py - Researcher → Hyperparameter search: tunes model
README.md - Researcher → Seed sensitivity: repeats training
README.md - Researcher → SwED test evaluation: tests model
README.md - SwED test evaluation → Training orchestration: runs evaluation
- Researcher → Brazil prediction: predicts externally
README.md - Brazil prediction → Brazil evaluation: evaluates predictions
README.md - Researcher → Additional variables: adds covariates
README.md - Researcher → Test evaluation: evaluates test set
README.md - Test evaluation → Results tables: summarizes results
- Researcher → Results tables: creates tables
README.md - Researcher → Additional figures: creates figures
README.md - Researcher → Coronary heatmap: maps coronary sites
README.md