# shikhar1809/parcha_hackcbs_9_afterburners architecture

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

- Interactive diagram: https://gitdiagram.com/shikhar1809/parcha_hackcbs_9_afterburners
- Repository: https://github.com/shikhar1809/parcha_hackcbs_9_afterburners

## Overview

Parcha serves patients and their families after a prescription is written, alongside a clinic workflow for registering patients and managing visits. The patient journey turns a prescription or pharmacy bill into a person-confirmed, locked medicine schedule; the app presents doses, records adherence for family visibility, and answers questions from the patient’s records. Shared client and core packages support app state and rules, while Firebase Functions provide server-side operations and the Ask assistant. The README documents these capabilities; unsampled modules are represented at their exact paths, and unshown implementation links are omitted.

Main entry points: [`apps/patient/src/App.tsx`](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/App.tsx) (Patient app shell), [`apps/clinic/src/App.tsx`](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/clinic/src/App.tsx) (Clinic app shell), [`firebase/functions/src/assistant.ts`](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/firebase/functions/src/assistant.ts) (Ask and Meko), [`apps/patient/src/screens/AddParcha.tsx`](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/screens/AddParcha.tsx) (Add Parcha)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patient["Patient app"]
  node_patient_app["Patient app shell<br/>[App.tsx]"]
  node_add_parcha["Add Parcha<br/>[AddParcha.tsx]"]
  node_dose_cards["Dose cards<br/>[DoseCards.tsx]"]
  node_family_views["Family views<br/>[people.tsx]"]
  node_ask["Ask assistant UI<br/>[Ask.tsx]"]
  node_patient_auth["Patient identity<br/>[auth.tsx]"]
  node_patient_language["Language support<br/>[i18n.tsx]"]
end

subgraph group_clinic["Clinic app"]
  node_clinic_app["Clinic app shell<br/>[App.tsx]"]
  node_clinic_manage["Clinic management<br/>[Manage.tsx]"]
  node_clinic_comms["Clinic communications<br/>[Comms.tsx]"]
  node_clinic_consult["Consultation<br/>[Consultation.tsx]"]
end

subgraph group_shared["Shared packages"]
  node_client_firebase["Firebase client<br/>[firebase.ts]"]
  node_client_outbox["Offline outbox<br/>[outbox.ts]"]
  node_client_session["Session handling<br/>[session.tsx]"]
  node_core_items["Medicine rules<br/>[items.ts]"]
  node_core_special["Special medicine rules<br/>[special.ts]"]
end

subgraph group_backend["Firebase backend"]
  node_functions_entry["Callable operations<br/>[index.ts]"]
  node_functions_guards["Server guards<br/>[guards.ts]"]
  node_functions_manage["Server management<br/>[manage.ts]"]
  node_functions_calls["Call handling<br/>[calls.ts]"]
  node_functions_seed["Demo data<br/>[seed.ts]"]
  node_assistant_backend["Ask and Meko<br/>[assistant.ts]"]
end

node_patient(("Patient or family"))
node_firestore[("Firebase database")]

node_patient -->|"uses"| node_patient_app
node_patient_app -->|"routes to"| node_add_parcha
node_patient_app -->|"opens"| node_dose_cards
node_patient_app -->|"shows"| node_family_views
node_patient_app -->|"routes to"| node_ask
node_patient_app -->|"uses"| node_patient_auth
node_add_parcha -->|"searches medicines"| node_core_items
node_add_parcha -->|"saves schedule"| node_client_outbox
node_dose_cards -->|"queues dose updates"| node_client_outbox
node_client_outbox -->|"syncs changes"| node_client_firebase
node_ask -->|"asks questions"| node_assistant_backend
node_assistant_backend -->|"reads patient records"| node_firestore
node_assistant_backend -->|"checks medicine match"| node_core_items
node_assistant_backend -->|"checks expiry and safety"| node_core_special
node_clinic_app -->|"routes to"| node_clinic_manage
node_clinic_app -->|"opens communications"| node_clinic_comms
node_clinic_app -->|"routes to"| node_clinic_consult
node_clinic_app -->|"gates staff access"| node_client_session
node_clinic_manage -.->|"manages clinic data"| node_functions_manage
node_clinic_comms -.->|"handles calls"| node_functions_calls
node_functions_entry -->|"validates requests"| node_functions_guards
node_functions_entry -->|"reads and writes"| node_firestore
node_functions_manage -.->|"stores management data"| node_firestore
node_functions_calls -.->|"stores call data"| node_firestore
node_functions_seed -.->|"seeds demo data"| node_firestore
node_client_firebase -->|"connects to"| node_firestore
node_client_session -->|"calls backend"| node_client_firebase
node_patient_app -.->|"localizes screens"| node_patient_language

