# idkhowtocodefr/tinyml-heart-health-monitoring-dashboard architecture

> Architecture diagram of the GitHub repository idkhowtocodefr/tinyml-heart-health-monitoring-dashboard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard
- Repository: https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard

## Overview

This is a heart-health monitoring dashboard: clinicians enter patient vitals, the Streamlit prediction page sends them to the FastAPI service, and the service returns a weighted five-model classification and confidence. Related workflows expose SHAP explanations, prediction history, dataset analytics, model retraining, and C-code export for embedded targets. The backend’s persistence layer records predictions in SQLite and optionally synchronizes that database with the Hugging Face Hub. The graph also preserves the documented edge and MLOps capabilities; unsampled page and route internals are represented only where the README or sampled code supports them.

Main entry points: [`backend/main.py`](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/main.py) (FastAPI Routes), [`frontend/pages/1_Predict_Dashboard.py`](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/frontend/pages/1_Predict_Dashboard.py) (Prediction UI), [`backend/database.py`](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/database.py) (History Persistence), [`backend/ensemble.py`](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/ensemble.py) (Soft-Voting Ensemble)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Clinical Dashboard"]
  node_prediction_ui["Prediction UI"]
  node_analytics_ui["Data Analytics"]
  node_history_ui["Patient History"]
  node_mlops_ui["MLOps Settings"]
  node_edge_ui["Edge Deployment"]
end

subgraph group_api["API and Inference"]
  node_api["FastAPI Routes<br/>[main.py]"]
  node_preprocessing["Feature Preprocessing<br/>[preprocessing.py]"]
  node_ensemble["Soft-Voting Ensemble<br/>[ensemble.py]"]
  node_models["Five Classifiers"]
  node_explainer["SHAP Explanation<br/>[main.py]"]
end

subgraph group_state["Data and Operations"]
  node_database["History Persistence<br/>[database.py]"]
  node_sqlite[("SQLite History<br/>[patient_history.db]")]
  node_hub[("Hub Dataset Store")]
  node_patient_data["Patient Dataset"]
  node_retrainer["Dataset Retraining<br/>[main.py]"]
end

subgraph group_edge["TinyML Export"]
  node_exporter["C-Code Export<br/>[main.py]"]
  node_c_header["Generated C Header"]
end

node_clinician(("Clinician"))
node_embedded(("Embedded Target"))
node_upload(("Dataset Upload"))

node_clinician -->|"enters vitals"| node_prediction_ui
node_prediction_ui -->|"requests prediction"| node_api
node_api -->|"prepares features"| node_preprocessing
node_api -->|"requests prediction"| node_ensemble
node_ensemble -->|"loads classifiers"| node_models
node_ensemble -->|"returns consensus"| node_api
node_api -->|"logs prediction"| node_database
node_history_ui -->|"requests history"| node_api
node_api -->|"fetches history"| node_database
node_database -->|"reads and writes"| node_sqlite
node_database -.->|"syncs database"| node_hub
node_clinician -->|"views analytics"| node_analytics_ui
node_analytics_ui -->|"requests dataset"| node_api
node_api -->|"reads dataset"| node_patient_data
node_clinician -->|"submits dataset"| node_mlops_ui
node_upload -->|"provides CSV"| node_mlops_ui
node_mlops_ui -->|"requests retraining"| node_api
node_api -->|"runs retraining"| node_retrainer
node_retrainer -->|"updates dataset"| node_patient_data
node_clinician -->|"selects model"| node_edge_ui
node_edge_ui -->|"requests export"| node_api
node_api -->|"exports model"| node_exporter
node_exporter -->|"loads selected model"| node_models
node_exporter -->|"generates C code"| node_c_header
node_c_header -.->|"deploys firmware"| node_embedded
node_prediction_ui -->|"requests explanation"| node_api
node_api -->|"computes SHAP"| node_explainer
node_explainer -->|"returns impacts"| node_prediction_ui

