# aditya-raj52/medvani architecture

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

## Overview

MedVani is an offline-first emergency-response web app for first responders. Users select a capability from the navigation: hear Hindi first-aid instructions, create and save a medical ID with a QR code, scan medicine packaging or prescriptions and review saved results, or find hospitals and dial helplines. A separate SOS flow launches calling or messaging actions. The source excerpts establish component dispatch and the main data/service calls; unsampled navigation and modal internals are represented only where App.jsx shows their role.

Main entry points: [`src/App.jsx`](https://github.com/aditya-raj52/medvani/blob/main/src/App.jsx) (Application shell), [`src/components/MedicalIDForm.jsx`](https://github.com/aditya-raj52/medvani/blob/main/src/components/MedicalIDForm.jsx) (Medical ID form), [`src/components/MedicineScanner.jsx`](https://github.com/aditya-raj52/medvani/blob/main/src/components/MedicineScanner.jsx) (Prescription scanner), [`src/components/EmergencyVoicePlayer.jsx`](https://github.com/aditya-raj52/medvani/blob/main/src/components/EmergencyVoicePlayer.jsx) (First-aid voice player)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App shell"]
  node_app["Application shell<br/>[App.jsx]"]
  node_nav["Navigation<br/>[Navbar.jsx]"]
  node_pitch["Overview modal"]
  node_sos["Quick SOS dialing<br/>[App.jsx]"]
end

subgraph group_emergency["Emergency guidance"]
  node_voice["First-aid voice player"]
  node_procedures["Emergency procedures<br/>[emergencyConfig.js]"]
  node_speech["Speech synthesis<br/>[speechService.js]"]
  node_helplines["Emergency helplines<br/>[emergencyConfig.js]"]
end

subgraph group_profile["Medical profile"]
  node_medical["Medical ID form<br/>[MedicalIDForm.jsx]"]
  node_profiledb[("Local profile store<br/>[schema.js]")]
  node_qr["QR SVG generator<br/>[qrCode.js]"]
end

subgraph group_medicine["Medicine scanning"]
  node_scanner["Prescription scanner"]
  node_ocr["OCR and text parser<br/>[ocrService.js]"]
  node_scandb[("Saved scan store<br/>[schema.js]")]
end

subgraph group_directory["Emergency directory"]
  node_directory["Hospital directory"]
  node_hospitaldata["Hospital listings<br/>[emergencyConfig.js]"]
end

node_user(("First responder"))
node_external["Phone, SMS, WhatsApp, Maps"]

node_user -->|"opens"| node_app
node_app -->|"renders"| node_nav
node_app -->|"selects tab"| node_voice
node_app -->|"selects tab"| node_medical
node_app -->|"selects tab"| node_scanner
node_app -->|"selects tab"| node_directory
node_nav -->|"opens SOS or overview"| node_app
node_app -->|"renders"| node_pitch
node_app -->|"renders"| node_sos
node_sos -->|"dials numbers"| node_external
node_voice -->|"reads guidance"| node_procedures
node_voice -->|"requests speech"| node_speech
node_speech -->|"reads defaults"| node_procedures
node_voice -.->|"reads numbers"| node_helplines
node_medical -->|"loads and saves"| node_profiledb
node_medical -->|"generates code"| node_qr
node_medical -->|"reads profile options"| node_procedures
node_medical -->|"shares SOS"| node_external
node_scanner -->|"processes prescription"| node_ocr
node_scanner -->|"loads and saves scans"| node_scandb
node_scanner -->|"requests readout"| node_speech
node_scanner -->|"uses sample presets"| node_ocr
node_directory -->|"reads listings"| node_hospitaldata
node_directory -->|"reads numbers"| node_helplines
node_directory -->|"dials or maps"| node_external

click node_app "https://github.com/aditya-raj52/medvani/blob/main/src/App.jsx"
click node_nav "https://github.com/aditya-raj52/medvani/blob/main/src/components/Navbar.jsx"
click node_pitch "https://github.com/aditya-raj52/medvani/blob/main/src/components/SupervisorPitchModal.jsx"
click node_sos "https://github.com/aditya-raj52/medvani/blob/main/src/App.jsx"
click node_voice "https://github.com/aditya-raj52/medvani/blob/main/src/components/EmergencyVoicePlayer.jsx"
click node_procedures "https://github.com/aditya-raj52/medvani/blob/main/src/config/emergencyConfig.js"
click node_speech "https://github.com/aditya-raj52/medvani/blob/main/src/services/speechService.js"
click node_helplines "https://github.com/aditya-raj52/medvani/blob/main/src/config/emergencyConfig.js"
click node_medical "https://github.com/aditya-raj52/medvani/blob/main/src/components/MedicalIDForm.jsx"
click node_profiledb "https://github.com/aditya-raj52/medvani/blob/main/src/db/schema.js"
click node_qr "https://github.com/aditya-raj52/medvani/blob/main/src/utils/qrCode.js"
click node_scanner "https://github.com/aditya-raj52/medvani/blob/main/src/components/MedicineScanner.jsx"
click node_ocr "https://github.com/aditya-raj52/medvani/blob/main/src/services/ocrService.js"
click node_scandb "https://github.com/aditya-raj52/medvani/blob/main/src/db/schema.js"
click node_directory "https://github.com/aditya-raj52/medvani/blob/main/src/components/HospitalDirectory.jsx"
click node_hospitaldata "https://github.com/aditya-raj52/medvani/blob/main/src/config/emergencyConfig.js"

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_nav,node_pitch,node_sos toneBlue
class node_voice,node_procedures,node_speech,node_helplines toneAmber
class node_medical,node_profiledb,node_qr toneMint
class node_scanner,node_ocr,node_scandb toneRose
class node_directory,node_hospitaldata,node_user,node_external toneIndigo
```

## Components

### App shell

- [Application shell](https://github.com/aditya-raj52/medvani/blob/main/src/App.jsx): `src/App.jsx`
- [Navigation](https://github.com/aditya-raj52/medvani/blob/main/src/components/Navbar.jsx): `src/components/Navbar.jsx`
- [Overview modal](https://github.com/aditya-raj52/medvani/blob/main/src/components/SupervisorPitchModal.jsx): `src/components/SupervisorPitchModal.jsx`
- [Quick SOS dialing](https://github.com/aditya-raj52/medvani/blob/main/src/App.jsx): `src/App.jsx`

### Emergency guidance

- [First-aid voice player](https://github.com/aditya-raj52/medvani/blob/main/src/components/EmergencyVoicePlayer.jsx): `src/components/EmergencyVoicePlayer.jsx`
- [Emergency procedures](https://github.com/aditya-raj52/medvani/blob/main/src/config/emergencyConfig.js): `src/config/emergencyConfig.js`
- [Speech synthesis](https://github.com/aditya-raj52/medvani/blob/main/src/services/speechService.js): `src/services/speechService.js`
- [Emergency helplines](https://github.com/aditya-raj52/medvani/blob/main/src/config/emergencyConfig.js): `src/config/emergencyConfig.js`

### Medical profile

- [Medical ID form](https://github.com/aditya-raj52/medvani/blob/main/src/components/MedicalIDForm.jsx): `src/components/MedicalIDForm.jsx`
- [Local profile store](https://github.com/aditya-raj52/medvani/blob/main/src/db/schema.js): `src/db/schema.js`
- [QR SVG generator](https://github.com/aditya-raj52/medvani/blob/main/src/utils/qrCode.js): `src/utils/qrCode.js`

### Medicine scanning

- [Prescription scanner](https://github.com/aditya-raj52/medvani/blob/main/src/components/MedicineScanner.jsx): `src/components/MedicineScanner.jsx`
- [OCR and text parser](https://github.com/aditya-raj52/medvani/blob/main/src/services/ocrService.js): `src/services/ocrService.js`
- [Saved scan store](https://github.com/aditya-raj52/medvani/blob/main/src/db/schema.js): `src/db/schema.js`

### Emergency directory

- [Hospital directory](https://github.com/aditya-raj52/medvani/blob/main/src/components/HospitalDirectory.jsx): `src/components/HospitalDirectory.jsx`
- [Hospital listings](https://github.com/aditya-raj52/medvani/blob/main/src/config/emergencyConfig.js): `src/config/emergencyConfig.js`

### Other components

- **First responder**
- **Phone, SMS, WhatsApp, Maps**

## Connections

- First responder → Application shell: opens
- Application shell → Navigation: renders (evidence: `src/App.jsx`)
- Application shell → First-aid voice player: selects tab (evidence: `src/App.jsx`)
- Application shell → Medical ID form: selects tab (evidence: `src/App.jsx`)
- Application shell → Prescription scanner: selects tab (evidence: `src/App.jsx`)
- Application shell → Hospital directory: selects tab (evidence: `src/App.jsx`)
- Navigation → Application shell: opens SOS or overview (evidence: `src/App.jsx`)
- Application shell → Overview modal: renders (evidence: `src/App.jsx`)
- Application shell → Quick SOS dialing: renders (evidence: `src/App.jsx`)
- Quick SOS dialing → Phone, SMS, WhatsApp, Maps: dials numbers (evidence: `src/App.jsx`)
- First-aid voice player → Emergency procedures: reads guidance (evidence: `src/components/EmergencyVoicePlayer.jsx`)
- First-aid voice player → Speech synthesis: requests speech (evidence: `src/components/EmergencyVoicePlayer.jsx`)
- Speech synthesis → Emergency procedures: reads defaults (evidence: `src/services/speechService.js`)
- First-aid voice player → Emergency helplines: reads numbers (evidence: `src/components/EmergencyVoicePlayer.jsx`)
- Medical ID form → Local profile store: loads and saves (evidence: `src/components/MedicalIDForm.jsx`)
- Medical ID form → QR SVG generator: generates code (evidence: `src/components/MedicalIDForm.jsx`)
- Medical ID form → Emergency procedures: reads profile options (evidence: `src/components/MedicalIDForm.jsx`)
- Medical ID form → Phone, SMS, WhatsApp, Maps: shares SOS (evidence: `src/components/MedicalIDForm.jsx`)
- Prescription scanner → OCR and text parser: processes prescription (evidence: `src/components/MedicineScanner.jsx`)
- Prescription scanner → Saved scan store: loads and saves scans (evidence: `src/components/MedicineScanner.jsx`)
- Prescription scanner → Speech synthesis: requests readout (evidence: `src/components/MedicineScanner.jsx`)
- Prescription scanner → OCR and text parser: uses sample presets (evidence: `src/components/MedicineScanner.jsx`)
- Hospital directory → Hospital listings: reads listings (evidence: `src/components/HospitalDirectory.jsx`)
- Hospital directory → Emergency helplines: reads numbers (evidence: `src/components/HospitalDirectory.jsx`)
- Hospital directory → Phone, SMS, WhatsApp, Maps: dials or maps (evidence: `src/components/HospitalDirectory.jsx`)
