# godlinspshanya/ev-health-monitoring-system architecture

> Architecture diagram of the GitHub repository godlinspshanya/ev-health-monitoring-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/godlinspshanya/ev-health-monitoring-system
- Repository: https://github.com/godlinspshanya/ev-health-monitoring-system

## Overview

This repository is an EV charging-station health-monitoring application with a Streamlit dashboard and FastAPI backend. Operators use the dashboard to manage station, telemetry, maintenance, staffing, and operational records; they can also request machine-learning failure predictions and inspect historical data and alerts. The backend validates requests, runs prediction logic, and persists records in SQLite. The README also documents REST endpoints and Swagger API documentation. Edges reflect the shown dashboard/API/backend and backend/storage relationships; unsampled implementation details are omitted.

Main entry points: [`backend/main.py`](https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/main.py) (REST endpoints), [`backend/models`](https://github.com/godlinspshanya/ev-health-monitoring-system/tree/main/backend/models) (Domain records), [`backend/schemas`](https://github.com/godlinspshanya/ev-health-monitoring-system/tree/main/backend/schemas) (Request schemas), [`frontend/dashboard.py`](https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/frontend/dashboard.py) (Health dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Operator interface"]
  node_dashboard["Health dashboard<br/>[dashboard.py]"]
  node_client["HTTP API client<br/>[api.py]"]
end

subgraph group_api["Backend services"]
  node_rest["REST endpoints<br/>[main.py]"]
  node_users["User management<br/>[main.py]"]
  node_stations["Station management<br/>[main.py]"]
  node_telemetry["Telemetry records<br/>[main.py]"]
  node_maintenance["Maintenance records<br/>[main.py]"]
  node_operations["Operational records<br/>[main.py]"]
  node_schemas["Request schemas"]
end

subgraph group_ml["Prediction"]
  node_prediction_api["Prediction endpoint<br/>[main.py]"]
  node_predictor["Failure predictor<br/>[predict.py]"]
  node_training["Model training<br/>[train_model.py]"]
end

subgraph group_storage["Persistence"]
  node_model_records["Domain records"]
  node_sqlite[("SQLite database")]
end

node_operator(("Operator"))

node_operator -->|"uses"| node_dashboard
node_dashboard -->|"calls"| node_client
node_client -->|"sends HTTP"| node_rest
node_rest -->|"routes"| node_users
node_rest -->|"routes"| node_stations
node_rest -->|"routes"| node_telemetry
node_rest -->|"routes"| node_maintenance
node_rest -->|"routes"| node_operations
node_rest -->|"routes"| node_prediction_api
node_users -->|"validates with"| node_schemas
node_stations -->|"validates with"| node_schemas
node_telemetry -->|"validates with"| node_schemas
node_maintenance -->|"validates with"| node_schemas
node_prediction_api -->|"validates with"| node_schemas
node_users -->|"queries and writes"| node_model_records
node_stations -->|"queries and writes"| node_model_records
node_telemetry -->|"queries and writes"| node_model_records
node_maintenance -->|"queries and writes"| node_model_records
node_operations -->|"queries and writes"| node_model_records
node_prediction_api -->|"saves result"| node_model_records
node_model_records -->|"uses database base"| node_sqlite
node_rest -->|"creates schema and sessions"| node_sqlite
node_prediction_api -->|"requests prediction"| node_predictor

click node_dashboard "https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/frontend/dashboard.py"
click node_client "https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/frontend/api.py"
click node_rest "https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/main.py"
click node_users "https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/main.py"
click node_stations "https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/main.py"
click node_telemetry "https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/main.py"
click node_maintenance "https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/main.py"
click node_operations "https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/main.py"
click node_schemas "https://github.com/godlinspshanya/ev-health-monitoring-system/tree/main/backend/schemas"
click node_model_records "https://github.com/godlinspshanya/ev-health-monitoring-system/tree/main/backend/models"
click node_sqlite "https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/predictive_maintenance_process.db"
click node_prediction_api "https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/main.py"
click node_predictor "https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/ml/predict.py"
click node_training "https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/ml/train_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_dashboard,node_client toneBlue
class node_rest,node_users,node_stations,node_telemetry,node_maintenance,node_operations,node_schemas toneAmber
class node_prediction_api,node_predictor,node_training toneMint
class node_model_records,node_sqlite toneRose
class node_operator toneIndigo
```

## Components

### Operator interface

- [Health dashboard](https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/frontend/dashboard.py): `frontend/dashboard.py`
- [HTTP API client](https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/frontend/api.py): `frontend/api.py`

### Backend services

- [REST endpoints](https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/main.py): `backend/main.py`
- [User management](https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/main.py): `backend/main.py`
- [Station management](https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/main.py): `backend/main.py`
- [Telemetry records](https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/main.py): `backend/main.py`
- [Maintenance records](https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/main.py): `backend/main.py`
- [Operational records](https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/main.py): `backend/main.py`
- [Request schemas](https://github.com/godlinspshanya/ev-health-monitoring-system/tree/main/backend/schemas): `backend/schemas`

### Prediction

- [Prediction endpoint](https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/main.py): `backend/main.py`
- [Failure predictor](https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/ml/predict.py): `backend/ml/predict.py`
- [Model training](https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/backend/ml/train_model.py): `backend/ml/train_model.py`

### Persistence

- [Domain records](https://github.com/godlinspshanya/ev-health-monitoring-system/tree/main/backend/models): `backend/models`
- [SQLite database](https://github.com/godlinspshanya/ev-health-monitoring-system/blob/main/predictive_maintenance_process.db): `predictive_maintenance_process.db`

### Other components

- **Operator**

## Connections

- Operator → Health dashboard: uses
- Health dashboard → HTTP API client: calls (evidence: `frontend/dashboard.py`)
- HTTP API client → REST endpoints: sends HTTP (evidence: `frontend/api.py`)
- REST endpoints → User management: routes (evidence: `backend/main.py`)
- REST endpoints → Station management: routes (evidence: `backend/main.py`)
- REST endpoints → Telemetry records: routes (evidence: `backend/main.py`)
- REST endpoints → Maintenance records: routes (evidence: `backend/main.py`)
- REST endpoints → Operational records: routes (evidence: `backend/main.py`)
- REST endpoints → Prediction endpoint: routes (evidence: `backend/main.py`)
- User management → Request schemas: validates with (evidence: `backend/main.py`)
- Station management → Request schemas: validates with (evidence: `backend/main.py`)
- Telemetry records → Request schemas: validates with (evidence: `backend/main.py`)
- Maintenance records → Request schemas: validates with (evidence: `backend/main.py`)
- Prediction endpoint → Request schemas: validates with (evidence: `backend/main.py`)
- User management → Domain records: queries and writes (evidence: `backend/main.py`)
- Station management → Domain records: queries and writes (evidence: `backend/main.py`)
- Telemetry records → Domain records: queries and writes (evidence: `backend/main.py`)
- Maintenance records → Domain records: queries and writes (evidence: `backend/main.py`)
- Operational records → Domain records: queries and writes (evidence: `backend/main.py`)
- Prediction endpoint → Domain records: saves result (evidence: `backend/main.py`)
- Domain records → SQLite database: uses database base (evidence: `backend/models/alert.py`)
- REST endpoints → SQLite database: creates schema and sessions (evidence: `backend/main.py`)
- Prediction endpoint → Failure predictor: requests prediction (evidence: `backend/main.py`)
