# gvahck/liverprediction architecture

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

- Interactive diagram: https://gitdiagram.com/gvahck/liverprediction
- Repository: https://github.com/gvahck/liverprediction

## Overview

Liverify combines a Flask-based clinical-risk demonstration with a research workflow for auditing liver-patient data, evaluating models and decision policies, and exporting a serving model. The user-facing flow accepts clinical measurements and returns a risk result; the research flow audits and prepares data, then supports nested evaluation, calibration, clinical-policy analysis, and robustness and interpretability studies. Edges reflect the excerpts, SOURCE INDEX references, or README; unsampled runtime wiring is left unasserted or marked unverified.

Main entry points: [`Liver-Predictions/src/cv.py`](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/cv.py) (Preprocessing and metrics), [`Liver-Predictions/src/export_production_model.py`](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/export_production_model.py) (Production model export), [`Liver-Predictions/server.py`](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/server.py) (Flask routes), [`Liver-Predictions/src/data_audit.py`](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/data_audit.py) (Data audit and cleaning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_serving["Risk-check application"]
  node_server["Flask routes<br/>[server.py]"]
  node_templates["Web pages"]
  node_model_artifact["Production model"]
end

subgraph group_data["Data preparation"]
  node_raw_data[("Raw ILPD data")]
  node_data_audit["Data audit and cleaning<br/>[data_audit.py]"]
  node_processed_data[("Processed cohorts")]
end

subgraph group_evaluation["Model evaluation"]
  node_cv["Preprocessing and metrics<br/>[cv.py]"]
  node_training["Model training<br/>[train_models.py]"]
  node_nested["Nested model selection"]
  node_imbalance["Imbalance and calibration"]
end

subgraph group_analysis["Clinical research"]
  node_clinical["Clinical decision analysis"]
  node_policy["Selective referral policy"]
  node_statistics["Statistical analysis"]
  node_robustness["Robustness experiments"]
  node_interpretability["Interpretability analysis"]
  node_patient_stats["Patient statistics"]
end

subgraph group_deployment["Model export"]
  node_export["Production model export"]
end

node_patient(("Clinician or user"))

node_patient -->|"submits measurements"| node_server
node_server -->|"renders pages"| node_templates
node_server -.->|"loads and predicts"| node_model_artifact
node_raw_data -->|"audits and cleans"| node_data_audit
node_data_audit -->|"writes cohorts"| node_processed_data
node_training -->|"uses evaluation utilities"| node_cv
node_nested -->|"uses evaluation utilities"| node_cv
node_imbalance -->|"uses preprocessing"| node_cv
node_clinical -->|"uses evaluation utilities"| node_cv
node_policy -->|"uses evaluation utilities"| node_cv
node_policy -->|"reads nested results"| node_nested
node_robustness -->|"uses preprocessing"| node_cv
node_robustness -->|"references nested results"| node_nested
node_statistics -->|"uses preprocessing"| node_cv
node_export -->|"builds model pipeline"| node_cv
node_export -->|"computes data hash"| node_data_audit
node_export -->|"exports bundle"| node_model_artifact

click node_server "https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/server.py"
click node_templates "https://github.com/gvahck/liverprediction/tree/main/Liver-Predictions/templates"
click node_model_artifact "https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/app/production_model.joblib"
click node_raw_data "https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/data/raw/indian_liver_patient.csv"
click node_data_audit "https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/data_audit.py"
click node_processed_data "https://github.com/gvahck/liverprediction/tree/main/Liver-Predictions/data/processed"
click node_cv "https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/cv.py"
click node_training "https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/train_models.py"
click node_nested "https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/nested_selection.py"
click node_imbalance "https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/imbalance_calibration.py"
click node_clinical "https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/clinical_decision.py"
click node_policy "https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/selective_policy.py"
click node_statistics "https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/statistical_analysis.py"
click node_robustness "https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/robustness_experiments.py"
click node_interpretability "https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/interpretability_analysis.py"
click node_patient_stats "https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/patient_statistics.py"
click node_export "https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/export_production_model.py"

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_server,node_templates,node_model_artifact,node_patient toneBlue
class node_raw_data,node_data_audit,node_processed_data toneAmber
class node_cv,node_training,node_nested,node_imbalance toneMint
class node_clinical,node_policy,node_statistics,node_robustness,node_interpretability,node_patient_stats toneRose
class node_export toneIndigo
```

## Components

### Risk-check application

- [Flask routes](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/server.py): `Liver-Predictions/server.py`
- [Web pages](https://github.com/gvahck/liverprediction/tree/main/Liver-Predictions/templates): `Liver-Predictions/templates`
- [Production model](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/app/production_model.joblib): `Liver-Predictions/app/production_model.joblib`

### Data preparation

- [Raw ILPD data](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/data/raw/indian_liver_patient.csv): `Liver-Predictions/data/raw/indian_liver_patient.csv`
- [Data audit and cleaning](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/data_audit.py): `Liver-Predictions/src/data_audit.py`
- [Processed cohorts](https://github.com/gvahck/liverprediction/tree/main/Liver-Predictions/data/processed): `Liver-Predictions/data/processed`

### Model evaluation

- [Preprocessing and metrics](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/cv.py): `Liver-Predictions/src/cv.py`
- [Model training](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/train_models.py): `Liver-Predictions/src/train_models.py`
- [Nested model selection](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/nested_selection.py): `Liver-Predictions/src/nested_selection.py`
- [Imbalance and calibration](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/imbalance_calibration.py): `Liver-Predictions/src/imbalance_calibration.py`

### Clinical research

- [Clinical decision analysis](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/clinical_decision.py): `Liver-Predictions/src/clinical_decision.py`
- [Selective referral policy](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/selective_policy.py): `Liver-Predictions/src/selective_policy.py`
- [Statistical analysis](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/statistical_analysis.py): `Liver-Predictions/src/statistical_analysis.py`
- [Robustness experiments](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/robustness_experiments.py): `Liver-Predictions/src/robustness_experiments.py`
- [Interpretability analysis](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/interpretability_analysis.py): `Liver-Predictions/src/interpretability_analysis.py`
- [Patient statistics](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/patient_statistics.py): `Liver-Predictions/src/patient_statistics.py`

### Model export

- [Production model export](https://github.com/gvahck/liverprediction/blob/main/Liver-Predictions/src/export_production_model.py): `Liver-Predictions/src/export_production_model.py`

### Other components

- **Clinician or user**

## Connections

- Clinician or user → Flask routes: submits measurements (evidence: `README.md`)
- Flask routes → Web pages: renders pages (evidence: `README.md`)
- Flask routes → Production model: loads and predicts
- Raw ILPD data → Data audit and cleaning: audits and cleans (evidence: `Liver-Predictions/src/data_audit.py`)
- Data audit and cleaning → Processed cohorts: writes cohorts (evidence: `Liver-Predictions/src/data_audit.py`)
- Model training → Preprocessing and metrics: uses evaluation utilities (evidence: `Liver-Predictions/src/train_models.py`)
- Nested model selection → Preprocessing and metrics: uses evaluation utilities (evidence: `Liver-Predictions/src/nested_selection.py`)
- Imbalance and calibration → Preprocessing and metrics: uses preprocessing (evidence: `Liver-Predictions/src/imbalance_calibration.py`)
- Clinical decision analysis → Preprocessing and metrics: uses evaluation utilities (evidence: `Liver-Predictions/src/clinical_decision.py`)
- Selective referral policy → Preprocessing and metrics: uses evaluation utilities (evidence: `Liver-Predictions/src/selective_policy.py`)
- Selective referral policy → Nested model selection: reads nested results (evidence: `Liver-Predictions/src/selective_policy.py`)
- Robustness experiments → Preprocessing and metrics: uses preprocessing (evidence: `Liver-Predictions/src/robustness_experiments.py`)
- Robustness experiments → Nested model selection: references nested results (evidence: `Liver-Predictions/src/robustness_experiments.py`)
- Statistical analysis → Preprocessing and metrics: uses preprocessing (evidence: `Liver-Predictions/src/statistical_analysis.py`)
- Production model export → Preprocessing and metrics: builds model pipeline (evidence: `Liver-Predictions/src/export_production_model.py`)
- Production model export → Data audit and cleaning: computes data hash (evidence: `Liver-Predictions/src/export_production_model.py`)
- Production model export → Production model: exports bundle (evidence: `Liver-Predictions/src/export_production_model.py`)
