# aryangiri03/carbonsense architecture

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

- Interactive diagram: https://gitdiagram.com/aryangiri03/carbonsense
- Repository: https://github.com/aryangiri03/carbonsense

## Overview

Carbon Sense is a vehicle-emissions awareness application. Its documented workflow runs from plate capture and fuel-entry through vehicle/visit data, emissions prediction and a personalized alert. The sampled Streamlit app directly connects to MongoDB and includes OCR and prediction-related logic; the README documents SMS delivery and Groq messaging. The camera utility is a separate camera-based recognizer in the sampled code. Some integrations and model details are documented but not fully visible in the excerpts.

Main entry points: [`app.py`](https://github.com/aryangiri03/carbonsense/blob/main/app.py) (Streamlit Dashboard), [`message.py`](https://github.com/aryangiri03/carbonsense/blob/main/message.py) (LLM Message), [`camera.py`](https://github.com/aryangiri03/carbonsense/blob/main/camera.py) (Camera Recognizer), [`models/Vehicle.js`](https://github.com/aryangiri03/carbonsense/blob/main/models/Vehicle.js) (Vehicle Records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Dashboard and Capture"]
  node_dashboard["Streamlit Dashboard<br/>[app.py]"]
  node_app_ocr["Plate OCR<br/>[app.py]"]
  node_camera["Camera Recognizer<br/>[camera.py]"]
end

subgraph group_emissions["Emissions and Alerts"]
  node_prediction["Emission Prediction<br/>[app.py]"]
  node_groq_message["LLM Message<br/>[message.py]"]
end

subgraph group_records["Vehicle Records"]
  node_vehicle["Vehicle Records<br/>[Vehicle.js]"]
  node_visits["Fuel Visits<br/>[PetrolPumpVisit.js]"]
  node_metrics["Monthly Metrics<br/>[VehicleMetrics.js]"]
  node_puc["PUC Certificates<br/>[PucDetails.js]"]
end

node_driver(("Driver"))
node_mongo[("MongoDB")]
node_groq{{"Groq LLM"}}
node_twilio{{"Twilio SMS"}}

node_driver -->|"uses"| node_dashboard
node_dashboard -->|"extracts plate"| node_app_ocr
node_driver -->|"scans plate"| node_camera
node_dashboard -->|"reads and writes"| node_mongo
node_dashboard -->|"prepares prediction"| node_prediction
node_dashboard -->|"generates message"| node_groq_message
node_groq_message -->|"invokes"| node_groq
node_dashboard -->|"sends alert"| node_twilio
node_dashboard -->|"uses vehicle details"| node_vehicle
node_dashboard -->|"tracks fuel visits"| node_visits
node_dashboard -->|"tracks metrics"| node_metrics
node_dashboard -->|"checks certificate"| node_puc

click node_dashboard "https://github.com/aryangiri03/carbonsense/blob/main/app.py"
click node_app_ocr "https://github.com/aryangiri03/carbonsense/blob/main/app.py"
click node_camera "https://github.com/aryangiri03/carbonsense/blob/main/camera.py"
click node_vehicle "https://github.com/aryangiri03/carbonsense/blob/main/models/Vehicle.js"
click node_visits "https://github.com/aryangiri03/carbonsense/blob/main/models/PetrolPumpVisit.js"
click node_metrics "https://github.com/aryangiri03/carbonsense/blob/main/models/VehicleMetrics.js"
click node_puc "https://github.com/aryangiri03/carbonsense/blob/main/models/PucDetails.js"
click node_prediction "https://github.com/aryangiri03/carbonsense/blob/main/app.py"
click node_groq_message "https://github.com/aryangiri03/carbonsense/blob/main/message.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_app_ocr,node_camera toneBlue
class node_prediction,node_groq_message,node_mongo toneAmber
class node_vehicle,node_visits,node_metrics,node_puc toneMint
class node_driver,node_groq,node_twilio toneIndigo
```

## Components

### Dashboard and Capture

- [Streamlit Dashboard](https://github.com/aryangiri03/carbonsense/blob/main/app.py): `app.py`
- [Plate OCR](https://github.com/aryangiri03/carbonsense/blob/main/app.py): `app.py`
- [Camera Recognizer](https://github.com/aryangiri03/carbonsense/blob/main/camera.py): `camera.py`

### Emissions and Alerts

- [Emission Prediction](https://github.com/aryangiri03/carbonsense/blob/main/app.py): `app.py`
- [LLM Message](https://github.com/aryangiri03/carbonsense/blob/main/message.py): `message.py`

### Vehicle Records

- [Vehicle Records](https://github.com/aryangiri03/carbonsense/blob/main/models/Vehicle.js): `models/Vehicle.js`
- [Fuel Visits](https://github.com/aryangiri03/carbonsense/blob/main/models/PetrolPumpVisit.js): `models/PetrolPumpVisit.js`
- [Monthly Metrics](https://github.com/aryangiri03/carbonsense/blob/main/models/VehicleMetrics.js): `models/VehicleMetrics.js`
- [PUC Certificates](https://github.com/aryangiri03/carbonsense/blob/main/models/PucDetails.js): `models/PucDetails.js`

### Other components

- **Driver**
- **MongoDB**
- **Groq LLM**
- **Twilio SMS**

## Connections

- Driver → Streamlit Dashboard: uses (evidence: `README.md`)
- Streamlit Dashboard → Plate OCR: extracts plate (evidence: `app.py`)
- Driver → Camera Recognizer: scans plate (evidence: `camera.py`)
- Streamlit Dashboard → MongoDB: reads and writes (evidence: `app.py`)
- Streamlit Dashboard → Emission Prediction: prepares prediction (evidence: `app.py`)
- Streamlit Dashboard → LLM Message: generates message (evidence: `README.md`)
- LLM Message → Groq LLM: invokes (evidence: `message.py`)
- Streamlit Dashboard → Twilio SMS: sends alert (evidence: `README.md`)
- Streamlit Dashboard → Vehicle Records: uses vehicle details (evidence: `README.md`)
- Streamlit Dashboard → Fuel Visits: tracks fuel visits (evidence: `README.md`)
- Streamlit Dashboard → Monthly Metrics: tracks metrics (evidence: `README.md`)
- Streamlit Dashboard → PUC Certificates: checks certificate (evidence: `app.py`)
