# gaelschenck/mspr architecture

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

- Interactive diagram: https://gitdiagram.com/gaelschenck/mspr
- Repository: https://github.com/gaelschenck/mspr

## Overview

This is a French-language HIV data portal backed by a FastAPI service and a Vue client. Users authenticate, select a country cluster, then browse health indicators and country-specific dashboards; the portal also exposes prediction and ETL-management workflows. The backend uses SQLAlchemy models and database sessions, while the ETL normalizes source files into a local SQLite dataset. The README documents a broader PostgreSQL/PowerBI analytical model, but its SQL and source-data directories are absent from this tree. Some backend routes are unsampled, so those relationships are omitted.

Main entry points: [`frontend/services/api.js`](https://github.com/gaelschenck/mspr/blob/addauth/frontend/services/api.js) (API client), [`frontend/src/router/index.js`](https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/router/index.js) (Route and access rules), [`backend/main.py`](https://github.com/gaelschenck/mspr/blob/addauth/backend/main.py) (FastAPI routes), [`frontend/src/views/Login.vue`](https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/views/Login.vue) (Cluster login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Vue application<br/>[App.vue]"]
  node_router["Route and access rules<br/>[index.js]"]
  node_login["Cluster login<br/>[Login.vue]"]
  node_userstore["User token store<br/>[userStore.js]"]
  node_api["API client<br/>[api.js]"]
  node_healthui["Health data views<br/>[HealthData.vue]"]
  node_indicatorui["Indicator dashboards<br/>[PopulationHiv.vue]"]
  node_predictionui["Prediction views<br/>[TestPrediction.vue]"]
  node_etlui["ETL dashboard<br/>[ETLDashboard.vue]"]
  node_consent["Privacy consent<br/>[RGPDConsent.vue]"]
end

subgraph group_service["API service"]
  node_backend["FastAPI routes<br/>[main.py]"]
  node_prediction["Prediction engine<br/>[prediction.py]"]
  node_models["Health data models<br/>[models.py]"]
  node_schemas["API schemas<br/>[schemas.py]"]
  node_database[("SQL database sessions<br/>[database.py]")]
end

subgraph group_data["Data processing"]
  node_etl["Health-data ETL<br/>[NewETL.py]"]
  node_etlstore[("Normalized SQLite data")]
end

node_user(("Portal user"))
node_analyst(("PowerBI analyst"))

node_user -->|"uses"| node_app
node_app -->|"renders routes"| node_router
node_router -->|"routes to"| node_login
node_router -->|"routes to"| node_healthui
node_router -->|"routes to"| node_indicatorui
node_router -->|"routes to"| node_predictionui
node_router -->|"routes to"| node_etlui
node_login -->|"submits credentials"| node_api
node_login -->|"stores token"| node_userstore
node_api -->|"sends HTTP requests"| node_backend
node_healthui -->|"fetches indicators"| node_api
node_indicatorui -->|"fetches indicators"| node_api
node_predictionui -->|"requests predictions"| node_api
node_etlui -->|"manages ETL"| node_api
node_consent -->|"saves consent"| node_api
node_backend -->|"queries models"| node_models
node_backend -->|"validates responses"| node_schemas
node_backend -.->|"opens sessions"| node_database
node_models -->|"uses ORM base"| node_database
node_backend -->|"serves predictions"| node_prediction
node_backend -->|"runs ETL operations"| node_etl
node_etl -->|"writes normalized data"| node_etlstore
node_analyst -.->|"analyzes exports"| node_etlstore

click node_app "https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/App.vue"
click node_router "https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/router/index.js"
click node_login "https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/views/Login.vue"
click node_userstore "https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/stores/userStore.js"
click node_api "https://github.com/gaelschenck/mspr/blob/addauth/frontend/services/api.js"
click node_healthui "https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/components/HealthData.vue"
click node_indicatorui "https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/components/PopulationHiv.vue"
click node_predictionui "https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/components/TestPrediction.vue"
click node_etlui "https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/components/ETLDashboard.vue"
click node_consent "https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/components/RGPDConsent.vue"
click node_backend "https://github.com/gaelschenck/mspr/blob/addauth/backend/main.py"
click node_prediction "https://github.com/gaelschenck/mspr/blob/addauth/backend/prediction.py"
click node_models "https://github.com/gaelschenck/mspr/blob/addauth/backend/models.py"
click node_schemas "https://github.com/gaelschenck/mspr/blob/addauth/backend/schemas.py"
click node_database "https://github.com/gaelschenck/mspr/blob/addauth/backend/database.py"
click node_etl "https://github.com/gaelschenck/mspr/blob/addauth/backend/NewETL/NewETL.py"
click node_etlstore "https://github.com/gaelschenck/mspr/tree/addauth/backend/NewETL"

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_router,node_login,node_userstore,node_api,node_healthui,node_indicatorui,node_predictionui,node_etlui,node_consent,node_user toneBlue
class node_backend,node_prediction,node_models,node_schemas,node_database toneAmber
class node_etl,node_etlstore toneMint
class node_analyst toneIndigo
```

## Components

### Web client

- [Vue application](https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/App.vue): `frontend/src/App.vue`
- [Route and access rules](https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/router/index.js): `frontend/src/router/index.js`
- [Cluster login](https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/views/Login.vue): `frontend/src/views/Login.vue`
- [User token store](https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/stores/userStore.js): `frontend/src/stores/userStore.js`
- [API client](https://github.com/gaelschenck/mspr/blob/addauth/frontend/services/api.js): `frontend/services/api.js`
- [Health data views](https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/components/HealthData.vue): `frontend/src/components/HealthData.vue`
- [Indicator dashboards](https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/components/PopulationHiv.vue): `frontend/src/components/PopulationHiv.vue`
- [Prediction views](https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/components/TestPrediction.vue): `frontend/src/components/TestPrediction.vue`
- [ETL dashboard](https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/components/ETLDashboard.vue): `frontend/src/components/ETLDashboard.vue`
- [Privacy consent](https://github.com/gaelschenck/mspr/blob/addauth/frontend/src/components/RGPDConsent.vue): `frontend/src/components/RGPDConsent.vue`

### API service

- [FastAPI routes](https://github.com/gaelschenck/mspr/blob/addauth/backend/main.py): `backend/main.py`
- [Prediction engine](https://github.com/gaelschenck/mspr/blob/addauth/backend/prediction.py): `backend/prediction.py`
- [Health data models](https://github.com/gaelschenck/mspr/blob/addauth/backend/models.py): `backend/models.py`
- [API schemas](https://github.com/gaelschenck/mspr/blob/addauth/backend/schemas.py): `backend/schemas.py`
- [SQL database sessions](https://github.com/gaelschenck/mspr/blob/addauth/backend/database.py): `backend/database.py`

### Data processing

- [Health-data ETL](https://github.com/gaelschenck/mspr/blob/addauth/backend/NewETL/NewETL.py): `backend/NewETL/NewETL.py`
- [Normalized SQLite data](https://github.com/gaelschenck/mspr/tree/addauth/backend/NewETL): `backend/NewETL`

### Other components

- **Portal user**
- **PowerBI analyst**

## Connections

- Portal user → Vue application: uses (evidence: `frontend/src/App.vue`)
- Vue application → Route and access rules: renders routes (evidence: `frontend/src/App.vue`)
- Route and access rules → Cluster login: routes to (evidence: `frontend/src/router/index.js`)
- Route and access rules → Health data views: routes to (evidence: `frontend/src/router/index.js`)
- Route and access rules → Indicator dashboards: routes to (evidence: `frontend/src/router/index.js`)
- Route and access rules → Prediction views: routes to (evidence: `frontend/src/router/index.js`)
- Route and access rules → ETL dashboard: routes to (evidence: `frontend/src/router/index.js`)
- Cluster login → API client: submits credentials (evidence: `frontend/src/views/Login.vue`)
- Cluster login → User token store: stores token (evidence: `frontend/src/views/Login.vue`)
- API client → FastAPI routes: sends HTTP requests (evidence: `frontend/services/api.js`)
- Health data views → API client: fetches indicators (evidence: `frontend/src/components/HealthData.vue`)
- Indicator dashboards → API client: fetches indicators (evidence: `frontend/src/components/PopulationHiv.vue`)
- Prediction views → API client: requests predictions (evidence: `frontend/src/components/TestPrediction.vue`)
- ETL dashboard → API client: manages ETL (evidence: `frontend/src/components/ETLDashboard.vue`)
- Privacy consent → API client: saves consent (evidence: `frontend/src/components/RGPDConsent.vue`)
- FastAPI routes → Health data models: queries models (evidence: `backend/main.py`)
- FastAPI routes → API schemas: validates responses (evidence: `backend/main.py`)
- FastAPI routes → SQL database sessions: opens sessions (evidence: `backend/main.py`)
- Health data models → SQL database sessions: uses ORM base (evidence: `backend/models.py`)
- FastAPI routes → Prediction engine: serves predictions (evidence: `backend/main.py`)
- FastAPI routes → Health-data ETL: runs ETL operations (evidence: `backend/main.py`)
- Health-data ETL → Normalized SQLite data: writes normalized data (evidence: `backend/NewETL/NewETL.py`)
- PowerBI analyst → Normalized SQLite data: analyzes exports