click node_patient_app "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/App.tsx"
click node_add_parcha "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/screens/AddParcha.tsx"
click node_dose_cards "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/screens/DoseCards.tsx"
click node_family_views "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/components/people.tsx"
click node_ask "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/screens/Ask.tsx"
click node_patient_auth "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/auth.tsx"
click node_patient_language "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/i18n.tsx"
click node_clinic_app "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/clinic/src/App.tsx"
click node_clinic_manage "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/clinic/src/screens/manage/Manage.tsx"
click node_clinic_comms "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/clinic/src/comms/Comms.tsx"
click node_clinic_consult "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/clinic/src/screens/Consultation.tsx"
click node_client_firebase "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/packages/client/src/firebase.ts"
click node_client_outbox "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/packages/client/src/outbox.ts"
click node_client_session "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/packages/client/src/session.tsx"
click node_core_items "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/packages/core/src/items.ts"
click node_core_special "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/packages/core/src/special.ts"
click node_functions_entry "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/firebase/functions/src/index.ts"
click node_functions_guards "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/firebase/functions/src/guards.ts"
click node_functions_manage "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/firebase/functions/src/manage.ts"
click node_functions_calls "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/firebase/functions/src/calls.ts"
click node_functions_seed "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/firebase/functions/src/seed.ts"
click node_assistant_backend "https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/firebase/functions/src/assistant.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_patient_app,node_add_parcha,node_dose_cards,node_family_views,node_ask,node_patient_auth,node_patient_language toneBlue
class node_clinic_app,node_clinic_manage,node_clinic_comms,node_clinic_consult,node_firestore toneAmber
class node_client_firebase,node_client_outbox,node_client_session,node_core_items,node_core_special toneMint
class node_functions_entry,node_functions_guards,node_functions_manage,node_functions_calls,node_functions_seed,node_assistant_backend toneRose
class node_patient toneIndigo
```

## Components

### Patient app

- [Patient app shell](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/App.tsx): `apps/patient/src/App.tsx`
- [Add Parcha](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/screens/AddParcha.tsx): `apps/patient/src/screens/AddParcha.tsx`
- [Dose cards](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/screens/DoseCards.tsx): `apps/patient/src/screens/DoseCards.tsx`
- [Family views](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/components/people.tsx): `apps/patient/src/components/people.tsx`
- [Ask assistant UI](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/screens/Ask.tsx): `apps/patient/src/screens/Ask.tsx`
- [Patient identity](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/auth.tsx): `apps/patient/src/auth.tsx`
- [Language support](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/patient/src/i18n.tsx): `apps/patient/src/i18n.tsx`

### Clinic app

- [Clinic app shell](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/clinic/src/App.tsx): `apps/clinic/src/App.tsx`
- [Clinic management](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/clinic/src/screens/manage/Manage.tsx): `apps/clinic/src/screens/manage/Manage.tsx`
- [Clinic communications](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/clinic/src/comms/Comms.tsx): `apps/clinic/src/comms/Comms.tsx`
- [Consultation](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/apps/clinic/src/screens/Consultation.tsx): `apps/clinic/src/screens/Consultation.tsx`

### Shared packages

- [Firebase client](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/packages/client/src/firebase.ts): `packages/client/src/firebase.ts`
- [Offline outbox](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/packages/client/src/outbox.ts): `packages/client/src/outbox.ts`
- [Session handling](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/packages/client/src/session.tsx): `packages/client/src/session.tsx`
- [Medicine rules](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/packages/core/src/items.ts): `packages/core/src/items.ts`
- [Special medicine rules](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/packages/core/src/special.ts): `packages/core/src/special.ts`

### Firebase backend

- [Callable operations](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/firebase/functions/src/index.ts): `firebase/functions/src/index.ts`
- [Server guards](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/firebase/functions/src/guards.ts): `firebase/functions/src/guards.ts`
- [Server management](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/firebase/functions/src/manage.ts): `firebase/functions/src/manage.ts`
- [Call handling](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/firebase/functions/src/calls.ts): `firebase/functions/src/calls.ts`
- [Demo data](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/firebase/functions/src/seed.ts): `firebase/functions/src/seed.ts`
- [Ask and Meko](https://github.com/shikhar1809/parcha_hackcbs_9_afterburners/blob/main/firebase/functions/src/assistant.ts): `firebase/functions/src/assistant.ts`

### Other components

- **Patient or family**
- **Firebase database**

## Connections

- Patient or family → Patient app shell: uses (evidence: `README.md`)
- Patient app shell → Add Parcha: routes to (evidence: `apps/patient/src/App.tsx`)
- Patient app shell → Dose cards: opens (evidence: `apps/patient/src/App.tsx`)
- Patient app shell → Family views: shows (evidence: `README.md`)
- Patient app shell → Ask assistant UI: routes to (evidence: `apps/patient/src/App.tsx`)
- Patient app shell → Patient identity: uses (evidence: `apps/patient/src/main.tsx`)
- Add Parcha → Medicine rules: searches medicines (evidence: `apps/patient/src/screens/AddParcha.tsx`)
- Add Parcha → Offline outbox: saves schedule (evidence: `README.md`)
- Dose cards → Offline outbox: queues dose updates (evidence: `README.md`)
- Offline outbox → Firebase client: syncs changes (evidence: `packages/client/src/session.tsx`)
- Ask assistant UI → Ask and Meko: asks questions (evidence: `README.md`)
- Ask and Meko → Firebase database: reads patient records (evidence: `README.md`)
- Ask and Meko → Medicine rules: checks medicine match (evidence: `README.md`)
- Ask and Meko → Special medicine rules: checks expiry and safety (evidence: `README.md`)
- Clinic app shell → Clinic management: routes to (evidence: `apps/clinic/src/App.tsx`)
- Clinic app shell → Clinic communications: opens communications (evidence: `apps/clinic/src/App.tsx`)
- Clinic app shell → Consultation: routes to (evidence: `apps/clinic/src/App.tsx`)
- Clinic app shell → Session handling: gates staff access (evidence: `apps/clinic/src/App.tsx`)
- Clinic management → Server management: manages clinic data
- Clinic communications → Call handling: handles calls
- Callable operations → Server guards: validates requests (evidence: `firebase/functions/src/index.ts`)
- Callable operations → Firebase database: reads and writes (evidence: `firebase/functions/src/index.ts`)
- Server management → Firebase database: stores management data
- Call handling → Firebase database: stores call data
- Demo data → Firebase database: seeds demo data
- Firebase client → Firebase database: connects to
- Session handling → Firebase client: calls backend (evidence: `packages/client/src/session.tsx`)
- Patient app shell → Language support: localizes screens (evidence: `apps/patient/src/App.tsx`)
