# athang0x/eviq architecture

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

- Interactive diagram: https://gitdiagram.com/athang0x/eviq
- Repository: https://github.com/athang0x/eviq

## Overview

EVIQ is a prototype EV range and energy-analytics platform. Its primary workflow sends vehicle conditions or telemetry from the frontend to the FastAPI API, which derives features when needed and uses the range engine to estimate consumption and remaining range. Analysis adds efficiency breakdowns and speed curves; journey insights compare range with destination distance and return coaching, optionally phrased by Gemini. The backend also exposes model information and demo-trip data, while a separate training pipeline builds the inference models. Frontend source was not sampled, so its feature components and wiring are represented only at the documented subsystem level.

Main entry points: [`backend/app.py`](https://github.com/athang0x/eviq/blob/main/backend/app.py) (FastAPI endpoints), [`backend/model_core.py`](https://github.com/athang0x/eviq/blob/main/backend/model_core.py) (Prediction and analysis), [`backend/insight.py`](https://github.com/athang0x/eviq/blob/main/backend/insight.py) (Journey facts and coaching), [`backend/train.py`](https://github.com/athang0x/eviq/blob/main/backend/train.py) (Model training and evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Driver interface"]
  node_frontend["Dashboard and trip UI"]
end

subgraph group_api["API and journeys"]
  node_api_app["FastAPI endpoints<br/>[app.py]"]
  node_demo["Demo telemetry<br/>[demo_trip.py]"]
end

subgraph group_inference["Range intelligence"]
  node_telemetry["Telemetry features<br/>[model_core.py]"]
  node_engine["Prediction and analysis<br/>[model_core.py]"]
  node_vehicle["Vehicle features and assumptions<br/>[vehicle.py]"]
  node_insights["Journey facts and coaching<br/>[insight.py]"]
end

subgraph group_training["Model pipeline"]
  node_simulator["Driving simulator<br/>[simulator.py]"]
  node_trainer["Model training and evaluation<br/>[train.py]"]
end

node_driver(("EV driver"))
node_gemini["Gemini API"]

node_driver -->|"uses"| node_frontend
node_frontend -->|"sends API requests"| node_api_app
node_api_app -->|"derives features"| node_telemetry
node_api_app -->|"requests predictions"| node_engine
node_api_app -->|"requests coaching"| node_insights
node_api_app -->|"returns trip data"| node_demo
node_insights -->|"computes range facts"| node_engine
node_insights -->|"requests phrasing"| node_gemini
node_engine -->|"uses feature definitions"| node_vehicle
node_simulator -->|"uses vehicle schema"| node_vehicle
node_trainer -->|"generates training data"| node_simulator
node_trainer -->|"produces inference model"| node_engine

click node_frontend "https://github.com/athang0x/eviq/tree/main/frontend"
click node_api_app "https://github.com/athang0x/eviq/blob/main/backend/app.py"
click node_demo "https://github.com/athang0x/eviq/blob/main/backend/demo_trip.py"
click node_telemetry "https://github.com/athang0x/eviq/blob/main/backend/model_core.py"
click node_engine "https://github.com/athang0x/eviq/blob/main/backend/model_core.py"
click node_vehicle "https://github.com/athang0x/eviq/blob/main/backend/vehicle.py"
click node_insights "https://github.com/athang0x/eviq/blob/main/backend/insight.py"
click node_simulator "https://github.com/athang0x/eviq/blob/main/backend/simulator.py"
click node_trainer "https://github.com/athang0x/eviq/blob/main/backend/train.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_frontend toneBlue
class node_api_app,node_demo toneAmber
class node_telemetry,node_engine,node_vehicle,node_insights,node_gemini toneMint
class node_simulator,node_trainer toneRose
class node_driver toneIndigo
```

## Components

### Driver interface

- [Dashboard and trip UI](https://github.com/athang0x/eviq/tree/main/frontend): `frontend`

### API and journeys

- [FastAPI endpoints](https://github.com/athang0x/eviq/blob/main/backend/app.py): `backend/app.py`
- [Demo telemetry](https://github.com/athang0x/eviq/blob/main/backend/demo_trip.py): `backend/demo_trip.py`

### Range intelligence

- [Telemetry features](https://github.com/athang0x/eviq/blob/main/backend/model_core.py): `backend/model_core.py`
- [Prediction and analysis](https://github.com/athang0x/eviq/blob/main/backend/model_core.py): `backend/model_core.py`
- [Vehicle features and assumptions](https://github.com/athang0x/eviq/blob/main/backend/vehicle.py): `backend/vehicle.py`
- [Journey facts and coaching](https://github.com/athang0x/eviq/blob/main/backend/insight.py): `backend/insight.py`

### Model pipeline

- [Driving simulator](https://github.com/athang0x/eviq/blob/main/backend/simulator.py): `backend/simulator.py`
- [Model training and evaluation](https://github.com/athang0x/eviq/blob/main/backend/train.py): `backend/train.py`

### Other components

- **EV driver**
- **Gemini API**

## Connections

- EV driver → Dashboard and trip UI: uses (evidence: `README.md`)
- Dashboard and trip UI → FastAPI endpoints: sends API requests (evidence: `README.md`)
- FastAPI endpoints → Telemetry features: derives features (evidence: `backend/app.py`)
- FastAPI endpoints → Prediction and analysis: requests predictions (evidence: `backend/app.py`)
- FastAPI endpoints → Journey facts and coaching: requests coaching (evidence: `backend/app.py`)
- FastAPI endpoints → Demo telemetry: returns trip data (evidence: `backend/app.py`)
- Journey facts and coaching → Prediction and analysis: computes range facts (evidence: `backend/insight.py`)
- Journey facts and coaching → Gemini API: requests phrasing (evidence: `backend/insight.py`)
- Prediction and analysis → Vehicle features and assumptions: uses feature definitions (evidence: `backend/model_core.py`)
- Driving simulator → Vehicle features and assumptions: uses vehicle schema (evidence: `backend/simulator.py`)
- Model training and evaluation → Driving simulator: generates training data (evidence: `backend/train.py`)
- Model training and evaluation → Prediction and analysis: produces inference model (evidence: `README.md`)
