# shivansh19200/asha-sethu architecture

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

- Interactive diagram: https://gitdiagram.com/shivansh19200/asha-sethu
- Repository: https://github.com/shivansh19200/asha-sethu

## Overview

Asha Sethu is an ASHA home-visit decision-support app. The main workflow is to describe and confirm a mother’s or newborn’s signs, assess danger with an AI-guided question flow bounded by a deterministic safety floor, prepare a visit record and referral, then save or send only after worker confirmation. The README also describes care-team history and follow-up. Several backend routes and screens are unsampled, so their connections are omitted or marked unverified rather than inferred from filenames.

Main entry points: [`web/src/api.js`](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/api.js) (API client), [`web/src/App.jsx`](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/App.jsx) (Screen router), [`api/_agent/core.py`](https://github.com/shivansh19200/asha-sethu/blob/main/api/_agent/core.py) (Agent workflow), [`web/src/Describe.jsx`](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Describe.jsx) (Describe signs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_visit["Visit workflow"]
  node_app["Screen router<br/>[App.jsx]"]
  node_describe["Describe signs<br/>[Describe.jsx]"]
  node_confirm["Confirm signs<br/>[Confirm.jsx]"]
  node_note["Referral note<br/>[note.py]"]
  node_noterecord["Review and record<br/>[NoteRecord.jsx]"]
  node_review["Review and send<br/>[ReviewSend.jsx]"]
end

subgraph group_assessment["Safety assessment"]
  node_question["Clarify signs<br/>[Question.jsx]"]
  node_result["Show result<br/>[Result.jsx]"]
  node_floorweb["Browser safety floor<br/>[floor.js]"]
  node_agent["Agent workflow<br/>[core.py]"]
  node_agentgraph["Agent graph<br/>[graph.py]"]
  node_understand["Text understanding<br/>[understand.py]"]
  node_rules["Server safety rules<br/>[rules.py]"]
end

subgraph group_backend["API services"]
  node_apiweb["API client<br/>[api.js]"]
  node_transcribe["Speech transcription<br/>[transcribe.py]"]
  node_visits["Visit records<br/>[visits.py]"]
  node_referral["Referral dispatch<br/>[referral.py]"]
end

subgraph group_followup["Care follow-up"]
  node_careui["Care team view<br/>[Care.jsx]"]
  node_careapi["Care services<br/>[care.py]"]
  node_home["Home and follow-ups<br/>[Home.jsx]"]
  node_recent["Local visit history<br/>[recent.js]"]
end

subgraph group_experience["App experience"]
  node_landing["Product landing<br/>[Landing.jsx]"]
  node_demo["Scenario demo<br/>[Demo.jsx]"]
  node_tour["Guided tour<br/>[Tour.jsx]"]
end

node_asha(("ASHA worker"))
node_database[("Supabase Postgres")]
node_groq{{"Groq model"}}

node_asha -->|"enters visit"| node_app
node_app -->|"routes to"| node_describe
node_app -->|"routes to"| node_confirm
node_app -->|"routes to"| node_question
node_app -->|"routes to"| node_result
node_describe -.->|"confirms signs"| node_confirm
node_confirm -.->|"continues assessment"| node_question
node_question -.->|"requests agent"| node_apiweb
node_result -->|"gets level"| node_floorweb
node_apiweb -->|"fallback assessment"| node_floorweb
node_agent -->|"uses floor rules"| node_rules
node_agentgraph -->|"builds workflow"| node_agent
node_apiweb -.->|"calls agent route"| node_agent
node_apiweb -.->|"requests interpretation"| node_understand
node_describe -.->|"submits speech"| node_transcribe
node_result -.->|"continues to record"| node_noterecord
node_noterecord -.->|"saves visit"| node_apiweb
node_review -->|"requests note"| node_apiweb
node_apiweb -.->|"requests note service"| node_note
node_review -->|"sends on tap"| node_apiweb
node_apiweb -.->|"posts referral"| node_referral
node_apiweb -.->|"posts visit"| node_visits
node_visits -.->|"stores visits"| node_database
node_referral -.->|"records referral"| node_database
node_careui -->|"requests care data"| node_apiweb
node_home -->|"requests history"| node_apiweb
node_home -->|"reads follow-ups"| node_recent
node_careapi -.->|"reads care records"| node_database
node_apiweb -.->|"posts care action"| node_careapi
node_landing -->|"renders demo"| node_demo
node_tour -->|"starts scenario"| node_demo
node_landing -->|"embeds app"| node_app
node_agent -.->|"uses optional model"| node_groq

click node_app "https://github.com/shivansh19200/asha-sethu/blob/main/web/src/App.jsx"
click node_describe "https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Describe.jsx"
click node_confirm "https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Confirm.jsx"
click node_question "https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Question.jsx"
click node_result "https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Result.jsx"
click node_floorweb "https://github.com/shivansh19200/asha-sethu/blob/main/web/src/floor.js"
click node_apiweb "https://github.com/shivansh19200/asha-sethu/blob/main/web/src/api.js"
click node_agent "https://github.com/shivansh19200/asha-sethu/blob/main/api/_agent/core.py"
click node_agentgraph "https://github.com/shivansh19200/asha-sethu/blob/main/api/_agent/graph.py"
click node_understand "https://github.com/shivansh19200/asha-sethu/blob/main/api/understand.py"
click node_rules "https://github.com/shivansh19200/asha-sethu/blob/main/api/rules.py"
click node_transcribe "https://github.com/shivansh19200/asha-sethu/blob/main/api/transcribe.py"
click node_note "https://github.com/shivansh19200/asha-sethu/blob/main/api/note.py"
click node_noterecord "https://github.com/shivansh19200/asha-sethu/blob/main/web/src/NoteRecord.jsx"
click node_review "https://github.com/shivansh19200/asha-sethu/blob/main/web/src/ReviewSend.jsx"
click node_visits "https://github.com/shivansh19200/asha-sethu/blob/main/api/visits.py"
click node_referral "https://github.com/shivansh19200/asha-sethu/blob/main/api/referral.py"
click node_careui "https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Care.jsx"
click node_careapi "https://github.com/shivansh19200/asha-sethu/blob/main/api/care.py"
click node_home "https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Home.jsx"
click node_recent "https://github.com/shivansh19200/asha-sethu/blob/main/web/src/recent.js"
click node_landing "https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Landing.jsx"
click node_demo "https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Demo.jsx"
click node_tour "https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Tour.jsx"

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_describe,node_confirm,node_note,node_noterecord,node_review toneBlue
class node_question,node_result,node_floorweb,node_agent,node_agentgraph,node_understand,node_rules,node_database toneAmber
class node_apiweb,node_transcribe,node_visits,node_referral toneMint
class node_careui,node_careapi,node_home,node_recent,node_asha toneRose
class node_landing,node_demo,node_tour,node_groq toneIndigo
```

## Components

### Visit workflow

- [Screen router](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/App.jsx): `web/src/App.jsx`
- [Describe signs](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Describe.jsx): `web/src/Describe.jsx`
- [Confirm signs](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Confirm.jsx): `web/src/Confirm.jsx`
- [Referral note](https://github.com/shivansh19200/asha-sethu/blob/main/api/note.py): `api/note.py`
- [Review and record](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/NoteRecord.jsx): `web/src/NoteRecord.jsx`
- [Review and send](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/ReviewSend.jsx): `web/src/ReviewSend.jsx`

### Safety assessment

- [Clarify signs](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Question.jsx): `web/src/Question.jsx`
- [Show result](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Result.jsx): `web/src/Result.jsx`
- [Browser safety floor](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/floor.js): `web/src/floor.js`
- [Agent workflow](https://github.com/shivansh19200/asha-sethu/blob/main/api/_agent/core.py): `api/_agent/core.py`
- [Agent graph](https://github.com/shivansh19200/asha-sethu/blob/main/api/_agent/graph.py): `api/_agent/graph.py`
- [Text understanding](https://github.com/shivansh19200/asha-sethu/blob/main/api/understand.py): `api/understand.py`
- [Server safety rules](https://github.com/shivansh19200/asha-sethu/blob/main/api/rules.py): `api/rules.py`

### API services

- [API client](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/api.js): `web/src/api.js`
- [Speech transcription](https://github.com/shivansh19200/asha-sethu/blob/main/api/transcribe.py): `api/transcribe.py`
- [Visit records](https://github.com/shivansh19200/asha-sethu/blob/main/api/visits.py): `api/visits.py`
- [Referral dispatch](https://github.com/shivansh19200/asha-sethu/blob/main/api/referral.py): `api/referral.py`

### Care follow-up

- [Care team view](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Care.jsx): `web/src/Care.jsx`
- [Care services](https://github.com/shivansh19200/asha-sethu/blob/main/api/care.py): `api/care.py`
- [Home and follow-ups](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Home.jsx): `web/src/Home.jsx`
- [Local visit history](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/recent.js): `web/src/recent.js`

### App experience

- [Product landing](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Landing.jsx): `web/src/Landing.jsx`
- [Scenario demo](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Demo.jsx): `web/src/Demo.jsx`
- [Guided tour](https://github.com/shivansh19200/asha-sethu/blob/main/web/src/Tour.jsx): `web/src/Tour.jsx`

### Other components

- **ASHA worker**
- **Supabase Postgres**
- **Groq model**

## Connections

- ASHA worker → Screen router: enters visit (evidence: `README.md`)
- Screen router → Describe signs: routes to (evidence: `web/src/App.jsx`)
- Screen router → Confirm signs: routes to (evidence: `web/src/App.jsx`)
- Screen router → Clarify signs: routes to (evidence: `web/src/App.jsx`)
- Screen router → Show result: routes to (evidence: `web/src/App.jsx`)
- Describe signs → Confirm signs: confirms signs
- Confirm signs → Clarify signs: continues assessment
- Clarify signs → API client: requests agent
- Show result → Browser safety floor: gets level (evidence: `web/src/Result.jsx`)
- API client → Browser safety floor: fallback assessment (evidence: `web/src/api.js`)
- Agent workflow → Server safety rules: uses floor rules (evidence: `api/_agent/core.py`)
- Agent graph → Agent workflow: builds workflow (evidence: `api/_agent/graph.py`)
- API client → Agent workflow: calls agent route
- API client → Text understanding: requests interpretation
- Describe signs → Speech transcription: submits speech
- Show result → Review and record: continues to record
- Review and record → API client: saves visit (evidence: `web/src/NoteRecord.jsx`)
- Review and send → API client: requests note (evidence: `web/src/ReviewSend.jsx`)
- API client → Referral note: requests note service
- Review and send → API client: sends on tap (evidence: `web/src/ReviewSend.jsx`)
- API client → Referral dispatch: posts referral
- API client → Visit records: posts visit
- Visit records → Supabase Postgres: stores visits
- Referral dispatch → Supabase Postgres: records referral
- Care team view → API client: requests care data (evidence: `web/src/Care.jsx`)
- Home and follow-ups → API client: requests history (evidence: `web/src/Home.jsx`)
- Home and follow-ups → Local visit history: reads follow-ups (evidence: `web/src/Home.jsx`)
- Care services → Supabase Postgres: reads care records
- API client → Care services: posts care action
- Product landing → Scenario demo: renders demo (evidence: `web/src/Landing.jsx`)
- Guided tour → Scenario demo: starts scenario (evidence: `web/src/Tour.jsx`)
- Product landing → Screen router: embeds app (evidence: `web/src/main.jsx`)
- Agent workflow → Groq model: uses optional model (evidence: `README.md`)
