# krishnakant09/jeevraksha-main architecture

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

- Interactive diagram: https://gitdiagram.com/krishnakant09/jeevraksha-main
- Repository: https://github.com/krishnakant09/jeevraksha-main

## Overview

JeevRaksha is a livestock disease surveillance and response platform. Farmers register animals and submit illness reports by text, voice/IVR, or photo; report handlers assess risk and persist reports that feed case follow-up, veterinary appointments, alerts, and district surveillance. The README documents lab workflows, vaccination tracking, and multilingual AI capabilities beyond the sampled implementation. Edges reflect excerpted calls or README-described flows; unsampled feature internals are represented by their existing route or page directories.

Main entry points: [`src/app/farmer/page.tsx`](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/farmer/page.tsx) (Farmer portal), [`src/lib/prisma.ts`](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/lib/prisma.ts) (Application database), [`src/app/api/cases/route.ts`](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/cases/route.ts) (Case lifecycle), [`src/app/api/ivr/simulate/route.ts`](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/ivr/simulate/route.ts) (Voice / IVR intake)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_farmer["Farmer services"]
  node_farmer_portal["Farmer portal<br/>[page.tsx]"]
  node_animal_registry["Animal registry<br/>[route.ts]"]
  node_registry_page["Livestock pages<br/>[page.tsx]"]
  node_farmer_report["Farmer reporting page<br/>[page.tsx]"]
  node_ivr_page["Farmer IVR page<br/>[page.tsx]"]
  node_appointment_page["Appointment booking<br/>[page.tsx]"]
end

subgraph group_intake["Report intake"]
  node_voice_intake["Voice / IVR intake<br/>[route.ts]"]
  node_photo_intake["Photo assessment<br/>[route.ts]"]
  node_report_intake["Health reports<br/>[route.ts]"]
  node_chat_api["AI assistant<br/>[route.ts]"]
  node_draft_report["AI report drafting<br/>[route.ts]"]
  node_tts["Speech responses<br/>[route.ts]"]
end

subgraph group_response["Clinical response"]
  node_case_api["Case lifecycle<br/>[route.ts]"]
  node_case_detail["Case updates<br/>[route.ts]"]
  node_appointments["Vet appointments<br/>[route.ts]"]
  node_lab["Lab workflows<br/>[page.tsx]"]
end

subgraph group_surveillance["Surveillance"]
  node_alert_api["Outbreak alerts<br/>[route.ts]"]
  node_overview_api["Jurisdiction overview<br/>[route.ts]"]
  node_dashboard["District dashboard<br/>[page.tsx]"]
  node_map["GIS outbreak map<br/>[MapComponent.tsx]"]
end

subgraph group_platform["Platform core"]
  node_risk_engine["Risk engine<br/>[risk-engine.ts]"]
  node_jurisdiction["Jurisdiction filters<br/>[jurisdiction.ts]"]
  node_db[("Application database<br/>[prisma.ts]")]
end

node_farmer(("Farmers"))
node_sarvam{{"Sarvam AI"}}

node_farmer -->|"uses"| node_farmer_portal
node_farmer_portal -->|"registers animals"| node_registry_page
node_registry_page -->|"manages livestock"| node_animal_registry
node_farmer_portal -->|"reports illness"| node_farmer_report
node_farmer_report -->|"submits reports"| node_report_intake
node_farmer_portal -->|"starts voice intake"| node_ivr_page
node_ivr_page -->|"submits call intake"| node_voice_intake
node_farmer_portal -->|"submits photos"| node_photo_intake
node_report_intake -->|"calculates risk"| node_risk_engine
node_voice_intake -->|"calculates risk"| node_risk_engine
node_photo_intake -->|"calculates risk"| node_risk_engine
node_report_intake -->|"reads and writes"| node_db
node_voice_intake -->|"reads and writes"| node_db
node_photo_intake -->|"reads and writes"| node_db
node_animal_registry -->|"reads and writes"| node_db
node_report_intake -->|"creates cases"| node_case_api
node_voice_intake -->|"creates cases"| node_case_api
node_photo_intake -->|"creates cases"| node_case_api
node_case_api -->|"reads and writes"| node_db
node_case_detail -->|"updates cases"| node_db
node_farmer_portal -->|"asks guidance"| node_chat_api
node_farmer_portal -->|"requests drafting"| node_draft_report
node_chat_api -.->|"uses AI"| node_sarvam
node_draft_report -.->|"uses AI"| node_sarvam
node_farmer_portal -->|"requests speech"| node_tts
node_tts -.->|"uses speech service"| node_sarvam
node_case_api -.->|"supports inspections"| node_appointments
node_appointments -.->|"persists appointments"| node_db
node_appointment_page -->|"books visits"| node_appointments
node_case_api -.->|"tracks sample tests"| node_lab
node_case_api -.->|"triggers priority alerts"| node_alert_api
node_alert_api -->|"reads alerts"| node_db
node_dashboard -.->|"loads surveillance"| node_overview_api
node_overview_api -->|"builds filters"| node_jurisdiction
node_overview_api -->|"queries metrics"| node_db
node_dashboard -->|"visualizes outbreaks"| node_map
node_dashboard -.->|"monitors alerts"| node_alert_api

