# aimlnitishkumar/predictive-green-energy-engine architecture

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

- Interactive diagram: https://gitdiagram.com/aimlnitishkumar/predictive-green-energy-engine
- Repository: https://github.com/aimlnitishkumar/predictive-green-energy-engine

## Overview

MRV CleanTech is a tenant-scoped energy monitoring and carbon-accounting platform. Meter readings enter through the FastAPI ingestion API, are stored with tenant and meter records, and feed interval matching and emissions calculations. The dashboard requests an overview from that API and displays energy metrics; Celery tasks can aggregate readings into daily and monthly reports. The README also identifies compliance, meter management, and reporting as command-center capabilities, though the sampled frontend excerpt shows those areas primarily as dashboard UI. Source excerpts do not establish the full service wiring or report-task dispatch.

Main entry points: [`ingestion/main.py`](https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/ingestion/main.py) (Overview API), [`mrv/tasks.py`](https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/mrv/tasks.py) (Carbon report task), [`config/settings.py`](https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/config/settings.py) (Django settings), [`frontend/src/App.tsx`](https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/frontend/src/App.tsx) (MRV dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_command["Command center"]
  node_app["MRV dashboard<br/>[App.tsx]"]
  node_entry["React entry<br/>[main.tsx]"]
end

subgraph group_api["Ingestion and API"]
  node_overview["Overview API<br/>[main.py]"]
  node_ingest["Reading ingestion<br/>[main.py]"]
end

subgraph group_domain["MRV domain"]
  node_mrvdata[("Tenant meter readings<br/>[models.py]")]
  node_carbon["Carbon calculations<br/>[services.py]"]
  node_reports["Carbon report task<br/>[tasks.py]"]
end

subgraph group_ops["Runtime configuration"]
  node_celery["Celery app<br/>[celery.py]"]
  node_settings["Django settings<br/>[settings.py]"]
end

node_user(("Workspace user"))
node_database[("PostgreSQL / TimescaleDB")]
node_redis["Redis broker/backend"]

node_user -->|"views"| node_app
node_entry -->|"renders"| node_app
node_app -->|"fetches overview"| node_overview
node_overview -->|"reads tenant readings"| node_mrvdata
node_overview -->|"calculates metrics"| node_carbon
node_ingest -->|"upserts readings"| node_mrvdata
node_ingest -->|"writes"| node_database
node_overview -->|"reads"| node_database
node_reports -->|"reads readings"| node_mrvdata
node_reports -->|"aggregates"| node_carbon
node_reports -->|"reads"| node_database
node_settings -->|"configures"| node_database
node_settings -->|"configures broker"| node_redis
node_celery -->|"loads configuration"| node_settings
node_celery -.->|"uses broker"| node_redis

click node_app "https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/frontend/src/App.tsx"
click node_entry "https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/frontend/src/main.tsx"
click node_overview "https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/ingestion/main.py"
click node_ingest "https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/ingestion/main.py"
click node_mrvdata "https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/mrv/models.py"
click node_carbon "https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/mrv/services.py"
click node_reports "https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/mrv/tasks.py"
click node_celery "https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/config/celery.py"
click node_settings "https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/config/settings.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_app,node_entry,node_user toneBlue
class node_overview,node_ingest,node_database,node_redis toneAmber
class node_mrvdata,node_carbon,node_reports toneMint
class node_celery,node_settings toneRose
```

## Components

### Command center

- [MRV dashboard](https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [React entry](https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/frontend/src/main.tsx): `frontend/src/main.tsx`

### Ingestion and API

- [Overview API](https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/ingestion/main.py): `ingestion/main.py`
- [Reading ingestion](https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/ingestion/main.py): `ingestion/main.py`

### MRV domain

- [Tenant meter readings](https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/mrv/models.py): `mrv/models.py`
- [Carbon calculations](https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/mrv/services.py): `mrv/services.py`
- [Carbon report task](https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/mrv/tasks.py): `mrv/tasks.py`

### Runtime configuration

- [Celery app](https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/config/celery.py): `config/celery.py`
- [Django settings](https://github.com/aimlnitishkumar/predictive-green-energy-engine/blob/main/config/settings.py): `config/settings.py`

### Other components

- **Workspace user**
- **PostgreSQL / TimescaleDB**
- **Redis broker/backend**

## Connections

- Workspace user → MRV dashboard: views (evidence: `README.md`)
- React entry → MRV dashboard: renders (evidence: `frontend/src/main.tsx`)
- MRV dashboard → Overview API: fetches overview (evidence: `frontend/src/App.tsx`)
- Overview API → Tenant meter readings: reads tenant readings (evidence: `ingestion/main.py`)
- Overview API → Carbon calculations: calculates metrics (evidence: `ingestion/main.py`)
- Reading ingestion → Tenant meter readings: upserts readings (evidence: `ingestion/main.py`)
- Reading ingestion → PostgreSQL / TimescaleDB: writes (evidence: `ingestion/main.py`)
- Overview API → PostgreSQL / TimescaleDB: reads (evidence: `ingestion/main.py`)
- Carbon report task → Tenant meter readings: reads readings (evidence: `mrv/tasks.py`)
- Carbon report task → Carbon calculations: aggregates (evidence: `mrv/tasks.py`)
- Carbon report task → PostgreSQL / TimescaleDB: reads (evidence: `mrv/tasks.py`)
- Django settings → PostgreSQL / TimescaleDB: configures (evidence: `config/settings.py`)
- Django settings → Redis broker/backend: configures broker (evidence: `config/settings.py`)
- Celery app → Django settings: loads configuration (evidence: `config/celery.py`)
- Celery app → Redis broker/backend: uses broker
