# navadeepvandhanapu/avani architecture

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

## Overview

AVANI is a multilingual crop-disease detection and field-action platform for farmers. The main journey is to scan a leaf, receive a prediction, answer field-context questions, and get an actionable plan; farmers can also review scan history, check weather risks, and use voice assistance. The frontend coordinates these flows through an API client, while the FastAPI backend routes inference, guidance, persistence, weather, and voice requests. README descriptions establish several capabilities whose detailed implementation was not sampled; those links are cited as documented behavior, not as inspected source.

Main entry points: [`frontend/src/App.tsx`](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/App.tsx) (Application flow), [`frontend/src/services/api.ts`](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/services/api.ts) (API client), [`backend/main.py`](https://github.com/navadeepvandhanapu/avani/blob/main/backend/main.py) (FastAPI routes), [`frontend/src/components/VoiceAssistantModal.tsx`](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/VoiceAssistantModal.tsx) (Voice assistant)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_farmer_ui["Farmer experience"]
  node_app["Application flow<br/>[App.tsx]"]
  node_home["Home and alerts<br/>[HomePage.tsx]"]
  node_scanner["Leaf scanner<br/>[LeafScanner.tsx]"]
  node_prediction_view["Prediction result"]
  node_questionnaire["Field questionnaire"]
  node_action_plan["Action checklist"]
  node_history["Scan history"]
  node_weather_view["Weather view<br/>[WeatherModal.tsx]"]
  node_voice_view["Voice assistant"]
  node_notifications["Notifications"]
end

subgraph group_frontend_services["Frontend services"]
  node_api_client["API client<br/>[api.ts]"]
  node_speech["Speech utilities<br/>[speech.ts]"]
  node_ui_translations["UI translations<br/>[translations.ts]"]
end

subgraph group_diagnosis_guidance["Diagnosis and guidance"]
  node_model["Leaf inference<br/>[model_service.py]"]
  node_guidance_engine["Plan generation"]
  node_guidance_data["Curated guidance<br/>[guidance_data.py]"]
  node_guidance_i18n["Guidance translations"]
end

subgraph group_backend_services["Backend services"]
  node_api["FastAPI routes<br/>[main.py]"]
  node_voice_service["Voice query service<br/>[voice_service.py]"]
  node_weather_service["Weather risk service<br/>[weather_service.py]"]
  node_database[("SQLite scan store<br/>[database.py]")]
end

node_farmer(("Farmer"))
node_weather_provider["OpenWeatherMap"]

node_farmer -->|"uses"| node_app
node_app -->|"renders"| node_home
node_app -->|"renders"| node_scanner
node_app -->|"renders"| node_prediction_view
node_app -->|"renders"| node_questionnaire
node_app -->|"renders"| node_action_plan
node_app -->|"renders"| node_history
node_app -->|"renders"| node_weather_view
node_app -->|"renders"| node_voice_view
node_app -->|"renders"| node_notifications
node_app -->|"requests scans"| node_api_client
node_home -.->|"starts scan"| node_app
node_scanner -.->|"provides image"| node_app
node_api_client -->|"calls API"| node_api
node_api -->|"runs prediction"| node_model
node_api -->|"generates plan"| node_guidance_engine
node_guidance_engine -->|"uses references"| node_guidance_data
node_guidance_engine -->|"localizes plan"| node_guidance_i18n
node_api_client -.->|"returns prediction"| node_prediction_view
node_api_client -.->|"returns plan"| node_action_plan
node_app -.->|"collects answers"| node_questionnaire
node_api -->|"persists scans"| node_database
node_api_client -.->|"loads history"| node_history
node_app -->|"loads weather"| node_weather_view
node_api -->|"routes weather"| node_weather_service
node_weather_service -.->|"fetches conditions"| node_weather_provider
node_api -->|"routes queries"| node_voice_service
node_voice_view -->|"uses speech"| node_speech
node_speech -->|"requests audio"| node_api_client
node_voice_service -->|"uses references"| node_guidance_data
node_voice_view -.->|"sends queries"| node_api_client
node_app -.->|"uses language"| node_ui_translations

click node_app "https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/App.tsx"
click node_home "https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/HomePage.tsx"
click node_scanner "https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/LeafScanner.tsx"
click node_prediction_view "https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/PredictionResult.tsx"
click node_questionnaire "https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/FollowUpQuestionnaire.tsx"
click node_action_plan "https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/ActionSupportPlan.tsx"
click node_history "https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/ScanHistoryModal.tsx"
click node_weather_view "https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/WeatherModal.tsx"
click node_voice_view "https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/VoiceAssistantModal.tsx"
click node_notifications "https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/NotificationsModal.tsx"
click node_api_client "https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/services/api.ts"
click node_speech "https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/utils/speech.ts"
click node_ui_translations "https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/translations.ts"
click node_api "https://github.com/navadeepvandhanapu/avani/blob/main/backend/main.py"
click node_model "https://github.com/navadeepvandhanapu/avani/blob/main/backend/model_service.py"
click node_guidance_engine "https://github.com/navadeepvandhanapu/avani/blob/main/backend/guidance_service.py"
click node_guidance_data "https://github.com/navadeepvandhanapu/avani/blob/main/backend/guidance_data.py"
click node_guidance_i18n "https://github.com/navadeepvandhanapu/avani/blob/main/backend/guidance_translations.py"
click node_voice_service "https://github.com/navadeepvandhanapu/avani/blob/main/backend/voice_service.py"
click node_weather_service "https://github.com/navadeepvandhanapu/avani/blob/main/backend/weather_service.py"
click node_database "https://github.com/navadeepvandhanapu/avani/blob/main/backend/database.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_home,node_scanner,node_prediction_view,node_questionnaire,node_action_plan,node_history,node_weather_view,node_voice_view,node_notifications toneBlue
class node_api_client,node_speech,node_ui_translations toneAmber
class node_model,node_guidance_engine,node_guidance_data,node_guidance_i18n toneMint
class node_api,node_voice_service,node_weather_service,node_database toneRose
class node_farmer,node_weather_provider toneIndigo
```

## Components

### Farmer experience

- [Application flow](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Home and alerts](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/HomePage.tsx): `frontend/src/components/HomePage.tsx`
- [Leaf scanner](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/LeafScanner.tsx): `frontend/src/components/LeafScanner.tsx`
- [Prediction result](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/PredictionResult.tsx): `frontend/src/components/PredictionResult.tsx`
- [Field questionnaire](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/FollowUpQuestionnaire.tsx): `frontend/src/components/FollowUpQuestionnaire.tsx`
- [Action checklist](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/ActionSupportPlan.tsx): `frontend/src/components/ActionSupportPlan.tsx`
- [Scan history](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/ScanHistoryModal.tsx): `frontend/src/components/ScanHistoryModal.tsx`
- [Weather view](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/WeatherModal.tsx): `frontend/src/components/WeatherModal.tsx`
- [Voice assistant](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/VoiceAssistantModal.tsx): `frontend/src/components/VoiceAssistantModal.tsx`
- [Notifications](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/components/NotificationsModal.tsx): `frontend/src/components/NotificationsModal.tsx`

### Frontend services

- [API client](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Speech utilities](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/utils/speech.ts): `frontend/src/utils/speech.ts`
- [UI translations](https://github.com/navadeepvandhanapu/avani/blob/main/frontend/src/translations.ts): `frontend/src/translations.ts`

### Diagnosis and guidance

- [Leaf inference](https://github.com/navadeepvandhanapu/avani/blob/main/backend/model_service.py): `backend/model_service.py`
- [Plan generation](https://github.com/navadeepvandhanapu/avani/blob/main/backend/guidance_service.py): `backend/guidance_service.py`
- [Curated guidance](https://github.com/navadeepvandhanapu/avani/blob/main/backend/guidance_data.py): `backend/guidance_data.py`
- [Guidance translations](https://github.com/navadeepvandhanapu/avani/blob/main/backend/guidance_translations.py): `backend/guidance_translations.py`

### Backend services

- [FastAPI routes](https://github.com/navadeepvandhanapu/avani/blob/main/backend/main.py): `backend/main.py`
- [Voice query service](https://github.com/navadeepvandhanapu/avani/blob/main/backend/voice_service.py): `backend/voice_service.py`
- [Weather risk service](https://github.com/navadeepvandhanapu/avani/blob/main/backend/weather_service.py): `backend/weather_service.py`
- [SQLite scan store](https://github.com/navadeepvandhanapu/avani/blob/main/backend/database.py): `backend/database.py`

### Other components

- **Farmer**
- **OpenWeatherMap**

## Connections

- Farmer → Application flow: uses (evidence: `README.md`)
- Application flow → Home and alerts: renders (evidence: `frontend/src/App.tsx`)
- Application flow → Leaf scanner: renders (evidence: `frontend/src/App.tsx`)
- Application flow → Prediction result: renders (evidence: `frontend/src/App.tsx`)
- Application flow → Field questionnaire: renders (evidence: `frontend/src/App.tsx`)
- Application flow → Action checklist: renders (evidence: `frontend/src/App.tsx`)
- Application flow → Scan history: renders (evidence: `frontend/src/App.tsx`)
- Application flow → Weather view: renders (evidence: `frontend/src/App.tsx`)
- Application flow → Voice assistant: renders (evidence: `frontend/src/App.tsx`)
- Application flow → Notifications: renders (evidence: `frontend/src/App.tsx`)
- Application flow → API client: requests scans (evidence: `frontend/src/App.tsx`)
- Home and alerts → Application flow: starts scan (evidence: `frontend/src/App.tsx`)
- Leaf scanner → Application flow: provides image (evidence: `frontend/src/App.tsx`)
- API client → FastAPI routes: calls API (evidence: `frontend/src/services/api.ts`)
- FastAPI routes → Leaf inference: runs prediction (evidence: `backend/main.py`)
- FastAPI routes → Plan generation: generates plan (evidence: `backend/main.py`)
- Plan generation → Curated guidance: uses references (evidence: `backend/guidance_service.py`)
- Plan generation → Guidance translations: localizes plan (evidence: `backend/guidance_service.py`)
- API client → Prediction result: returns prediction (evidence: `frontend/src/components/PredictionResult.tsx`)
- API client → Action checklist: returns plan
- Application flow → Field questionnaire: collects answers (evidence: `frontend/src/App.tsx`)
- FastAPI routes → SQLite scan store: persists scans (evidence: `README.md`)
- API client → Scan history: loads history
- Application flow → Weather view: loads weather (evidence: `frontend/src/App.tsx`)
- FastAPI routes → Weather risk service: routes weather (evidence: `backend/main.py`)
- Weather risk service → OpenWeatherMap: fetches conditions (evidence: `README.md`)
- FastAPI routes → Voice query service: routes queries (evidence: `backend/main.py`)
- Voice assistant → Speech utilities: uses speech (evidence: `frontend/src/utils/speech.ts`)
- Speech utilities → API client: requests audio (evidence: `frontend/src/utils/speech.ts`)
- Voice query service → Curated guidance: uses references (evidence: `backend/voice_service.py`)
- Voice assistant → API client: sends queries (evidence: `frontend/src/components/VoiceAssistantModal.tsx`)
- Application flow → UI translations: uses language
