# amansingh9931/ibm_hackathon architecture

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

- Interactive diagram: https://gitdiagram.com/amansingh9931/ibm_hackathon
- Repository: https://github.com/amansingh9931/ibm_hackathon

## Overview

GramSwasthya is a village and district health-intelligence dashboard. A health-program user selects a location and explores dashboard metrics, village profiles, risk maps, priorities, trends, and risk predictions; the frontend context loads location and dashboard data through API clients, while backend routes dispatch requests to controllers that shape dataset-backed analytics. Separate intervention and ML capabilities are also represented. Evidence is limited to the supplied excerpts and SOURCE INDEX; the Python ML service’s runtime connection is not shown.

Main entry points: [`frontend/src/App.jsx`](https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/App.jsx) (Dashboard app), [`frontend/src/context/LocationContext.jsx`](https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/context/LocationContext.jsx) (Location state), [`backend/routes/apiRoutes.js`](https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/routes/apiRoutes.js) (API routes), [`backend/controllers/mlController.js`](https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/controllers/mlController.js) (ML controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Dashboard experience"]
  node_app["Dashboard app<br/>[App.jsx]"]
  node_location_context["Location state"]
  node_overview["Overview dashboard"]
  node_district_dashboard["District dashboard"]
  node_village_profile["Village profile"]
  node_risk_map["Interactive risk map"]
  node_priority_planner["Priority planner"]
  node_trends["Trends and forecast"]
  node_ai_interventions["Intervention engine"]
  node_ai_risk["AI risk view"]
end

subgraph group_api["API and orchestration"]
  node_frontend_api["API clients"]
  node_axios_client["HTTP client<br/>[axiosClient.js]"]
  node_server["HTTP server<br/>[server.js]"]
  node_api_routes["API routes<br/>[apiRoutes.js]"]
  node_ml_routes["ML routes<br/>[mlRoutes.js]"]
  node_location_controller["Location lookup"]
  node_health_controller["Health records"]
  node_recommendation_controller["Recommendations"]
  node_ai_controller["Risk predictions<br/>[aiController.js]"]
  node_ml_controller["ML controller<br/>[mlController.js]"]
end

subgraph group_intelligence["Health intelligence"]
  node_analytics["Health analytics<br/>[analyticsEngine.js]"]
  node_health_data["Village health data"]
  node_dataset_loader["Government data loader<br/>[datasetLoader.js]"]
end

subgraph group_ml["ML capabilities"]
  node_ml_service["ML service adapter<br/>[mlService.js]"]
  node_python_ml["Python prediction service<br/>[app.py]"]
end

node_program_user(("Program user"))

node_program_user -->|"uses"| node_app
node_app -->|"provides state"| node_location_context
node_app -->|"renders"| node_overview
node_app -->|"renders"| node_district_dashboard
node_app -->|"renders"| node_village_profile
node_app -->|"renders"| node_risk_map
node_app -->|"renders"| node_priority_planner
node_app -->|"renders"| node_trends
node_app -->|"renders"| node_ai_interventions
node_app -->|"renders"| node_ai_risk
node_location_context -->|"loads location data"| node_frontend_api
node_overview -->|"reads state"| node_location_context
node_overview -->|"requests risk data"| node_frontend_api
node_district_dashboard -->|"reads state"| node_location_context
node_village_profile -->|"reads state"| node_location_context
node_risk_map -->|"reads state"| node_location_context
node_priority_planner -->|"reads state"| node_location_context
node_priority_planner -->|"requests priorities"| node_frontend_api
node_trends -->|"requests trends"| node_frontend_api
node_ai_interventions -->|"reads state"| node_location_context
node_ai_risk -->|"reads state"| node_location_context
node_frontend_api -->|"uses HTTP client"| node_axios_client
node_axios_client -.->|"sends API requests"| node_server
node_server -->|"mounts routes"| node_api_routes
node_api_routes -->|"dispatches locations"| node_location_controller
node_api_routes -->|"dispatches health queries"| node_health_controller
node_api_routes -->|"dispatches recommendations"| node_recommendation_controller
node_api_routes -->|"dispatches predictions"| node_ai_controller
node_api_routes -->|"dispatches map requests"| node_ml_controller
node_api_routes -->|"mounts ML routes"| node_ml_routes
node_ml_routes -->|"dispatches ML queries"| node_ml_controller
node_location_controller -->|"reads locations"| node_health_data
node_location_controller -->|"looks up districts"| node_dataset_loader
node_health_controller -->|"reads health records"| node_health_data
node_health_controller -->|"calculates metrics"| node_analytics
node_health_controller -->|"loads dataset records"| node_dataset_loader
node_recommendation_controller -->|"reads village data"| node_health_data
node_recommendation_controller -->|"generates recommendations"| node_analytics
node_ai_controller -->|"reads village data"| node_health_data
node_ai_controller -->|"calculates risk"| node_analytics
node_ml_controller -->|"requests inference"| node_ml_service
node_ml_controller -->|"calculates risk metrics"| node_analytics
node_ml_controller -->|"reads village data"| node_health_data
node_ml_controller -->|"loads district data"| node_dataset_loader
node_ml_service -.->|"may call service"| node_python_ml

click node_app "https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/App.jsx"
click node_location_context "https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/context/LocationContext.jsx"
click node_overview "https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/OverviewDashboard.jsx"
click node_district_dashboard "https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/DistrictDashboard.jsx"
click node_village_profile "https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/VillageHealthProfile.jsx"
click node_risk_map "https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/InteractiveRiskMap.jsx"
click node_priority_planner "https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/PriorityPlanner.jsx"
click node_trends "https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/TrendsAndForecast.jsx"
click node_ai_interventions "https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/AIInterventionEngine.jsx"
click node_ai_risk "https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/AIRiskPrediction.jsx"
click node_frontend_api "https://github.com/amansingh9931/ibm_hackathon/tree/main/frontend/src/api"
click node_axios_client "https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/api/axiosClient.js"
click node_server "https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/server.js"
click node_api_routes "https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/routes/apiRoutes.js"
click node_ml_routes "https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/routes/mlRoutes.js"
click node_location_controller "https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/controllers/locationController.js"
click node_health_controller "https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/controllers/healthRecordController.js"
click node_recommendation_controller "https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/controllers/recommendationController.js"
click node_ai_controller "https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/controllers/aiController.js"
click node_ml_controller "https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/controllers/mlController.js"
click node_analytics "https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/services/analyticsEngine.js"
click node_health_data "https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/services/gramSwasthyaData.js"
click node_dataset_loader "https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/services/datasetLoader.js"
click node_ml_service "https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/services/mlService.js"
click node_python_ml "https://github.com/amansingh9931/ibm_hackathon/blob/main/ml/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_location_context,node_overview,node_district_dashboard,node_village_profile,node_risk_map,node_priority_planner,node_trends,node_ai_interventions,node_ai_risk,node_program_user toneBlue
class node_frontend_api,node_axios_client,node_server,node_api_routes,node_ml_routes,node_location_controller,node_health_controller,node_recommendation_controller,node_ai_controller,node_ml_controller toneAmber
class node_analytics,node_health_data,node_dataset_loader toneMint
class node_ml_service,node_python_ml toneRose
```

## Components

### Dashboard experience

- [Dashboard app](https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Location state](https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/context/LocationContext.jsx): `frontend/src/context/LocationContext.jsx`
- [Overview dashboard](https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/OverviewDashboard.jsx): `frontend/src/components/modules/OverviewDashboard.jsx`
- [District dashboard](https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/DistrictDashboard.jsx): `frontend/src/components/modules/DistrictDashboard.jsx`
- [Village profile](https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/VillageHealthProfile.jsx): `frontend/src/components/modules/VillageHealthProfile.jsx`
- [Interactive risk map](https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/InteractiveRiskMap.jsx): `frontend/src/components/modules/InteractiveRiskMap.jsx`
- [Priority planner](https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/PriorityPlanner.jsx): `frontend/src/components/modules/PriorityPlanner.jsx`
- [Trends and forecast](https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/TrendsAndForecast.jsx): `frontend/src/components/modules/TrendsAndForecast.jsx`
- [Intervention engine](https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/AIInterventionEngine.jsx): `frontend/src/components/modules/AIInterventionEngine.jsx`
- [AI risk view](https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/components/modules/AIRiskPrediction.jsx): `frontend/src/components/modules/AIRiskPrediction.jsx`

### API and orchestration

- [API clients](https://github.com/amansingh9931/ibm_hackathon/tree/main/frontend/src/api): `frontend/src/api`
- [HTTP client](https://github.com/amansingh9931/ibm_hackathon/blob/main/frontend/src/api/axiosClient.js): `frontend/src/api/axiosClient.js`
- [HTTP server](https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/server.js): `backend/server.js`
- [API routes](https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/routes/apiRoutes.js): `backend/routes/apiRoutes.js`
- [ML routes](https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/routes/mlRoutes.js): `backend/routes/mlRoutes.js`
- [Location lookup](https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/controllers/locationController.js): `backend/controllers/locationController.js`
- [Health records](https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/controllers/healthRecordController.js): `backend/controllers/healthRecordController.js`
- [Recommendations](https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/controllers/recommendationController.js): `backend/controllers/recommendationController.js`
- [Risk predictions](https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/controllers/aiController.js): `backend/controllers/aiController.js`
- [ML controller](https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/controllers/mlController.js): `backend/controllers/mlController.js`

### Health intelligence

- [Health analytics](https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/services/analyticsEngine.js): `backend/services/analyticsEngine.js`
- [Village health data](https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/services/gramSwasthyaData.js): `backend/services/gramSwasthyaData.js`
- [Government data loader](https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/services/datasetLoader.js): `backend/services/datasetLoader.js`

### ML capabilities

- [ML service adapter](https://github.com/amansingh9931/ibm_hackathon/blob/main/backend/services/mlService.js): `backend/services/mlService.js`
- [Python prediction service](https://github.com/amansingh9931/ibm_hackathon/blob/main/ml/app.py): `ml/app.py`

### Other components

- **Program user**

## Connections

- Program user → Dashboard app: uses (evidence: `frontend/src/App.jsx`)
- Dashboard app → Location state: provides state (evidence: `frontend/src/App.jsx`)
- Dashboard app → Overview dashboard: renders (evidence: `frontend/src/App.jsx`)
- Dashboard app → District dashboard: renders (evidence: `frontend/src/App.jsx`)
- Dashboard app → Village profile: renders (evidence: `frontend/src/App.jsx`)
- Dashboard app → Interactive risk map: renders (evidence: `frontend/src/App.jsx`)
- Dashboard app → Priority planner: renders (evidence: `frontend/src/App.jsx`)
- Dashboard app → Trends and forecast: renders (evidence: `frontend/src/App.jsx`)
- Dashboard app → Intervention engine: renders (evidence: `frontend/src/App.jsx`)
- Dashboard app → AI risk view: renders (evidence: `frontend/src/App.jsx`)
- Location state → API clients: loads location data (evidence: `frontend/src/context/LocationContext.jsx`)
- Overview dashboard → Location state: reads state (evidence: `frontend/src/components/modules/OverviewDashboard.jsx`)
- Overview dashboard → API clients: requests risk data (evidence: `frontend/src/components/modules/OverviewDashboard.jsx`)
- District dashboard → Location state: reads state (evidence: `frontend/src/components/modules/DistrictDashboard.jsx`)
- Village profile → Location state: reads state (evidence: `frontend/src/components/modules/VillageHealthProfile.jsx`)
- Interactive risk map → Location state: reads state (evidence: `frontend/src/components/modules/InteractiveRiskMap.jsx`)
- Priority planner → Location state: reads state (evidence: `frontend/src/components/modules/PriorityPlanner.jsx`)
- Priority planner → API clients: requests priorities (evidence: `frontend/src/components/modules/PriorityPlanner.jsx`)
- Trends and forecast → API clients: requests trends (evidence: `frontend/src/components/modules/TrendsAndForecast.jsx`)
- Intervention engine → Location state: reads state (evidence: `frontend/src/components/modules/AIInterventionEngine.jsx`)
- AI risk view → Location state: reads state (evidence: `frontend/src/components/modules/AIRiskPrediction.jsx`)
- API clients → HTTP client: uses HTTP client (evidence: `frontend/src/api/dashboard.js`)
- HTTP client → HTTP server: sends API requests
- HTTP server → API routes: mounts routes (evidence: `backend/server.js`)
- API routes → Location lookup: dispatches locations (evidence: `backend/routes/apiRoutes.js`)
- API routes → Health records: dispatches health queries (evidence: `backend/routes/apiRoutes.js`)
- API routes → Recommendations: dispatches recommendations (evidence: `backend/routes/apiRoutes.js`)
- API routes → Risk predictions: dispatches predictions (evidence: `backend/routes/apiRoutes.js`)
- API routes → ML controller: dispatches map requests (evidence: `backend/routes/apiRoutes.js`)
- API routes → ML routes: mounts ML routes (evidence: `backend/routes/apiRoutes.js`)
- ML routes → ML controller: dispatches ML queries (evidence: `backend/routes/mlRoutes.js`)
- Location lookup → Village health data: reads locations (evidence: `backend/controllers/locationController.js`)
- Location lookup → Government data loader: looks up districts (evidence: `backend/controllers/locationController.js`)
- Health records → Village health data: reads health records (evidence: `backend/controllers/healthRecordController.js`)
- Health records → Health analytics: calculates metrics (evidence: `backend/controllers/healthRecordController.js`)
- Health records → Government data loader: loads dataset records (evidence: `backend/controllers/healthRecordController.js`)
- Recommendations → Village health data: reads village data (evidence: `backend/controllers/recommendationController.js`)
- Recommendations → Health analytics: generates recommendations (evidence: `backend/controllers/recommendationController.js`)
- Risk predictions → Village health data: reads village data (evidence: `backend/controllers/aiController.js`)
- Risk predictions → Health analytics: calculates risk (evidence: `backend/controllers/aiController.js`)
- ML controller → ML service adapter: requests inference (evidence: `backend/controllers/mlController.js`)
- ML controller → Health analytics: calculates risk metrics (evidence: `backend/controllers/mlController.js`)
- ML controller → Village health data: reads village data (evidence: `backend/controllers/mlController.js`)
- ML controller → Government data loader: loads district data (evidence: `backend/controllers/mlController.js`)
- ML service adapter → Python prediction service: may call service
