# allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app architecture

> Architecture diagram of the GitHub repository allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app
- Repository: https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app

## Overview

This is an offline-first paramedic triage intake app. A responder enters patient details, priority and transport status; the app saves the record locally before updating the UI, then attempts upload. Pending records are retried on connectivity restoration or app foregrounding, and the record list and banner expose sync state. The excerpts show the store coordinating persistence and synchronization, plus a simulated API. Other documented behavior is retained where supported; unsampled details are not expanded.

Main entry points: [`services/sync.ts`](https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/services/sync.ts) (Sync coordinator), [`components/TriageForm.tsx`](https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/components/TriageForm.tsx) (Triage form), [`store/useTriageStore.ts`](https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/store/useTriageStore.ts) (Triage store), [`App.tsx`](https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/App.tsx) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Triage capture"]
  node_app["App shell<br/>[App.tsx]"]
  node_form["Triage form<br/>[TriageForm.tsx]"]
  node_priority["Priority badge<br/>[PriorityBadge.tsx]"]
end

subgraph group_state["State and persistence"]
  node_record["Triage record<br/>[types.ts]"]
  node_store["Triage store<br/>[useTriageStore.ts]"]
  node_storage[("Local persistence<br/>[storage.ts]")]
end

subgraph group_sync["Synchronization"]
  node_sync["Sync coordinator<br/>[sync.ts]"]
  node_connectivity["Network monitor<br/>[sync.ts]"]
  node_lifecycle["App lifecycle<br/>[sync.ts]"]
  node_api["Mock triage API<br/>[api.ts]"]
end

subgraph group_presentation["Status presentation"]
  node_records["Record list<br/>[RecordList.tsx]"]
end

node_responder(("Paramedic"))
node_server(("Simulated server"))

node_responder -->|"enters details"| node_form
node_app -->|"renders"| node_form
node_app -->|"renders"| node_records
node_form -->|"submits record"| node_store
node_form -->|"renders choices"| node_priority
node_store -->|"saves and loads"| node_storage
node_store -->|"requests sync"| node_sync
node_app -->|"registers listeners"| node_sync
node_app -->|"loads records"| node_store
node_records -->|"reads records"| node_store
node_records -->|"renders badge"| node_priority
node_sync -->|"checks connectivity"| node_connectivity
node_sync -->|"listens for foreground"| node_lifecycle
node_sync -->|"loads pending; marks synced"| node_storage
node_sync -->|"posts records"| node_api
node_api -->|"simulates upload"| node_server
node_storage -->|"persists records"| node_record
node_form -->|"collects fields"| node_record

click node_app "https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/App.tsx"
click node_form "https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/components/TriageForm.tsx"
click node_priority "https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/components/PriorityBadge.tsx"
click node_record "https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/services/types.ts"
click node_store "https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/store/useTriageStore.ts"
click node_storage "https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/services/storage.ts"
click node_records "https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/components/RecordList.tsx"
click node_sync "https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/services/sync.ts"
click node_connectivity "https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/services/sync.ts"
click node_lifecycle "https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/services/sync.ts"
click node_api "https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/services/api.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_form,node_priority toneBlue
class node_record,node_store,node_storage toneAmber
class node_sync,node_connectivity,node_lifecycle,node_api,node_server toneMint
class node_records toneRose
class node_responder toneIndigo
```

## Components

### Triage capture

- [App shell](https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/App.tsx): `App.tsx`
- [Triage form](https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/components/TriageForm.tsx): `components/TriageForm.tsx`
- [Priority badge](https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/components/PriorityBadge.tsx): `components/PriorityBadge.tsx`

### State and persistence

- [Triage record](https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/services/types.ts): `services/types.ts`
- [Triage store](https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/store/useTriageStore.ts): `store/useTriageStore.ts`
- [Local persistence](https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/services/storage.ts): `services/storage.ts`

### Synchronization

- [Sync coordinator](https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/services/sync.ts): `services/sync.ts`
- [Network monitor](https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/services/sync.ts): `services/sync.ts`
- [App lifecycle](https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/services/sync.ts): `services/sync.ts`
- [Mock triage API](https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/services/api.ts): `services/api.ts`

### Status presentation

- [Record list](https://github.com/allan-kipkemei/paramedic-triage-intake-offline-first-mobile-app/blob/master/components/RecordList.tsx): `components/RecordList.tsx`

### Other components

- **Paramedic**
- **Simulated server**

## Connections

- Paramedic → Triage form: enters details (evidence: `components/TriageForm.tsx`)
- App shell → Triage form: renders (evidence: `App.tsx`)
- App shell → Record list: renders (evidence: `App.tsx`)
- Triage form → Triage store: submits record (evidence: `components/TriageForm.tsx`)
- Triage form → Priority badge: renders choices (evidence: `components/TriageForm.tsx`)
- Triage store → Local persistence: saves and loads (evidence: `store/useTriageStore.ts`)
- Triage store → Sync coordinator: requests sync (evidence: `store/useTriageStore.ts`)
- App shell → Sync coordinator: registers listeners (evidence: `App.tsx`)
- App shell → Triage store: loads records (evidence: `App.tsx`)
- Record list → Triage store: reads records (evidence: `components/RecordList.tsx`)
- Record list → Priority badge: renders badge (evidence: `components/RecordList.tsx`)
- Sync coordinator → Network monitor: checks connectivity (evidence: `services/sync.ts`)
- Sync coordinator → App lifecycle: listens for foreground (evidence: `services/sync.ts`)
- Sync coordinator → Local persistence: loads pending; marks synced (evidence: `services/sync.ts`)
- Sync coordinator → Mock triage API: posts records (evidence: `services/sync.ts`)
- Mock triage API → Simulated server: simulates upload (evidence: `services/api.ts`)
- Local persistence → Triage record: persists records (evidence: `services/storage.ts`)
- Triage form → Triage record: collects fields (evidence: `components/TriageForm.tsx`)
