# krishna-jajoo-git/patient-risk-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/krishna-jajoo-git/patient-risk-prediction
- Repository: https://github.com/krishna-jajoo-git/patient-risk-prediction

## Overview

This is an academic patient health-risk prediction application: structured patient histories are validated, cleaned, aggregated into longitudinal features, and used to train and benchmark classifiers; the saved model then powers Streamlit assessments and dashboards. The graph preserves the documented training stages and UI capabilities. Some training and UI implementation details are unsampled, so those relationships rely on README statements; source-level relationships are limited to the supplied excerpts and SOURCE INDEX.

Main entry points: [`src/predict.py`](https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/predict.py) (Inference engine), [`src/train.py`](https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/train.py) (Training and selection), [`src/data_loader.py`](https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/data_loader.py) (Schema and data loader), [`app.py`](https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/app.py) (Streamlit application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_synthetic["Demo generator"]
  node_loader["Schema and data loader<br/>[data_loader.py]"]
  node_cleaner["Data cleaning<br/>[preprocessing.py]"]
  node_features["Longitudinal features"]
end

subgraph group_model["Model development"]
  node_training["Training and selection<br/>[train.py]"]
  node_benchmark["Model evaluation<br/>[evaluation.py]"]
end

subgraph group_inference["Prediction experience"]
  node_app["Streamlit application<br/>[app.py]"]
  node_predict["Inference engine<br/>[predict.py]"]
  node_clinical_summary["Patient summaries"]
end

subgraph group_support["Configuration and artifacts"]
  node_config["Configuration<br/>[config.py]"]
  node_artifacts["Model and metrics"]
end

node_operator(("User"))
node_cohort["Patient records"]

node_operator -->|"generate demo"| node_synthetic
node_synthetic -->|"writes synthetic data"| node_cohort
node_operator -->|"run training"| node_training
node_cohort -->|"loads and validates"| node_loader
node_config -->|"configures"| node_loader
node_loader -->|"cleaned by"| node_cleaner
node_cleaner -->|"aggregated into"| node_features
node_config -->|"configures"| node_training
node_training -->|"loads data"| node_loader
node_training -->|"cleans data"| node_cleaner
node_training -->|"engineers features"| node_features
node_training -->|"evaluates models"| node_benchmark
node_training -->|"saves selected model"| node_artifacts
node_operator -->|"use dashboard"| node_app
node_app -->|"loads configuration"| node_config
node_app -->|"validates uploads"| node_loader
node_app -->|"requests predictions"| node_predict
node_predict -->|"loads model"| node_artifacts
node_predict -->|"loads configuration"| node_config
node_predict -->|"validates input"| node_loader
node_predict -->|"cleans history"| node_cleaner
node_predict -->|"builds features"| node_features
node_predict -->|"summarizes history"| node_clinical_summary
node_app -.->|"displays benchmarks"| node_benchmark

click node_cohort "https://github.com/krishna-jajoo-git/patient-risk-prediction/tree/main/data/raw"
click node_synthetic "https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/generate_demo_data.py"
click node_config "https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/config.py"
click node_loader "https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/data_loader.py"
click node_cleaner "https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/preprocessing.py"
click node_features "https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/feature_engineering.py"
click node_training "https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/train.py"
click node_benchmark "https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/evaluation.py"
click node_artifacts "https://github.com/krishna-jajoo-git/patient-risk-prediction/tree/main/models"
click node_app "https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/app.py"
click node_predict "https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/predict.py"
click node_clinical_summary "https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/feature_engineering.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_synthetic,node_loader,node_cleaner,node_features,node_operator toneBlue
class node_training,node_benchmark toneAmber
class node_app,node_predict,node_clinical_summary toneMint
class node_config,node_artifacts toneRose
class node_cohort toneTeal
```

## Components

### Data preparation

- [Demo generator](https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/generate_demo_data.py): `src/generate_demo_data.py`
- [Schema and data loader](https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/data_loader.py): `src/data_loader.py`
- [Data cleaning](https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/preprocessing.py): `src/preprocessing.py`
- [Longitudinal features](https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/feature_engineering.py): `src/feature_engineering.py`

### Model development

- [Training and selection](https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/train.py): `src/train.py`
- [Model evaluation](https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/evaluation.py): `src/evaluation.py`

### Prediction experience

- [Streamlit application](https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/app.py): `app.py`
- [Inference engine](https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/predict.py): `src/predict.py`
- [Patient summaries](https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/feature_engineering.py): `src/feature_engineering.py`

### Configuration and artifacts

- [Configuration](https://github.com/krishna-jajoo-git/patient-risk-prediction/blob/main/src/config.py): `src/config.py`
- [Model and metrics](https://github.com/krishna-jajoo-git/patient-risk-prediction/tree/main/models): `models`

### Other components

- **User**
- [Patient records](https://github.com/krishna-jajoo-git/patient-risk-prediction/tree/main/data/raw): `data/raw`

## Connections

- User → Demo generator: generate demo (evidence: `README.md`)
- Demo generator → Patient records: writes synthetic data (evidence: `src/generate_demo_data.py`)
- User → Training and selection: run training (evidence: `README.md`)
- Patient records → Schema and data loader: loads and validates (evidence: `README.md`)
- Configuration → Schema and data loader: configures (evidence: `src/data_loader.py`)
- Schema and data loader → Data cleaning: cleaned by (evidence: `README.md`)
- Data cleaning → Longitudinal features: aggregated into (evidence: `README.md`)
- Configuration → Training and selection: configures (evidence: `src/train.py`)
- Training and selection → Schema and data loader: loads data (evidence: `src/train.py`)
- Training and selection → Data cleaning: cleans data (evidence: `src/train.py`)
- Training and selection → Longitudinal features: engineers features (evidence: `src/train.py`)
- Training and selection → Model evaluation: evaluates models (evidence: `README.md`)
- Training and selection → Model and metrics: saves selected model (evidence: `README.md`)
- User → Streamlit application: use dashboard (evidence: `README.md`)
- Streamlit application → Configuration: loads configuration (evidence: `app.py`)
- Streamlit application → Schema and data loader: validates uploads (evidence: `app.py`)
- Streamlit application → Inference engine: requests predictions (evidence: `README.md`)
- Inference engine → Model and metrics: loads model (evidence: `src/predict.py`)
- Inference engine → Configuration: loads configuration (evidence: `src/predict.py`)
- Inference engine → Schema and data loader: validates input (evidence: `src/predict.py`)
- Inference engine → Data cleaning: cleans history (evidence: `src/predict.py`)
- Inference engine → Longitudinal features: builds features (evidence: `src/predict.py`)
- Inference engine → Patient summaries: summarizes history (evidence: `src/predict.py`)
- Streamlit application → Model evaluation: displays benchmarks (evidence: `README.md`)
