# eshita-shah1/byteforce-sih-final architecture

> Architecture diagram of the GitHub repository eshita-shah1/byteforce-sih-final, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eshita-shah1/byteforce-sih-final
- Repository: https://github.com/eshita-shah1/byteforce-sih-final

## Overview

ByteForce-SIH is a manganese-mining intelligence system with a React interface and a FastAPI backend. Its two principal analytical workflows are manganese prospectivity and production-shortfall prediction; the product also documents uploaded-GIS workflows, study-area data, live weather context, and administrative functions. The sampled frontend routes users among these views, while the backend registers the corresponding API routers and loads both model services at startup. The README identifies a frontend/backend route mismatch, so the HTTP connection is shown as dashed. Unsampled endpoint-to-service wiring is omitted.

Main entry points: [`backend/app/main.py`](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/main.py) (FastAPI app), [`frontend/src/App.tsx`](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/frontend/src/App.tsx) (Application shell), [`frontend/src/services/api.ts`](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/frontend/src/services/api.ts) (HTTP client), [`backend/app/services/feature_service.py`](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/feature_service.py) (Uploaded feature extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Frontend"]
  node_app["Application shell<br/>[App.tsx]"]
  node_authctx["Login state<br/>[AuthContext.tsx]"]
  node_views["Analysis views"]
  node_shortfallview["Shortfall view<br/>[ShortfallView.tsx]"]
  node_logsview["Logs and reports<br/>[LogsView.tsx]"]
  node_client["HTTP client<br/>[api.ts]"]
end

subgraph group_api["Backend API"]
  node_server["FastAPI app<br/>[main.py]"]
  node_authapi["Authentication API<br/>[auth.py]"]
  node_prospapi["Prospectivity API<br/>[prospectivity.py]"]
  node_shortapi["Shortfall API<br/>[shortfall.py]"]
  node_uploadapi["GIS upload API<br/>[upload.py]"]
  node_studyapi["Study-area API<br/>[study_area.py]"]
  node_envapi["Environment API<br/>[environment.py]"]
end

subgraph group_analysis["Mining Analysis"]
  node_model1["Prospectivity inference<br/>[model1_service.py]"]
  node_model2["Shortfall inference<br/>[model2_service.py]"]
  node_weather["Live weather client<br/>[weather_service.py]"]
end

subgraph group_data["Spatial Data"]
  node_features["Uploaded feature extraction<br/>[feature_service.py]"]
  node_uploads["Upload validation<br/>[upload_service.py]"]
  node_spatial["GIS data services<br/>[raster_service.py]"]
  node_vector["Vector data service<br/>[vector_service.py]"]
  node_csv["CSV data service<br/>[csv_service.py]"]
end

subgraph group_platform["Platform Services"]
  node_dbsession["Database sessions<br/>[database.py]"]
  node_dbmodels["Database models<br/>[models.py]"]
end

node_operator(("Mining user"))
node_postgres[("PostGIS database")]
node_meteo["Open-Meteo"]

node_operator -->|"uses"| node_app
node_app -->|"reads state"| node_authctx
node_app -->|"renders"| node_views
node_app -->|"renders"| node_shortfallview
node_app -->|"renders"| node_logsview
node_authctx -->|"calls login"| node_client
node_views -.->|"requests analysis"| node_client
node_shortfallview -.->|"requests prediction"| node_client
node_logsview -.->|"requests records"| node_client
node_client -.->|"HTTP routes mismatch"| node_server
node_server -->|"registers"| node_authapi
node_server -->|"registers"| node_prospapi
node_server -->|"registers"| node_shortapi
node_server -->|"registers"| node_uploadapi
node_server -->|"registers"| node_studyapi
node_server -->|"registers"| node_envapi
node_server -->|"loads at startup"| node_model1
node_server -->|"loads at startup"| node_model2
node_uploads -->|"inspects rasters"| node_spatial
node_uploads -->|"inspects vectors"| node_vector
node_uploads -->|"inspects tables"| node_csv
node_features -->|"reads raster data"| node_spatial
node_features -->|"extracts attributes"| node_vector
node_features -->|"extracts rows"| node_csv
node_weather -->|"fetches observations"| node_meteo
node_dbsession -->|"opens sessions"| node_postgres
node_dbmodels -->|"maps records"| node_postgres

click node_app "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/frontend/src/App.tsx"
click node_authctx "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/frontend/src/context/AuthContext.tsx"
click node_views "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/frontend/src/views/ProspectivityView.tsx"
click node_shortfallview "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/frontend/src/views/ShortfallView.tsx"
click node_logsview "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/frontend/src/views/LogsView.tsx"
click node_client "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/frontend/src/services/api.ts"
click node_server "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/main.py"
click node_authapi "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/api/auth.py"
click node_prospapi "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/api/prospectivity.py"
click node_shortapi "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/api/shortfall.py"
click node_uploadapi "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/api/upload.py"
click node_studyapi "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/api/study_area.py"
click node_envapi "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/api/environment.py"
click node_model1 "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/model1_service.py"
click node_model2 "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/model2_service.py"
click node_features "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/feature_service.py"
click node_uploads "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/upload_service.py"
click node_spatial "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/raster_service.py"
click node_vector "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/vector_service.py"
click node_csv "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/csv_service.py"
click node_weather "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/weather_service.py"
click node_dbsession "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/db/database.py"
click node_dbmodels "https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/db/models.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_authctx,node_views,node_shortfallview,node_logsview,node_client,node_operator toneBlue
class node_server,node_authapi,node_prospapi,node_shortapi,node_uploadapi,node_studyapi,node_envapi,node_postgres toneAmber
class node_model1,node_model2,node_weather toneMint
class node_features,node_uploads,node_spatial,node_vector,node_csv toneRose
class node_dbsession,node_dbmodels,node_meteo toneIndigo
```

## Components

### Frontend

- [Application shell](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Login state](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Analysis views](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/frontend/src/views/ProspectivityView.tsx): `frontend/src/views/ProspectivityView.tsx`
- [Shortfall view](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/frontend/src/views/ShortfallView.tsx): `frontend/src/views/ShortfallView.tsx`
- [Logs and reports](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/frontend/src/views/LogsView.tsx): `frontend/src/views/LogsView.tsx`
- [HTTP client](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Backend API

- [FastAPI app](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication API](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Prospectivity API](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/api/prospectivity.py): `backend/app/api/prospectivity.py`
- [Shortfall API](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/api/shortfall.py): `backend/app/api/shortfall.py`
- [GIS upload API](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/api/upload.py): `backend/app/api/upload.py`
- [Study-area API](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/api/study_area.py): `backend/app/api/study_area.py`
- [Environment API](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/api/environment.py): `backend/app/api/environment.py`

### Mining Analysis

- [Prospectivity inference](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/model1_service.py): `backend/app/services/model1_service.py`
- [Shortfall inference](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/model2_service.py): `backend/app/services/model2_service.py`
- [Live weather client](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/weather_service.py): `backend/app/services/weather_service.py`

### Spatial Data

- [Uploaded feature extraction](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/feature_service.py): `backend/app/services/feature_service.py`
- [Upload validation](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/upload_service.py): `backend/app/services/upload_service.py`
- [GIS data services](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/raster_service.py): `backend/app/services/raster_service.py`
- [Vector data service](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/vector_service.py): `backend/app/services/vector_service.py`
- [CSV data service](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/services/csv_service.py): `backend/app/services/csv_service.py`

### Platform Services

- [Database sessions](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/db/database.py): `backend/app/db/database.py`
- [Database models](https://github.com/eshita-shah1/byteforce-sih-final/blob/main/backend/app/db/models.py): `backend/app/db/models.py`

### Other components

- **Mining user**
- **PostGIS database**
- **Open-Meteo**

## Connections

- Mining user → Application shell: uses
- Application shell → Login state: reads state
- Application shell → Analysis views: renders
- Application shell → Shortfall view: renders
- Application shell → Logs and reports: renders
- Login state → HTTP client: calls login
- Analysis views → HTTP client: requests analysis
- Shortfall view → HTTP client: requests prediction
- Logs and reports → HTTP client: requests records
- HTTP client → FastAPI app: HTTP routes mismatch
- FastAPI app → Authentication API: registers
- FastAPI app → Prospectivity API: registers
- FastAPI app → Shortfall API: registers
- FastAPI app → GIS upload API: registers
- FastAPI app → Study-area API: registers
- FastAPI app → Environment API: registers
- FastAPI app → Prospectivity inference: loads at startup
- FastAPI app → Shortfall inference: loads at startup
- Upload validation → GIS data services: inspects rasters
- Upload validation → Vector data service: inspects vectors
- Upload validation → CSV data service: inspects tables
- Uploaded feature extraction → GIS data services: reads raster data
- Uploaded feature extraction → Vector data service: extracts attributes
- Uploaded feature extraction → CSV data service: extracts rows
- Live weather client → Open-Meteo: fetches observations
- Database sessions → PostGIS database: opens sessions
- Database models → PostGIS database: maps records
