# samalswastik781-tech/ecosense-ai architecture

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

- Interactive diagram: https://gitdiagram.com/samalswastik781-tech/ecosense-ai
- Repository: https://github.com/samalswastik781-tech/ecosense-ai

## Overview

EcoSense AI is a Streamlit facility-sustainability dashboard. A user selects a facility and can enable a demo anomaly; the app processes resource readings, then presents facility health, anomaly insights, comparisons, trends, recommendations, and estimated emissions. The sampled app excerpt shows calls to the demo, anomaly, scoring, and recommendation modules, while the CSV’s loading path is not shown. Dashboard sections and the emissions calculation are implemented in app.py; unsampled details are not inferred.

Main entry points: [`app.py`](https://github.com/samalswastik781-tech/ecosense-ai/blob/main/app.py) (Streamlit app), [`demo_mode.py`](https://github.com/samalswastik781-tech/ecosense-ai/blob/main/demo_mode.py) (Demo anomaly), [`models/anomaly_detection.py`](https://github.com/samalswastik781-tech/ecosense-ai/blob/main/models/anomaly_detection.py) (Anomaly detection), [`sustainability_score.py`](https://github.com/samalswastik781-tech/ecosense-ai/blob/main/sustainability_score.py) (Sustainability scoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Analysis workflow"]
  node_app["Streamlit app<br/>[app.py]"]
  node_demo["Demo anomaly<br/>[demo_mode.py]"]
  node_detection["Anomaly detection"]
end

subgraph group_insights["Facility insights"]
  node_scoring["Sustainability scoring"]
  node_recommendations["Recommendations"]
end

subgraph group_dashboard["Dashboard outputs"]
  node_facility_health["Facility health<br/>[app.py]"]
  node_anomaly_insights["Anomaly insights<br/>[app.py]"]
  node_facility_comparison["Facility comparison<br/>[app.py]"]
  node_resource_trends["Resource trends<br/>[app.py]"]
  node_emissions["Carbon calculator<br/>[app.py]"]
end

node_user(("Facility user"))

node_user -->|"uses"| node_app
node_app -->|"creates demo spike"| node_demo
node_app -->|"detects anomalies"| node_detection
node_app -->|"calculates score"| node_scoring
node_app -->|"generates advice"| node_recommendations
node_app -->|"renders"| node_facility_health
node_app -->|"renders"| node_anomaly_insights
node_app -->|"renders"| node_facility_comparison
node_app -->|"renders"| node_resource_trends
node_app -->|"calculates emissions"| node_emissions

click node_app "https://github.com/samalswastik781-tech/ecosense-ai/blob/main/app.py"
click node_demo "https://github.com/samalswastik781-tech/ecosense-ai/blob/main/demo_mode.py"
click node_detection "https://github.com/samalswastik781-tech/ecosense-ai/blob/main/models/anomaly_detection.py"
click node_scoring "https://github.com/samalswastik781-tech/ecosense-ai/blob/main/sustainability_score.py"
click node_recommendations "https://github.com/samalswastik781-tech/ecosense-ai/blob/main/recommendation_engine.py"
click node_facility_health "https://github.com/samalswastik781-tech/ecosense-ai/blob/main/app.py"
click node_anomaly_insights "https://github.com/samalswastik781-tech/ecosense-ai/blob/main/app.py"
click node_facility_comparison "https://github.com/samalswastik781-tech/ecosense-ai/blob/main/app.py"
click node_resource_trends "https://github.com/samalswastik781-tech/ecosense-ai/blob/main/app.py"
click node_emissions "https://github.com/samalswastik781-tech/ecosense-ai/blob/main/app.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_demo,node_detection,node_user toneBlue
class node_scoring,node_recommendations toneAmber
class node_facility_health,node_anomaly_insights,node_facility_comparison,node_resource_trends,node_emissions toneMint
```

## Components

### Analysis workflow

- [Streamlit app](https://github.com/samalswastik781-tech/ecosense-ai/blob/main/app.py): `app.py`
- [Demo anomaly](https://github.com/samalswastik781-tech/ecosense-ai/blob/main/demo_mode.py): `demo_mode.py`
- [Anomaly detection](https://github.com/samalswastik781-tech/ecosense-ai/blob/main/models/anomaly_detection.py): `models/anomaly_detection.py`

### Facility insights

- [Sustainability scoring](https://github.com/samalswastik781-tech/ecosense-ai/blob/main/sustainability_score.py): `sustainability_score.py`
- [Recommendations](https://github.com/samalswastik781-tech/ecosense-ai/blob/main/recommendation_engine.py): `recommendation_engine.py`

### Dashboard outputs

- [Facility health](https://github.com/samalswastik781-tech/ecosense-ai/blob/main/app.py): `app.py`
- [Anomaly insights](https://github.com/samalswastik781-tech/ecosense-ai/blob/main/app.py): `app.py`
- [Facility comparison](https://github.com/samalswastik781-tech/ecosense-ai/blob/main/app.py): `app.py`
- [Resource trends](https://github.com/samalswastik781-tech/ecosense-ai/blob/main/app.py): `app.py`
- [Carbon calculator](https://github.com/samalswastik781-tech/ecosense-ai/blob/main/app.py): `app.py`

### Other components

- **Facility user**

## Connections

- Facility user → Streamlit app: uses (evidence: `app.py`)
- Streamlit app → Demo anomaly: creates demo spike (evidence: `app.py`)
- Streamlit app → Anomaly detection: detects anomalies (evidence: `app.py`)
- Streamlit app → Sustainability scoring: calculates score (evidence: `app.py`)
- Streamlit app → Recommendations: generates advice (evidence: `app.py`)
- Streamlit app → Facility health: renders (evidence: `app.py`)
- Streamlit app → Anomaly insights: renders (evidence: `app.py`)
- Streamlit app → Facility comparison: renders (evidence: `app.py`)
- Streamlit app → Resource trends: renders (evidence: `app.py`)
- Streamlit app → Carbon calculator: calculates emissions (evidence: `app.py`)
