# rodrigoricky/bantayani architecture

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

- Interactive diagram: https://gitdiagram.com/rodrigoricky/bantayani
- Repository: https://github.com/rodrigoricky/bantayani

## Overview

Bantay Ani is a crop-monitoring and insurance-claims verification platform for municipal agricultural officers. Its main domain workflow collects farm and claim information, compares pre- and post-disaster satellite indicators, and presents claim decisions and reports. The graph also preserves the dashboard, satellite monitoring, role-based access, notifications, and chat capabilities named or represented in the repository. Backend routing and several service dependencies are supported by excerpts or the SOURCE INDEX; frontend-to-API wiring is not shown, so those links are omitted.

Main entry points: [`backend/main.py`](https://github.com/rodrigoricky/bantayani/blob/main/backend/main.py) (FastAPI application), [`backend/services/claim_service.py`](https://github.com/rodrigoricky/bantayani/blob/main/backend/services/claim_service.py) (Claim verification), [`backend/services/satellite_service.py`](https://github.com/rodrigoricky/bantayani/blob/main/backend/services/satellite_service.py) (Satellite processing), [`backend/utils/database.py`](https://github.com/rodrigoricky/bantayani/blob/main/backend/utils/database.py) (Database and demo data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_dashboard["Dashboard<br/>[page.js]"]
  node_farm_ui["Farm records<br/>[page.js]"]
  node_claims_ui["Claims<br/>[page.js]"]
  node_login_ui["Sign in<br/>[page.js]"]
  node_verification_ui["Verification result"]
  node_chat_ui["Chat assistant<br/>[ChatWidget.js]"]
  node_satellite_ui["Satellite imagery panel"]
end

subgraph group_api["API routes"]
  node_auth_api["Authentication API<br/>[auth.py]"]
  node_farm_api["Farm API<br/>[farms.py]"]
  node_claim_api["Claims API<br/>[claims.py]"]
  node_report_api["Reports API<br/>[reports.py]"]
  node_satellite_api["Satellite API<br/>[satellite.py]"]
  node_chat_api["Chat API<br/>[chat.py]"]
  node_main["FastAPI application<br/>[main.py]"]
end

subgraph group_domain["Product services"]
  node_claim_service["Claim verification<br/>[claim_service.py]"]
  node_farm_service["Farm monitoring<br/>[farm_service.py]"]
  node_chat_service["Assistant logic<br/>[chat_service.py]"]
  node_notification_service["Notifications"]
  node_ai_service["AI assessment<br/>[ai_service.py]"]
  node_ai_templates["Assessment templates<br/>[ai_templates.py]"]
end

subgraph group_imagery["Satellite analysis"]
  node_satellite_service["Satellite processing"]
  node_sentinel_service["Sentinel Hub integration"]
  node_earth_engine["Earth Engine setup<br/>[earth_engine.py]"]
  node_ndvi["NDVI calculations<br/>[ndvi.py]"]
end

subgraph group_persistence["Identity and data"]
  node_auth_service["Authentication and roles<br/>[auth_service.py]"]
  node_role_service["Role data<br/>[role_service.py]"]
  node_database[("Database and demo data<br/>[database.py]")]
end

node_mao(("Agricultural officer"))
node_supabase[("Supabase PostgreSQL")]

node_main -->|"registers route"| node_auth_api
node_main -->|"registers route"| node_farm_api
node_main -->|"registers route"| node_claim_api
node_main -->|"registers route"| node_report_api
node_main -->|"registers route"| node_satellite_api
node_main -->|"imports route"| node_chat_api
node_auth_api -->|"authenticates"| node_auth_service
node_auth_api -->|"gets role data"| node_role_service
node_claim_api -->|"delegates claims"| node_claim_service
node_farm_api -->|"delegates farms"| node_farm_service
node_report_api -->|"gets claim"| node_claim_service
node_chat_api -->|"delegates chat"| node_chat_service
node_satellite_api -->|"delegates imagery"| node_satellite_service
node_satellite_api -->|"uses integration"| node_sentinel_service
node_claim_service -->|"computes indices"| node_satellite_service
node_claim_service -->|"uses imagery"| node_sentinel_service
node_claim_service -->|"requests assessment"| node_ai_service
node_claim_service -->|"uses templates"| node_ai_templates
node_claim_service -->|"sends notifications"| node_notification_service
node_farm_service -->|"reads scan cache"| node_satellite_service
node_farm_service -->|"notifies regional"| node_notification_service
node_chat_service -->|"uses assessment"| node_ai_service
node_satellite_service -->|"uses engine"| node_earth_engine
node_sentinel_service -->|"checks availability"| node_earth_engine
node_satellite_service -->|"stores scan data"| node_database
node_farm_service -->|"reads farm data"| node_database
node_auth_service -->|"queries users"| node_database
node_role_service -->|"reads role data"| node_database
node_ai_service -->|"uses calculations"| node_ndvi
node_main -->|"initializes"| node_earth_engine
node_database -.->|"can use"| node_supabase

click node_dashboard "https://github.com/rodrigoricky/bantayani/blob/main/frontend/app/(authenticated)/dashboard/page.js"
click node_farm_ui "https://github.com/rodrigoricky/bantayani/blob/main/frontend/app/(authenticated)/farms/page.js"
click node_claims_ui "https://github.com/rodrigoricky/bantayani/blob/main/frontend/app/(authenticated)/claims/page.js"
click node_login_ui "https://github.com/rodrigoricky/bantayani/blob/main/frontend/app/login/page.js"
click node_verification_ui "https://github.com/rodrigoricky/bantayani/blob/main/frontend/components/claims/VerificationResult.js"
click node_chat_ui "https://github.com/rodrigoricky/bantayani/blob/main/frontend/components/chat/ChatWidget.js"
click node_satellite_ui "https://github.com/rodrigoricky/bantayani/blob/main/frontend/components/map/SentinelImagePanel.js"
click node_auth_api "https://github.com/rodrigoricky/bantayani/blob/main/backend/api/auth.py"
click node_farm_api "https://github.com/rodrigoricky/bantayani/blob/main/backend/api/farms.py"
click node_claim_api "https://github.com/rodrigoricky/bantayani/blob/main/backend/api/claims.py"
click node_report_api "https://github.com/rodrigoricky/bantayani/blob/main/backend/api/reports.py"
click node_satellite_api "https://github.com/rodrigoricky/bantayani/blob/main/backend/api/satellite.py"
click node_chat_api "https://github.com/rodrigoricky/bantayani/blob/main/backend/api/chat.py"
click node_claim_service "https://github.com/rodrigoricky/bantayani/blob/main/backend/services/claim_service.py"
click node_farm_service "https://github.com/rodrigoricky/bantayani/blob/main/backend/services/farm_service.py"
click node_chat_service "https://github.com/rodrigoricky/bantayani/blob/main/backend/services/chat_service.py"
click node_notification_service "https://github.com/rodrigoricky/bantayani/blob/main/backend/services/notification_service.py"
click node_ai_service "https://github.com/rodrigoricky/bantayani/blob/main/backend/services/ai_service.py"
click node_ai_templates "https://github.com/rodrigoricky/bantayani/blob/main/backend/services/ai_templates.py"
click node_satellite_service "https://github.com/rodrigoricky/bantayani/blob/main/backend/services/satellite_service.py"
click node_sentinel_service "https://github.com/rodrigoricky/bantayani/blob/main/backend/services/sentinel_hub_service.py"
click node_earth_engine "https://github.com/rodrigoricky/bantayani/blob/main/backend/services/earth_engine.py"
click node_ndvi "https://github.com/rodrigoricky/bantayani/blob/main/backend/utils/ndvi.py"
click node_auth_service "https://github.com/rodrigoricky/bantayani/blob/main/backend/services/auth_service.py"
click node_role_service "https://github.com/rodrigoricky/bantayani/blob/main/backend/services/role_service.py"
click node_database "https://github.com/rodrigoricky/bantayani/blob/main/backend/utils/database.py"
click node_main "https://github.com/rodrigoricky/bantayani/blob/main/backend/main.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_farm_ui,node_claims_ui,node_login_ui,node_verification_ui,node_chat_ui,node_satellite_ui toneBlue
class node_auth_api,node_farm_api,node_claim_api,node_report_api,node_satellite_api,node_chat_api,node_main,node_supabase toneAmber
class node_claim_service,node_farm_service,node_chat_service,node_notification_service,node_ai_service,node_ai_templates toneMint
class node_satellite_service,node_sentinel_service,node_earth_engine,node_ndvi toneRose
class node_auth_service,node_role_service,node_database,node_mao toneIndigo
```

## Components

### User interface

- [Dashboard](https://github.com/rodrigoricky/bantayani/blob/main/frontend/app/(authenticated)/dashboard/page.js): `frontend/app/(authenticated)/dashboard/page.js`
- [Farm records](https://github.com/rodrigoricky/bantayani/blob/main/frontend/app/(authenticated)/farms/page.js): `frontend/app/(authenticated)/farms/page.js`
- [Claims](https://github.com/rodrigoricky/bantayani/blob/main/frontend/app/(authenticated)/claims/page.js): `frontend/app/(authenticated)/claims/page.js`
- [Sign in](https://github.com/rodrigoricky/bantayani/blob/main/frontend/app/login/page.js): `frontend/app/login/page.js`
- [Verification result](https://github.com/rodrigoricky/bantayani/blob/main/frontend/components/claims/VerificationResult.js): `frontend/components/claims/VerificationResult.js`
- [Chat assistant](https://github.com/rodrigoricky/bantayani/blob/main/frontend/components/chat/ChatWidget.js): `frontend/components/chat/ChatWidget.js`
- [Satellite imagery panel](https://github.com/rodrigoricky/bantayani/blob/main/frontend/components/map/SentinelImagePanel.js): `frontend/components/map/SentinelImagePanel.js`

### API routes

- [Authentication API](https://github.com/rodrigoricky/bantayani/blob/main/backend/api/auth.py): `backend/api/auth.py`
- [Farm API](https://github.com/rodrigoricky/bantayani/blob/main/backend/api/farms.py): `backend/api/farms.py`
- [Claims API](https://github.com/rodrigoricky/bantayani/blob/main/backend/api/claims.py): `backend/api/claims.py`
- [Reports API](https://github.com/rodrigoricky/bantayani/blob/main/backend/api/reports.py): `backend/api/reports.py`
- [Satellite API](https://github.com/rodrigoricky/bantayani/blob/main/backend/api/satellite.py): `backend/api/satellite.py`
- [Chat API](https://github.com/rodrigoricky/bantayani/blob/main/backend/api/chat.py): `backend/api/chat.py`
- [FastAPI application](https://github.com/rodrigoricky/bantayani/blob/main/backend/main.py): `backend/main.py`

### Product services

- [Claim verification](https://github.com/rodrigoricky/bantayani/blob/main/backend/services/claim_service.py): `backend/services/claim_service.py`
- [Farm monitoring](https://github.com/rodrigoricky/bantayani/blob/main/backend/services/farm_service.py): `backend/services/farm_service.py`
- [Assistant logic](https://github.com/rodrigoricky/bantayani/blob/main/backend/services/chat_service.py): `backend/services/chat_service.py`
- [Notifications](https://github.com/rodrigoricky/bantayani/blob/main/backend/services/notification_service.py): `backend/services/notification_service.py`
- [AI assessment](https://github.com/rodrigoricky/bantayani/blob/main/backend/services/ai_service.py): `backend/services/ai_service.py`
- [Assessment templates](https://github.com/rodrigoricky/bantayani/blob/main/backend/services/ai_templates.py): `backend/services/ai_templates.py`

### Satellite analysis

- [Satellite processing](https://github.com/rodrigoricky/bantayani/blob/main/backend/services/satellite_service.py): `backend/services/satellite_service.py`
- [Sentinel Hub integration](https://github.com/rodrigoricky/bantayani/blob/main/backend/services/sentinel_hub_service.py): `backend/services/sentinel_hub_service.py`
- [Earth Engine setup](https://github.com/rodrigoricky/bantayani/blob/main/backend/services/earth_engine.py): `backend/services/earth_engine.py`
- [NDVI calculations](https://github.com/rodrigoricky/bantayani/blob/main/backend/utils/ndvi.py): `backend/utils/ndvi.py`

### Identity and data

- [Authentication and roles](https://github.com/rodrigoricky/bantayani/blob/main/backend/services/auth_service.py): `backend/services/auth_service.py`
- [Role data](https://github.com/rodrigoricky/bantayani/blob/main/backend/services/role_service.py): `backend/services/role_service.py`
- [Database and demo data](https://github.com/rodrigoricky/bantayani/blob/main/backend/utils/database.py): `backend/utils/database.py`

### Other components

- **Agricultural officer**
- **Supabase PostgreSQL**

## Connections

- FastAPI application → Authentication API: registers route (evidence: `backend/main.py`)
- FastAPI application → Farm API: registers route (evidence: `backend/main.py`)
- FastAPI application → Claims API: registers route (evidence: `backend/main.py`)
- FastAPI application → Reports API: registers route (evidence: `backend/main.py`)
- FastAPI application → Satellite API: registers route (evidence: `backend/main.py`)
- FastAPI application → Chat API: imports route (evidence: `backend/main.py`)
- Authentication API → Authentication and roles: authenticates (evidence: `backend/api/auth.py`)
- Authentication API → Role data: gets role data (evidence: `backend/api/auth.py`)
- Claims API → Claim verification: delegates claims (evidence: `backend/api/claims.py`)
- Farm API → Farm monitoring: delegates farms (evidence: `backend/api/farms.py`)
- Reports API → Claim verification: gets claim (evidence: `backend/api/reports.py`)
- Chat API → Assistant logic: delegates chat (evidence: `backend/api/chat.py`)
- Satellite API → Satellite processing: delegates imagery (evidence: `backend/api/satellite.py`)
- Satellite API → Sentinel Hub integration: uses integration (evidence: `backend/api/satellite.py`)
- Claim verification → Satellite processing: computes indices (evidence: `backend/services/claim_service.py`)
- Claim verification → Sentinel Hub integration: uses imagery (evidence: `backend/services/claim_service.py`)
- Claim verification → AI assessment: requests assessment (evidence: `backend/services/claim_service.py`)
- Claim verification → Assessment templates: uses templates (evidence: `backend/services/claim_service.py`)
- Claim verification → Notifications: sends notifications (evidence: `backend/services/claim_service.py`)
- Farm monitoring → Satellite processing: reads scan cache (evidence: `backend/services/farm_service.py`)
- Farm monitoring → Notifications: notifies regional (evidence: `backend/services/farm_service.py`)
- Assistant logic → AI assessment: uses assessment (evidence: `backend/services/chat_service.py`)
- Satellite processing → Earth Engine setup: uses engine (evidence: `backend/services/satellite_service.py`)
- Sentinel Hub integration → Earth Engine setup: checks availability (evidence: `backend/services/sentinel_hub_service.py`)
- Satellite processing → Database and demo data: stores scan data (evidence: `backend/services/satellite_service.py`)
- Farm monitoring → Database and demo data: reads farm data (evidence: `backend/services/farm_service.py`)
- Authentication and roles → Database and demo data: queries users (evidence: `backend/services/auth_service.py`)
- Role data → Database and demo data: reads role data (evidence: `backend/services/role_service.py`)
- AI assessment → NDVI calculations: uses calculations (evidence: `backend/services/ai_service.py`)
- FastAPI application → Earth Engine setup: initializes (evidence: `backend/main.py`)
- Database and demo data → Supabase PostgreSQL: can use (evidence: `README.md`)