click node_farmer_portal "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/farmer/page.tsx"
click node_animal_registry "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/animals/route.ts"
click node_voice_intake "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/ivr/simulate/route.ts"
click node_photo_intake "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/photo-detect/route.ts"
click node_report_intake "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/health-reports/route.ts"
click node_risk_engine "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/lib/risk-engine.ts"
click node_case_api "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/cases/route.ts"
click node_case_detail "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/cases/%5Bid%5D/route.ts"
click node_appointments "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/appointments/route.ts"
click node_lab "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/dashboard/lab/page.tsx"
click node_chat_api "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/chat/route.ts"
click node_draft_report "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/draft-report/route.ts"
click node_tts "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/tts/route.ts"
click node_alert_api "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/alerts/route.ts"
click node_overview_api "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/overview/route.ts"
click node_jurisdiction "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/lib/jurisdiction.ts"
click node_dashboard "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/dashboard/page.tsx"
click node_map "https://github.com/krishnakant09/jeevraksha-main/blob/main/components/maps/MapComponent.tsx"
click node_registry_page "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/farmer/animals/page.tsx"
click node_farmer_report "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/farmer/report/page.tsx"
click node_ivr_page "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/farmer/ivr/page.tsx"
click node_appointment_page "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/appointments/page.tsx"
click node_db "https://github.com/krishnakant09/jeevraksha-main/blob/main/src/lib/prisma.ts"

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_farmer_portal,node_animal_registry,node_registry_page,node_farmer_report,node_ivr_page,node_appointment_page toneBlue
class node_voice_intake,node_photo_intake,node_report_intake,node_chat_api,node_draft_report,node_tts toneAmber
class node_case_api,node_case_detail,node_appointments,node_lab toneMint
class node_alert_api,node_overview_api,node_dashboard,node_map toneRose
class node_risk_engine,node_jurisdiction,node_db,node_farmer,node_sarvam toneIndigo
```

## Components

### Farmer services

- [Farmer portal](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/farmer/page.tsx): `src/app/farmer/page.tsx`
- [Animal registry](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/animals/route.ts): `src/app/api/animals/route.ts`
- [Livestock pages](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/farmer/animals/page.tsx): `src/app/farmer/animals/page.tsx`
- [Farmer reporting page](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/farmer/report/page.tsx): `src/app/farmer/report/page.tsx`
- [Farmer IVR page](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/farmer/ivr/page.tsx): `src/app/farmer/ivr/page.tsx`
- [Appointment booking](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/appointments/page.tsx): `src/app/appointments/page.tsx`

### Report intake

- [Voice / IVR intake](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/ivr/simulate/route.ts): `src/app/api/ivr/simulate/route.ts`
- [Photo assessment](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/photo-detect/route.ts): `src/app/api/photo-detect/route.ts`
- [Health reports](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/health-reports/route.ts): `src/app/api/health-reports/route.ts`
- [AI assistant](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/chat/route.ts): `src/app/api/chat/route.ts`
- [AI report drafting](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/draft-report/route.ts): `src/app/api/draft-report/route.ts`
- [Speech responses](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/tts/route.ts): `src/app/api/tts/route.ts`

### Clinical response

- [Case lifecycle](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/cases/route.ts): `src/app/api/cases/route.ts`
- [Case updates](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/cases/%5Bid%5D/route.ts): `src/app/api/cases/[id]/route.ts`
- [Vet appointments](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/appointments/route.ts): `src/app/api/appointments/route.ts`
- [Lab workflows](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/dashboard/lab/page.tsx): `src/app/dashboard/lab/page.tsx`

### Surveillance

- [Outbreak alerts](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/alerts/route.ts): `src/app/api/alerts/route.ts`
- [Jurisdiction overview](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/api/overview/route.ts): `src/app/api/overview/route.ts`
- [District dashboard](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [GIS outbreak map](https://github.com/krishnakant09/jeevraksha-main/blob/main/components/maps/MapComponent.tsx): `components/maps/MapComponent.tsx`

### Platform core

- [Risk engine](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/lib/risk-engine.ts): `src/lib/risk-engine.ts`
- [Jurisdiction filters](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/lib/jurisdiction.ts): `src/lib/jurisdiction.ts`
- [Application database](https://github.com/krishnakant09/jeevraksha-main/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`

