# ayush3008anand/fyp architecture

> Architecture diagram of the GitHub repository ayush3008anand/fyp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ayush3008anand/fyp
- Repository: https://github.com/ayush3008anand/fyp

## Overview

This repository is a file-based MIMIC-IV cardiac cohort and vital-sign dataset preparation workflow. Its scripts identify cardiac admissions, extract troponin results, prepare a clinical adjudication sheet, and extract admission-labelled vitals for a selected 90-patient cohort. Scripts are run independently and exchange CSV files; no central runner is shown. The two vital-sign scripts implement the same extraction behavior. Relationships below follow the excerpts and source index; the origin of the selected cohort and any manual adjudication decisions are not shown.

Main entry points: [`scripts/02_extract_troponin.py`](https://github.com/ayush3008anand/fyp/blob/main/scripts/02_extract_troponin.py) (Extract troponin), [`scripts/03_prepare_adjudication.py`](https://github.com/ayush3008anand/fyp/blob/main/scripts/03_prepare_adjudication.py) (Prepare adjudication review), [`scripts/01_find_cardiac_admissions.py`](https://github.com/ayush3008anand/fyp/blob/main/scripts/01_find_cardiac_admissions.py) (Find cardiac admissions), [`scripts/04_select_cohort.py`](https://github.com/ayush3008anand/fyp/blob/main/scripts/04_select_cohort.py) (Select cohort and extract vitals)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cohort["Cohort discovery"]
  node_find["Find cardiac admissions"]
  node_diagnoses["Cardiac diagnosis candidates"]
  node_admissions["Cardiac admissions"]
end

subgraph group_review["Clinical review"]
  node_troponin["Extract troponin"]
  node_testlist["Available troponin tests"]
  node_troponindata["Patient troponin results"]
  node_prepare["Prepare adjudication review"]
  node_reviewfile["Adjudication review sheet"]
end

subgraph group_vitals["Vital extraction"]
  node_selection["Selected 90 patients"]
  node_select["Select cohort and extract vitals"]
  node_extract["Extract labelled chartevents"]
  node_labelled["Labelled patient vitals"]
end

subgraph group_settings["Runtime settings"]
  node_config["Path and ID settings<br/>[config.py]"]
end

node_operator(("Analyst"))
node_mimic[("MIMIC-IV tables")]

node_operator -.->|"runs"| node_find
node_operator -.->|"runs"| node_troponin
node_operator -.->|"runs"| node_prepare
node_operator -.->|"runs"| node_select
node_operator -.->|"runs"| node_extract
node_mimic -->|"provides tables"| node_find
node_find -->|"imports settings"| node_config
node_find -->|"writes"| node_diagnoses
node_find -->|"writes"| node_admissions
node_mimic -->|"provides tables"| node_troponin
node_admissions -->|"filters by admission"| node_troponin
node_troponin -->|"imports settings"| node_config
node_troponin -->|"writes"| node_testlist
node_troponin -->|"writes"| node_troponindata
node_admissions -->|"reads"| node_prepare
node_diagnoses -->|"reads"| node_prepare
node_troponindata -->|"summarizes"| node_prepare
node_prepare -->|"imports paths"| node_config
node_prepare -->|"writes"| node_reviewfile
node_selection -->|"provides cohort"| node_select
node_mimic -->|"provides ICU tables"| node_select
node_select -->|"writes"| node_labelled
node_selection -->|"provides cohort"| node_extract
node_mimic -->|"provides ICU tables"| node_extract
node_extract -->|"writes"| node_labelled

click node_config "https://github.com/ayush3008anand/fyp/blob/main/config.py"
click node_find "https://github.com/ayush3008anand/fyp/blob/main/scripts/01_find_cardiac_admissions.py"
click node_diagnoses "https://github.com/ayush3008anand/fyp/blob/main/data/candidates/cardiac_admission_diagnoses.csv"
click node_admissions "https://github.com/ayush3008anand/fyp/blob/main/data/candidates/cardiac_admissions.csv"
click node_troponin "https://github.com/ayush3008anand/fyp/blob/main/scripts/02_extract_troponin.py"
click node_testlist "https://github.com/ayush3008anand/fyp/blob/main/data/troponin/available_troponin_tests.csv"
click node_troponindata "https://github.com/ayush3008anand/fyp/blob/main/data/troponin/cardiac_patient_troponin.csv"
click node_prepare "https://github.com/ayush3008anand/fyp/blob/main/scripts/03_prepare_adjudication.py"
click node_reviewfile "https://github.com/ayush3008anand/fyp/blob/main/data/adjudication/cardiac_adjudication_review.csv"
click node_selection "https://github.com/ayush3008anand/fyp/blob/main/data/final/selected_90_patients.csv"
click node_select "https://github.com/ayush3008anand/fyp/blob/main/scripts/04_select_cohort.py"
click node_extract "https://github.com/ayush3008anand/fyp/blob/main/scripts/05_extract_labelled_chartevents.py"
click node_labelled "https://github.com/ayush3008anand/fyp/blob/main/data/final/cardiac_patient_labelled_vitals.csv"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_find,node_diagnoses,node_admissions toneBlue
class node_troponin,node_testlist,node_troponindata,node_prepare,node_reviewfile,node_mimic toneAmber
class node_selection,node_select,node_extract,node_labelled toneMint
class node_config toneRose
class node_operator toneIndigo
```

## Components

### Cohort discovery

- [Find cardiac admissions](https://github.com/ayush3008anand/fyp/blob/main/scripts/01_find_cardiac_admissions.py): `scripts/01_find_cardiac_admissions.py`
- [Cardiac diagnosis candidates](https://github.com/ayush3008anand/fyp/blob/main/data/candidates/cardiac_admission_diagnoses.csv): `data/candidates/cardiac_admission_diagnoses.csv`
- [Cardiac admissions](https://github.com/ayush3008anand/fyp/blob/main/data/candidates/cardiac_admissions.csv): `data/candidates/cardiac_admissions.csv`

### Clinical review

- [Extract troponin](https://github.com/ayush3008anand/fyp/blob/main/scripts/02_extract_troponin.py): `scripts/02_extract_troponin.py`
- [Available troponin tests](https://github.com/ayush3008anand/fyp/blob/main/data/troponin/available_troponin_tests.csv): `data/troponin/available_troponin_tests.csv`
- [Patient troponin results](https://github.com/ayush3008anand/fyp/blob/main/data/troponin/cardiac_patient_troponin.csv): `data/troponin/cardiac_patient_troponin.csv`
- [Prepare adjudication review](https://github.com/ayush3008anand/fyp/blob/main/scripts/03_prepare_adjudication.py): `scripts/03_prepare_adjudication.py`
- [Adjudication review sheet](https://github.com/ayush3008anand/fyp/blob/main/data/adjudication/cardiac_adjudication_review.csv): `data/adjudication/cardiac_adjudication_review.csv`

### Vital extraction

- [Selected 90 patients](https://github.com/ayush3008anand/fyp/blob/main/data/final/selected_90_patients.csv): `data/final/selected_90_patients.csv`
- [Select cohort and extract vitals](https://github.com/ayush3008anand/fyp/blob/main/scripts/04_select_cohort.py): `scripts/04_select_cohort.py`
- [Extract labelled chartevents](https://github.com/ayush3008anand/fyp/blob/main/scripts/05_extract_labelled_chartevents.py): `scripts/05_extract_labelled_chartevents.py`
- [Labelled patient vitals](https://github.com/ayush3008anand/fyp/blob/main/data/final/cardiac_patient_labelled_vitals.csv): `data/final/cardiac_patient_labelled_vitals.csv`

### Runtime settings

- [Path and ID settings](https://github.com/ayush3008anand/fyp/blob/main/config.py): `config.py`

### Other components

- **Analyst**
- **MIMIC-IV tables**

## Connections

- Analyst → Find cardiac admissions: runs
- Analyst → Extract troponin: runs
- Analyst → Prepare adjudication review: runs
- Analyst → Select cohort and extract vitals: runs
- Analyst → Extract labelled chartevents: runs
- MIMIC-IV tables → Find cardiac admissions: provides tables (evidence: `scripts/01_find_cardiac_admissions.py`)
- Find cardiac admissions → Path and ID settings: imports settings (evidence: `scripts/01_find_cardiac_admissions.py`)
- Find cardiac admissions → Cardiac diagnosis candidates: writes (evidence: `scripts/01_find_cardiac_admissions.py`)
- Find cardiac admissions → Cardiac admissions: writes (evidence: `scripts/01_find_cardiac_admissions.py`)
- MIMIC-IV tables → Extract troponin: provides tables (evidence: `scripts/02_extract_troponin.py`)
- Cardiac admissions → Extract troponin: filters by admission (evidence: `scripts/02_extract_troponin.py`)
- Extract troponin → Path and ID settings: imports settings (evidence: `scripts/02_extract_troponin.py`)
- Extract troponin → Available troponin tests: writes (evidence: `scripts/02_extract_troponin.py`)
- Extract troponin → Patient troponin results: writes (evidence: `scripts/02_extract_troponin.py`)
- Cardiac admissions → Prepare adjudication review: reads (evidence: `scripts/03_prepare_adjudication.py`)
- Cardiac diagnosis candidates → Prepare adjudication review: reads (evidence: `scripts/03_prepare_adjudication.py`)
- Patient troponin results → Prepare adjudication review: summarizes (evidence: `scripts/03_prepare_adjudication.py`)
- Prepare adjudication review → Path and ID settings: imports paths (evidence: `scripts/03_prepare_adjudication.py`)
- Prepare adjudication review → Adjudication review sheet: writes (evidence: `scripts/03_prepare_adjudication.py`)
- Selected 90 patients → Select cohort and extract vitals: provides cohort (evidence: `scripts/04_select_cohort.py`)
- MIMIC-IV tables → Select cohort and extract vitals: provides ICU tables (evidence: `scripts/04_select_cohort.py`)
- Select cohort and extract vitals → Labelled patient vitals: writes (evidence: `scripts/04_select_cohort.py`)
- Selected 90 patients → Extract labelled chartevents: provides cohort (evidence: `scripts/05_extract_labelled_chartevents.py`)
- MIMIC-IV tables → Extract labelled chartevents: provides ICU tables (evidence: `scripts/05_extract_labelled_chartevents.py`)
- Extract labelled chartevents → Labelled patient vitals: writes (evidence: `scripts/05_extract_labelled_chartevents.py`)
