# swapnil-ghosh06/highoncaffeine architecture

> Architecture diagram of the GitHub repository swapnil-ghosh06/highoncaffeine, 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/swapnil-ghosh06/highoncaffeine
- Repository: https://github.com/swapnil-ghosh06/highoncaffeine

## Overview

THERMA is a shelter-design and thermal decision-support platform: operators configure a site and envelope in the browser, submit analyses through a FastAPI service, and review physics-based results, optimization, diagnosis, and operational recommendations. The documented product also includes estate/site management, weather intelligence, validation, surrogate-model prediction, and CPWD cost knowledge. The graph emphasizes relationships supported by the README or SOURCE INDEX; unsampled subsystems are represented by their exact tree paths, with uncertain internal wiring omitted.

Main entry points: [`api/main.py`](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/main.py) (REST orchestration), [`engine/optimizer.py`](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/optimizer.py) (Design optimizer), [`engine/solver.py`](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/solver.py) (Transient heat solver), [`api/cpwd/router.py`](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/cpwd/router.py) (CPWD knowledge API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Design and operations UI"]
  node_studio["Design studio<br/>[App.jsx]"]
  node_platform_ui["Estate platform"]
  node_report_ui["Results and reports"]
end

subgraph group_api["API and site services"]
  node_api_main["REST orchestration<br/>[main.py]"]
  node_site_services["Sites and weather<br/>[platform.py]"]
  node_weather["Weather service<br/>[weather.py]"]
  node_site_location["Location resolution<br/>[location.py]"]
  node_state_db[("Application database<br/>[db.py]")]
end

subgraph group_physics["Thermal analysis engine"]
  node_solver["Transient heat solver<br/>[solver.py]"]
  node_optimizer["Design optimizer<br/>[optimizer.py]"]
  node_sensitivity["Sensitivity analysis<br/>[sensitivity.py]"]
  node_diagnosis["Thermal diagnosis<br/>[diagnosis.py]"]
  node_whatif["What-if analysis<br/>[what_if.py]"]
  node_safety["Safety interlocks<br/>[safety.py]"]
  node_validation["Physics validation"]
end

subgraph group_knowledge["Materials and cost knowledge"]
  node_materials["Thermal materials<br/>[materials.py]"]
  node_material_suggestion["Material suggestions"]
  node_cpwd_api["CPWD knowledge API<br/>[router.py]"]
  node_cpwd_ingest["CPWD ingestion<br/>[ingest.py]"]
  node_cpwd_db[("CPWD search store<br/>[db.py]")]
end

subgraph group_ml["ML and prediction"]
  node_inference["Surrogate inference<br/>[inference.py]"]
  node_ml_router["ML prediction routes<br/>[ml_router.py]"]
  node_ollama["Ollama assistant<br/>[ollama_client.py]"]
end

node_operator(("Shelter operator"))

node_operator -->|"configures designs"| node_studio
node_operator -->|"manages sites"| node_platform_ui
node_studio -->|"submits analysis"| node_api_main
node_api_main -->|"runs simulation"| node_solver
node_api_main -->|"optimizes designs"| node_optimizer
node_api_main -->|"requests diagnosis"| node_diagnosis
node_api_main -->|"evaluates variants"| node_whatif
node_api_main -->|"checks safety"| node_safety
node_api_main -->|"uses weather"| node_weather
node_site_services -->|"persists site data"| node_state_db
node_weather -->|"caches weather"| node_state_db
node_site_location -->|"reads site data"| node_state_db
node_solver -->|"loads properties"| node_materials
node_solver -->|"is checked by"| node_validation
node_optimizer -->|"evaluates candidates"| node_solver
node_optimizer -->|"uses properties"| node_materials
node_optimizer -->|"uses screening"| node_sensitivity
node_material_suggestion -->|"inverts search"| node_optimizer
node_material_suggestion -->|"simulates designs"| node_solver
node_material_suggestion -->|"gets weather"| node_weather
node_cpwd_api -->|"triggers ingestion"| node_cpwd_ingest
node_cpwd_api -->|"queries records"| node_cpwd_db
node_cpwd_ingest -->|"stores records"| node_cpwd_db
node_cpwd_api -->|"routes thermal queries"| node_inference
node_cpwd_api -->|"uses assistant"| node_ollama
node_ml_router -->|"requests predictions"| node_inference
node_platform_ui -.->|"uses site services"| node_site_services
node_report_ui -.->|"presents results"| node_api_main

click node_studio "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/web/src/App.jsx"
click node_platform_ui "https://github.com/swapnil-ghosh06/highoncaffeine/tree/main/web/src/components/platform"
click node_report_ui "https://github.com/swapnil-ghosh06/highoncaffeine/tree/main/web/src/components/results"
click node_api_main "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/main.py"
click node_site_services "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/platform.py"
click node_weather "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/weather.py"
click node_site_location "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/location.py"
click node_state_db "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/db.py"
click node_solver "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/solver.py"
click node_optimizer "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/optimizer.py"
click node_sensitivity "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/sensitivity.py"
click node_diagnosis "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/diagnosis.py"
click node_whatif "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/what_if.py"
click node_safety "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/safety.py"
click node_materials "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/materials.py"
click node_material_suggestion "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/material_suggestion.py"
click node_cpwd_api "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/cpwd/router.py"
click node_cpwd_ingest "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/cpwd/ingest.py"
click node_cpwd_db "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/cpwd/db.py"
click node_inference "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/ml/inference.py"
click node_ml_router "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/ml_router.py"
click node_ollama "https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/cpwd/ollama_client.py"
click node_validation "https://github.com/swapnil-ghosh06/highoncaffeine/tree/main/validation"

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_studio,node_platform_ui,node_report_ui toneBlue
class node_api_main,node_site_services,node_weather,node_site_location,node_state_db toneAmber
class node_solver,node_optimizer,node_sensitivity,node_diagnosis,node_whatif,node_safety,node_validation toneMint
class node_materials,node_material_suggestion,node_cpwd_api,node_cpwd_ingest,node_cpwd_db toneRose
class node_inference,node_ml_router,node_ollama,node_operator toneIndigo
```

## Components

### Design and operations UI

- [Design studio](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/web/src/App.jsx): `web/src/App.jsx`
- [Estate platform](https://github.com/swapnil-ghosh06/highoncaffeine/tree/main/web/src/components/platform): `web/src/components/platform`
- [Results and reports](https://github.com/swapnil-ghosh06/highoncaffeine/tree/main/web/src/components/results): `web/src/components/results`

### API and site services

- [REST orchestration](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/main.py): `api/main.py`
- [Sites and weather](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/platform.py): `api/platform.py`
- [Weather service](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/weather.py): `api/weather.py`
- [Location resolution](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/location.py): `api/location.py`
- [Application database](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/db.py): `api/db.py`

### Thermal analysis engine

- [Transient heat solver](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/solver.py): `engine/solver.py`
- [Design optimizer](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/optimizer.py): `engine/optimizer.py`
- [Sensitivity analysis](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/sensitivity.py): `engine/sensitivity.py`
- [Thermal diagnosis](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/diagnosis.py): `engine/diagnosis.py`
- [What-if analysis](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/what_if.py): `engine/what_if.py`
- [Safety interlocks](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/safety.py): `engine/safety.py`
- [Physics validation](https://github.com/swapnil-ghosh06/highoncaffeine/tree/main/validation): `validation`

### Materials and cost knowledge

- [Thermal materials](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/materials.py): `engine/materials.py`
- [Material suggestions](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/engine/material_suggestion.py): `engine/material_suggestion.py`
- [CPWD knowledge API](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/cpwd/router.py): `api/cpwd/router.py`
- [CPWD ingestion](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/cpwd/ingest.py): `api/cpwd/ingest.py`
- [CPWD search store](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/cpwd/db.py): `api/cpwd/db.py`

### ML and prediction

- [Surrogate inference](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/ml/inference.py): `ml/inference.py`
- [ML prediction routes](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/ml_router.py): `api/ml_router.py`
- [Ollama assistant](https://github.com/swapnil-ghosh06/highoncaffeine/blob/main/api/cpwd/ollama_client.py): `api/cpwd/ollama_client.py`

### Other components

- **Shelter operator**

## Connections

- Shelter operator → Design studio: configures designs
- Shelter operator → Estate platform: manages sites
- Design studio → REST orchestration: submits analysis
- REST orchestration → Transient heat solver: runs simulation (evidence: `api/main.py`)
- REST orchestration → Design optimizer: optimizes designs (evidence: `api/main.py`)
- REST orchestration → Thermal diagnosis: requests diagnosis (evidence: `api/main.py`)
- REST orchestration → What-if analysis: evaluates variants (evidence: `api/main.py`)
- REST orchestration → Safety interlocks: checks safety (evidence: `api/main.py`)
- REST orchestration → Weather service: uses weather (evidence: `api/main.py`)
- Sites and weather → Application database: persists site data
- Weather service → Application database: caches weather (evidence: `api/weather.py`)
- Location resolution → Application database: reads site data (evidence: `api/location.py`)
- Transient heat solver → Thermal materials: loads properties (evidence: `engine/solver.py`)
- Transient heat solver → Physics validation: is checked by (evidence: `validation/run.py`)
- Design optimizer → Transient heat solver: evaluates candidates (evidence: `engine/optimizer.py`)
- Design optimizer → Thermal materials: uses properties (evidence: `engine/optimizer.py`)
- Design optimizer → Sensitivity analysis: uses screening (evidence: `engine/optimizer.py`)
- Material suggestions → Design optimizer: inverts search (evidence: `engine/material_suggestion.py`)
- Material suggestions → Transient heat solver: simulates designs (evidence: `engine/material_suggestion.py`)
- Material suggestions → Weather service: gets weather (evidence: `engine/material_suggestion.py`)
- CPWD knowledge API → CPWD ingestion: triggers ingestion (evidence: `api/cpwd/router.py`)
- CPWD knowledge API → CPWD search store: queries records (evidence: `api/cpwd/router.py`)
- CPWD ingestion → CPWD search store: stores records (evidence: `api/cpwd/ingest.py`)
- CPWD knowledge API → Surrogate inference: routes thermal queries (evidence: `api/cpwd/router.py`)
- CPWD knowledge API → Ollama assistant: uses assistant (evidence: `api/cpwd/router.py`)
- ML prediction routes → Surrogate inference: requests predictions (evidence: `api/ml_router.py`)
- Estate platform → Sites and weather: uses site services
- Results and reports → REST orchestration: presents results
