# viraj-akili/anemia-detection architecture

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

- Interactive diagram: https://gitdiagram.com/viraj-akili/anemia-detection
- Repository: https://github.com/viraj-akili/anemia-detection

## Overview

PRAHARI is a frontline-worker screening application for early warning of anemia and malnutrition. Its principal flow collects beneficiary and screening inputs, captures an optical image, combines model output with anthropometry and context in a risk assessment, then presents safety-bounded recommendations and supports follow-up. The repository also includes longitudinal views, clinical question tools, role dashboards, localization, and offline queueing. Some capabilities are documented but their wiring is not shown in the excerpts, so uncertain connections are omitted.

Main entry points: [`src/App.tsx`](https://github.com/viraj-akili/anemia-detection/blob/main/src/App.tsx) (PRAHARI app), [`src/services/localizationService.ts`](https://github.com/viraj-akili/anemia-detection/blob/main/src/services/localizationService.ts) (Localization), [`src/components/aww/NewScreeningWorkflow.tsx`](https://github.com/viraj-akili/anemia-detection/blob/main/src/components/aww/NewScreeningWorkflow.tsx) (New screening), [`src/services/screeningService.ts`](https://github.com/viraj-akili/anemia-detection/blob/main/src/services/screeningService.ts) (Risk screening)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Screening workflow"]
  node_app["PRAHARI app<br/>[App.tsx]"]
  node_new_screening["New screening"]
  node_optical_capture["Optical capture"]
end

subgraph group_clinical["Risk and clinical tools"]
  node_screening_engine["Risk screening"]
  node_anemia_model["Anemia model"]
  node_nutrition_chat["Nutrition assistant"]
  node_clinical_doubt["Clinical doubt"]
end

subgraph group_care["Beneficiary care"]
  node_beneficiary_list["Beneficiary list"]
  node_beneficiary_profile["Beneficiary profile"]
  node_followups["Follow-up list<br/>[FollowUpList.tsx]"]
  node_trends["Longitudinal trends"]
  node_aww_home["AWW home<br/>[AWWHome.tsx]"]
end

subgraph group_oversight["Program oversight"]
  node_supervisor["Supervisor dashboard"]
  node_district_admin["District dashboard"]
end

subgraph group_platform["Offline and shared"]
  node_sync[("Offline sync queue<br/>[syncService.ts]")]
  node_localization["Localization"]
  node_domain_types["Screening data types<br/>[index.ts]"]
end

node_worker(("Frontline worker"))

node_worker -->|"uses"| node_app
node_app -->|"calls"| node_screening_engine
node_app -->|"renders"| node_nutrition_chat
node_app -->|"renders"| node_clinical_doubt
node_app -->|"renders"| node_optical_capture
node_app -.->|"offers workflow"| node_new_screening
node_new_screening -->|"calls"| node_screening_engine
node_new_screening -->|"queues offline"| node_sync
node_screening_engine -->|"runs inference"| node_anemia_model
node_aww_home -->|"uses translations"| node_localization
node_beneficiary_list -->|"uses translations"| node_localization
node_beneficiary_profile -->|"uses translations"| node_localization
node_followups -->|"uses translations"| node_localization
node_trends -->|"uses translations"| node_localization
node_supervisor -->|"uses translations"| node_localization
node_district_admin -->|"uses translations"| node_localization

click node_app "https://github.com/viraj-akili/anemia-detection/blob/main/src/App.tsx"
click node_new_screening "https://github.com/viraj-akili/anemia-detection/blob/main/src/components/aww/NewScreeningWorkflow.tsx"
click node_optical_capture "https://github.com/viraj-akili/anemia-detection/blob/main/src/components/scanner/OpticalCaptureZone.tsx"
click node_screening_engine "https://github.com/viraj-akili/anemia-detection/blob/main/src/services/screeningService.ts"
click node_anemia_model "https://github.com/viraj-akili/anemia-detection/blob/main/src/services/anemiaModelService.ts"
click node_nutrition_chat "https://github.com/viraj-akili/anemia-detection/blob/main/src/components/chat/MalnutritionAIChatbot.tsx"
click node_clinical_doubt "https://github.com/viraj-akili/anemia-detection/blob/main/src/components/doubt/ClinicalDoubtAssistant.tsx"
click node_beneficiary_list "https://github.com/viraj-akili/anemia-detection/blob/main/src/components/aww/BeneficiaryList.tsx"
click node_beneficiary_profile "https://github.com/viraj-akili/anemia-detection/blob/main/src/components/aww/BeneficiaryProfile.tsx"
click node_followups "https://github.com/viraj-akili/anemia-detection/blob/main/src/components/aww/FollowUpList.tsx"
click node_trends "https://github.com/viraj-akili/anemia-detection/blob/main/src/components/aww/LongitudinalTrendView.tsx"
click node_aww_home "https://github.com/viraj-akili/anemia-detection/blob/main/src/components/aww/AWWHome.tsx"
click node_supervisor "https://github.com/viraj-akili/anemia-detection/blob/main/src/components/supervisor/SupervisorDashboard.tsx"
click node_district_admin "https://github.com/viraj-akili/anemia-detection/blob/main/src/components/admin/DistrictAdminDashboard.tsx"
click node_sync "https://github.com/viraj-akili/anemia-detection/blob/main/src/services/syncService.ts"
click node_localization "https://github.com/viraj-akili/anemia-detection/blob/main/src/services/localizationService.ts"
click node_domain_types "https://github.com/viraj-akili/anemia-detection/blob/main/src/types/index.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_app,node_new_screening,node_optical_capture toneBlue
class node_screening_engine,node_anemia_model,node_nutrition_chat,node_clinical_doubt toneAmber
class node_beneficiary_list,node_beneficiary_profile,node_followups,node_trends,node_aww_home toneMint
class node_supervisor,node_district_admin,node_worker toneRose
class node_sync,node_localization,node_domain_types toneIndigo
```

## Components

### Screening workflow

- [PRAHARI app](https://github.com/viraj-akili/anemia-detection/blob/main/src/App.tsx): `src/App.tsx`
- [New screening](https://github.com/viraj-akili/anemia-detection/blob/main/src/components/aww/NewScreeningWorkflow.tsx): `src/components/aww/NewScreeningWorkflow.tsx`
- [Optical capture](https://github.com/viraj-akili/anemia-detection/blob/main/src/components/scanner/OpticalCaptureZone.tsx): `src/components/scanner/OpticalCaptureZone.tsx`

### Risk and clinical tools

- [Risk screening](https://github.com/viraj-akili/anemia-detection/blob/main/src/services/screeningService.ts): `src/services/screeningService.ts`
- [Anemia model](https://github.com/viraj-akili/anemia-detection/blob/main/src/services/anemiaModelService.ts): `src/services/anemiaModelService.ts`
- [Nutrition assistant](https://github.com/viraj-akili/anemia-detection/blob/main/src/components/chat/MalnutritionAIChatbot.tsx): `src/components/chat/MalnutritionAIChatbot.tsx`
- [Clinical doubt](https://github.com/viraj-akili/anemia-detection/blob/main/src/components/doubt/ClinicalDoubtAssistant.tsx): `src/components/doubt/ClinicalDoubtAssistant.tsx`

### Beneficiary care

- [Beneficiary list](https://github.com/viraj-akili/anemia-detection/blob/main/src/components/aww/BeneficiaryList.tsx): `src/components/aww/BeneficiaryList.tsx`
- [Beneficiary profile](https://github.com/viraj-akili/anemia-detection/blob/main/src/components/aww/BeneficiaryProfile.tsx): `src/components/aww/BeneficiaryProfile.tsx`
- [Follow-up list](https://github.com/viraj-akili/anemia-detection/blob/main/src/components/aww/FollowUpList.tsx): `src/components/aww/FollowUpList.tsx`
- [Longitudinal trends](https://github.com/viraj-akili/anemia-detection/blob/main/src/components/aww/LongitudinalTrendView.tsx): `src/components/aww/LongitudinalTrendView.tsx`
- [AWW home](https://github.com/viraj-akili/anemia-detection/blob/main/src/components/aww/AWWHome.tsx): `src/components/aww/AWWHome.tsx`

### Program oversight

- [Supervisor dashboard](https://github.com/viraj-akili/anemia-detection/blob/main/src/components/supervisor/SupervisorDashboard.tsx): `src/components/supervisor/SupervisorDashboard.tsx`
- [District dashboard](https://github.com/viraj-akili/anemia-detection/blob/main/src/components/admin/DistrictAdminDashboard.tsx): `src/components/admin/DistrictAdminDashboard.tsx`

### Offline and shared

- [Offline sync queue](https://github.com/viraj-akili/anemia-detection/blob/main/src/services/syncService.ts): `src/services/syncService.ts`
- [Localization](https://github.com/viraj-akili/anemia-detection/blob/main/src/services/localizationService.ts): `src/services/localizationService.ts`
- [Screening data types](https://github.com/viraj-akili/anemia-detection/blob/main/src/types/index.ts): `src/types/index.ts`

### Other components

- **Frontline worker**

## Connections

- Frontline worker → PRAHARI app: uses (evidence: `README.md`)
- PRAHARI app → Risk screening: calls (evidence: `src/App.tsx`)
- PRAHARI app → Nutrition assistant: renders (evidence: `src/App.tsx`)
- PRAHARI app → Clinical doubt: renders (evidence: `src/App.tsx`)
- PRAHARI app → Optical capture: renders (evidence: `src/App.tsx`)
- PRAHARI app → New screening: offers workflow
- New screening → Risk screening: calls (evidence: `src/components/aww/NewScreeningWorkflow.tsx`)
- New screening → Offline sync queue: queues offline (evidence: `src/components/aww/NewScreeningWorkflow.tsx`)
- Risk screening → Anemia model: runs inference (evidence: `src/services/screeningService.ts`)
- AWW home → Localization: uses translations (evidence: `src/components/aww/AWWHome.tsx`)
- Beneficiary list → Localization: uses translations (evidence: `src/components/aww/BeneficiaryList.tsx`)
- Beneficiary profile → Localization: uses translations (evidence: `src/components/aww/BeneficiaryProfile.tsx`)
- Follow-up list → Localization: uses translations (evidence: `src/components/aww/FollowUpList.tsx`)
- Longitudinal trends → Localization: uses translations (evidence: `src/components/aww/LongitudinalTrendView.tsx`)
- Supervisor dashboard → Localization: uses translations (evidence: `src/components/supervisor/SupervisorDashboard.tsx`)
- District dashboard → Localization: uses translations (evidence: `src/components/admin/DistrictAdminDashboard.tsx`)