click node_prediction_ui "https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/frontend/pages/1_Predict_Dashboard.py"
click node_analytics_ui "https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/frontend/pages/2_Data_Analytics.py"
click node_history_ui "https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/frontend/pages/4_Patient_History.py"
click node_mlops_ui "https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/frontend/pages/5_MLOps_Settings.py"
click node_edge_ui "https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/frontend/pages/3_Edge_Deployment.py"
click node_api "https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/main.py"
click node_preprocessing "https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/preprocessing.py"
click node_ensemble "https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/ensemble.py"
click node_models "https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/tree/main/model"
click node_explainer "https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/main.py"
click node_database "https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/database.py"
click node_sqlite "https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/patient_history.db"
click node_patient_data "https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/data/patient_dataset.csv"
click node_retrainer "https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/main.py"
click node_exporter "https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/main.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_prediction_ui,node_analytics_ui,node_history_ui,node_mlops_ui,node_edge_ui toneBlue
class node_api,node_preprocessing,node_ensemble,node_models,node_explainer toneAmber
class node_database,node_sqlite,node_hub,node_patient_data,node_retrainer toneMint
class node_exporter,node_c_header toneRose
class node_clinician,node_embedded,node_upload toneIndigo
```

## Components

### Clinical Dashboard

- [Prediction UI](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/frontend/pages/1_Predict_Dashboard.py): `frontend/pages/1_Predict_Dashboard.py`
- [Data Analytics](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/frontend/pages/2_Data_Analytics.py): `frontend/pages/2_Data_Analytics.py`
- [Patient History](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/frontend/pages/4_Patient_History.py): `frontend/pages/4_Patient_History.py`
- [MLOps Settings](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/frontend/pages/5_MLOps_Settings.py): `frontend/pages/5_MLOps_Settings.py`
- [Edge Deployment](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/frontend/pages/3_Edge_Deployment.py): `frontend/pages/3_Edge_Deployment.py`

### API and Inference

- [FastAPI Routes](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/main.py): `backend/main.py`
- [Feature Preprocessing](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/preprocessing.py): `backend/preprocessing.py`
- [Soft-Voting Ensemble](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/ensemble.py): `backend/ensemble.py`
- [Five Classifiers](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/tree/main/model): `model`
- [SHAP Explanation](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/main.py): `backend/main.py`

### Data and Operations

- [History Persistence](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/database.py): `backend/database.py`
- [SQLite History](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/patient_history.db): `backend/patient_history.db`
- **Hub Dataset Store**
- [Patient Dataset](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/data/patient_dataset.csv): `data/patient_dataset.csv`
- [Dataset Retraining](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/main.py): `backend/main.py`

### TinyML Export

- [C-Code Export](https://github.com/idkhowtocodefr/tinyml-heart-health-monitoring-dashboard/blob/main/backend/main.py): `backend/main.py`
- **Generated C Header**

### Other components

- **Clinician**
- **Embedded Target**
- **Dataset Upload**

## Connections

- Clinician → Prediction UI: enters vitals
- Prediction UI → FastAPI Routes: requests prediction
- FastAPI Routes → Feature Preprocessing: prepares features
- FastAPI Routes → Soft-Voting Ensemble: requests prediction
- Soft-Voting Ensemble → Five Classifiers: loads classifiers
- Soft-Voting Ensemble → FastAPI Routes: returns consensus
- FastAPI Routes → History Persistence: logs prediction
- Patient History → FastAPI Routes: requests history
- FastAPI Routes → History Persistence: fetches history
- History Persistence → SQLite History: reads and writes
- History Persistence → Hub Dataset Store: syncs database
- Clinician → Data Analytics: views analytics
- Data Analytics → FastAPI Routes: requests dataset
- FastAPI Routes → Patient Dataset: reads dataset
- Clinician → MLOps Settings: submits dataset
- Dataset Upload → MLOps Settings: provides CSV
- MLOps Settings → FastAPI Routes: requests retraining
- FastAPI Routes → Dataset Retraining: runs retraining
- Dataset Retraining → Patient Dataset: updates dataset
- Clinician → Edge Deployment: selects model
- Edge Deployment → FastAPI Routes: requests export
- FastAPI Routes → C-Code Export: exports model
- C-Code Export → Five Classifiers: loads selected model
- C-Code Export → Generated C Header: generates C code
- Generated C Header → Embedded Target: deploys firmware
- Prediction UI → FastAPI Routes: requests explanation
- FastAPI Routes → SHAP Explanation: computes SHAP
- SHAP Explanation → Prediction UI: returns impacts