### Other components

- **Farmers**
- **Sarvam AI**

## Connections

- Farmers → Farmer portal: uses
- Farmer portal → Livestock pages: registers animals
- Livestock pages → Animal registry: manages livestock
- Farmer portal → Farmer reporting page: reports illness
- Farmer reporting page → Health reports: submits reports
- Farmer portal → Farmer IVR page: starts voice intake
- Farmer IVR page → Voice / IVR intake: submits call intake (evidence: `src/app/farmer/ivr/page.tsx`)
- Farmer portal → Photo assessment: submits photos
- Health reports → Risk engine: calculates risk (evidence: `src/app/api/health-reports/route.ts`)
- Voice / IVR intake → Risk engine: calculates risk (evidence: `src/app/api/ivr/simulate/route.ts`)
- Photo assessment → Risk engine: calculates risk (evidence: `src/app/api/photo-detect/route.ts`)
- Health reports → Application database: reads and writes (evidence: `src/app/api/health-reports/route.ts`)
- Voice / IVR intake → Application database: reads and writes (evidence: `src/app/api/ivr/simulate/route.ts`)
- Photo assessment → Application database: reads and writes (evidence: `src/app/api/photo-detect/route.ts`)
- Animal registry → Application database: reads and writes (evidence: `src/app/api/animals/route.ts`)
- Health reports → Case lifecycle: creates cases (evidence: `src/app/api/health-reports/route.ts`)
- Voice / IVR intake → Case lifecycle: creates cases (evidence: `src/app/api/ivr/simulate/route.ts`)
- Photo assessment → Case lifecycle: creates cases (evidence: `src/app/api/photo-detect/route.ts`)
- Case lifecycle → Application database: reads and writes (evidence: `src/app/api/cases/route.ts`)
- Case updates → Application database: updates cases (evidence: `src/app/api/cases/[id]/route.ts`)
- Farmer portal → AI assistant: asks guidance
- Farmer portal → AI report drafting: requests drafting
- AI assistant → Sarvam AI: uses AI
- AI report drafting → Sarvam AI: uses AI
- Farmer portal → Speech responses: requests speech
- Speech responses → Sarvam AI: uses speech service
- Case lifecycle → Vet appointments: supports inspections
- Vet appointments → Application database: persists appointments (evidence: `src/app/api/appointments/route.ts`)
- Appointment booking → Vet appointments: books visits (evidence: `src/app/appointments/page.tsx`)
- Case lifecycle → Lab workflows: tracks sample tests
- Case lifecycle → Outbreak alerts: triggers priority alerts
- Outbreak alerts → Application database: reads alerts (evidence: `src/app/api/alerts/route.ts`)
- District dashboard → Jurisdiction overview: loads surveillance
- Jurisdiction overview → Jurisdiction filters: builds filters (evidence: `src/app/api/overview/route.ts`)
- Jurisdiction overview → Application database: queries metrics (evidence: `src/app/api/overview/route.ts`)
- District dashboard → GIS outbreak map: visualizes outbreaks
- District dashboard → Outbreak alerts: monitors alerts
