# suriyaa-r/maternal-infant-risk architecture

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

- Interactive diagram: https://gitdiagram.com/suriyaa-r/maternal-infant-risk
- Repository: https://github.com/suriyaa-r/maternal-infant-risk

## Overview

This is an academic maternal-and-infant risk prediction application, trained primarily on synthetic data and explicitly not for clinical use. Its principal workflow generates data, preprocesses it, trains and evaluates candidate classifiers, selects a high-recall model, and serves predictions in a Streamlit app. Separate analysis branches provide clustering, association-rule mining, and explainability. The end-to-end script is the documented workflow orchestrator. Some app behavior and artifact wiring are documented in the README but not visible in the partial app excerpt; those edges cite the README.

Main entry points: [`scripts/run_all.py`](https://github.com/suriyaa-r/maternal-infant-risk/blob/main/scripts/run_all.py) (Workflow execution), [`src/preprocessing.py`](https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/preprocessing.py) (Preprocessing and SMOTE), [`src/evaluation.py`](https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/evaluation.py) (Model evaluation and selection), [`data/raw`](https://github.com/suriyaa-r/maternal-infant-risk/tree/main/data/raw) (Raw CSV data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Risk prediction app"]
  node_app["Streamlit interface<br/>[app.py]"]
  node_prediction["Risk prediction<br/>[app.py]"]
end

subgraph group_pipeline["Data pipeline"]
  node_generator["Synthetic data generation<br/>[data_generation.py]"]
  node_preprocessing["Preprocessing and SMOTE<br/>[preprocessing.py]"]
  node_orchestrator["Workflow execution<br/>[run_all.py]"]
end

subgraph group_analysis["Mining and evaluation"]
  node_classifiers["Classifier training<br/>[models.py]"]
  node_clustering["K-means analysis<br/>[models.py]"]
  node_association["Apriori rules<br/>[models.py]"]
  node_evaluation["Model evaluation and selection<br/>[evaluation.py]"]
  node_explainability["SHAP and feature importance<br/>[evaluation.py]"]
end

subgraph group_artifacts["Data and models"]
  node_rawdata[("Raw CSV data")]
  node_processeddata[("Processed splits")]
  node_modelstore[("Serialized model artifacts")]
end

node_user(("Care professional"))

node_user -->|"enters patient data"| node_app
node_app -->|"requests prediction"| node_prediction
node_prediction -->|"loads selected pipeline"| node_modelstore
node_generator -->|"generates dataset"| node_rawdata
node_orchestrator -->|"runs generation"| node_generator
node_orchestrator -->|"runs preprocessing"| node_preprocessing
node_preprocessing -.->|"reads dataset"| node_rawdata
node_preprocessing -->|"saves splits"| node_processeddata
node_orchestrator -->|"trains models"| node_classifiers
node_orchestrator -->|"runs clustering"| node_clustering
node_orchestrator -->|"runs rule mining"| node_association
node_orchestrator -->|"evaluates candidates"| node_evaluation
node_evaluation -.->|"scores models"| node_classifiers
node_evaluation -->|"saves best pipeline"| node_modelstore
node_orchestrator -->|"generates explanations"| node_explainability
node_orchestrator -->|"stores trained models"| node_modelstore
node_orchestrator -.->|"uses generated data"| node_rawdata

click node_app "https://github.com/suriyaa-r/maternal-infant-risk/blob/main/app/app.py"
click node_prediction "https://github.com/suriyaa-r/maternal-infant-risk/blob/main/app/app.py"
click node_generator "https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/data_generation.py"
click node_preprocessing "https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/preprocessing.py"
click node_orchestrator "https://github.com/suriyaa-r/maternal-infant-risk/blob/main/scripts/run_all.py"
click node_classifiers "https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/models.py"
click node_clustering "https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/models.py"
click node_association "https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/models.py"
click node_evaluation "https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/evaluation.py"
click node_explainability "https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/evaluation.py"
click node_rawdata "https://github.com/suriyaa-r/maternal-infant-risk/tree/main/data/raw"
click node_processeddata "https://github.com/suriyaa-r/maternal-infant-risk/tree/main/data/processed"
click node_modelstore "https://github.com/suriyaa-r/maternal-infant-risk/tree/main/models"

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_app,node_prediction toneBlue
class node_generator,node_preprocessing,node_orchestrator toneAmber
class node_classifiers,node_clustering,node_association,node_evaluation,node_explainability toneMint
class node_rawdata,node_processeddata,node_modelstore toneRose
class node_user toneIndigo
```

## Components

### Risk prediction app

- [Streamlit interface](https://github.com/suriyaa-r/maternal-infant-risk/blob/main/app/app.py): `app/app.py`
- [Risk prediction](https://github.com/suriyaa-r/maternal-infant-risk/blob/main/app/app.py): `app/app.py`

### Data pipeline

- [Synthetic data generation](https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/data_generation.py): `src/data_generation.py`
- [Preprocessing and SMOTE](https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/preprocessing.py): `src/preprocessing.py`
- [Workflow execution](https://github.com/suriyaa-r/maternal-infant-risk/blob/main/scripts/run_all.py): `scripts/run_all.py`

### Mining and evaluation

- [Classifier training](https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/models.py): `src/models.py`
- [K-means analysis](https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/models.py): `src/models.py`
- [Apriori rules](https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/models.py): `src/models.py`
- [Model evaluation and selection](https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/evaluation.py): `src/evaluation.py`
- [SHAP and feature importance](https://github.com/suriyaa-r/maternal-infant-risk/blob/main/src/evaluation.py): `src/evaluation.py`

### Data and models

- [Raw CSV data](https://github.com/suriyaa-r/maternal-infant-risk/tree/main/data/raw): `data/raw`
- [Processed splits](https://github.com/suriyaa-r/maternal-infant-risk/tree/main/data/processed): `data/processed`
- [Serialized model artifacts](https://github.com/suriyaa-r/maternal-infant-risk/tree/main/models): `models`

### Other components

- **Care professional**

## Connections

- Care professional → Streamlit interface: enters patient data (evidence: `README.md`)
- Streamlit interface → Risk prediction: requests prediction (evidence: `README.md`)
- Risk prediction → Serialized model artifacts: loads selected pipeline (evidence: `README.md`)
- Synthetic data generation → Raw CSV data: generates dataset (evidence: `README.md`)
- Workflow execution → Synthetic data generation: runs generation (evidence: `scripts/run_all.py`)
- Workflow execution → Preprocessing and SMOTE: runs preprocessing (evidence: `scripts/run_all.py`)
- Preprocessing and SMOTE → Raw CSV data: reads dataset
- Preprocessing and SMOTE → Processed splits: saves splits (evidence: `src/preprocessing.py`)
- Workflow execution → Classifier training: trains models (evidence: `scripts/run_all.py`)
- Workflow execution → K-means analysis: runs clustering (evidence: `scripts/run_all.py`)
- Workflow execution → Apriori rules: runs rule mining (evidence: `scripts/run_all.py`)
- Workflow execution → Model evaluation and selection: evaluates candidates (evidence: `scripts/run_all.py`)
- Model evaluation and selection → Classifier training: scores models
- Model evaluation and selection → Serialized model artifacts: saves best pipeline (evidence: `src/evaluation.py`)
- Workflow execution → SHAP and feature importance: generates explanations (evidence: `scripts/run_all.py`)
- Workflow execution → Serialized model artifacts: stores trained models (evidence: `scripts/run_all.py`)
- Workflow execution → Raw CSV data: uses generated data
