# nmedussuriya/chdr-mobileapp architecture

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

- Interactive diagram: https://gitdiagram.com/nmedussuriya/chdr-mobileapp
- Repository: https://github.com/nmedussuriya/chdr-mobileapp

## Overview

CHDR is a mobile child-health record system for parents and midwives. Parents sign in to review child information, track milestones and vaccination, submit milestone reports, and ask the AI assistant for guidance. Midwives manage assigned children, enter health and immunization records, confirm milestones, review screening responses, and generate reports. The graph preserves these distinct domains and the Firebase/OpenAI service layer. Some screen-to-service wiring is unsampled; those relationships are omitted or shown as unverified rather than asserted as inspected.

Main entry points: [`app/index.tsx`](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/index.tsx) (Welcome and routing), [`firebase/services/childrenService.ts`](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/firebase/services/childrenService.ts) (Child profiles), [`firebase/services/authService.ts`](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/firebase/services/authService.ts) (Authentication service), [`firebase/firebaseConfig.ts`](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/firebase/firebaseConfig.ts) (Firestore)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and dashboards"]
  node_welcome["Welcome and routing<br/>[index.tsx]"]
  node_parentlogin["Parent sign-in<br/>[parent-login.tsx]"]
  node_midwifelogin["Midwife sign-in<br/>[midwife-login.tsx]"]
  node_parentdashboard["Parent dashboard"]
  node_midwifedashboard["Midwife dashboard"]
end

subgraph group_childcare["Child records and care"]
  node_children["Child profiles<br/>[childrenService.ts]"]
  node_childform["Add child record<br/>[add_child_form.tsx]"]
  node_health["Health and follow-ups"]
  node_parentimmunization["Parent vaccination view<br/>[Immunization.tsx]"]
  node_midwifeimmunization["Record immunization<br/>[immunization.tsx]"]
end

subgraph group_development["Development and screening"]
  node_milestones["Parent milestone report"]
  node_confirmation["Confirm milestones"]
  node_screening["Screening responses"]
  node_report["Child health report"]
  node_chat["AI health chat<br/>[AIChatScreen.tsx]"]
end

subgraph group_services["Services and data"]
  node_authservice["Authentication service<br/>[authService.ts]"]
  node_childmilestones["Milestone records"]
  node_ai["AI response service<br/>[realAIService.ts]"]
  node_firestore[("Firestore<br/>[firebaseConfig.ts]")]
end

node_parent(("Parent"))
node_midwife(("Midwife"))
node_openai{{"OpenAI"}}

node_parent -->|"opens app"| node_welcome
node_midwife -->|"opens app"| node_welcome
node_welcome -->|"offers sign-in"| node_parentlogin
node_welcome -->|"offers sign-in"| node_midwifelogin
node_parent -->|"manages child health"| node_parentdashboard
node_midwife -->|"manages assigned children"| node_midwifedashboard
node_parentlogin -.->|"authenticates via"| node_authservice
node_midwifelogin -.->|"authenticates via"| node_authservice
node_authservice -->|"reads and writes"| node_firestore
node_midwifedashboard -.->|"loads child records"| node_children
node_childform -.->|"creates child record"| node_children
node_health -->|"reads child data"| node_children
node_parentdashboard -.->|"views child information"| node_children
node_parent -->|"views vaccination schedule"| node_parentimmunization
node_midwife -->|"records vaccinations"| node_midwifeimmunization
node_parent -->|"submits milestones"| node_milestones
node_milestones -->|"submits records"| node_childmilestones
node_midwife -->|"confirms milestones"| node_confirmation
node_midwife -->|"reviews screening"| node_screening
node_midwife -->|"generates report"| node_report
node_report -->|"reads report data"| node_firestore
node_parent -->|"requests health guidance"| node_chat
node_chat -->|"requests response"| node_ai
node_ai -->|"requests completion"| node_openai
node_childmilestones -->|"stores milestone records"| node_firestore

click node_welcome "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/index.tsx"
click node_parentlogin "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/parent/parent-login.tsx"
click node_midwifelogin "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/midwife-login.tsx"
click node_parentdashboard "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/parent/parent-dashboard.tsx"
click node_midwifedashboard "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/MidwifeDashboard.tsx"
click node_children "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/firebase/services/childrenService.ts"
click node_childform "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/add_child_form.tsx"
click node_health "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/child-health-form.tsx"
click node_parentimmunization "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/parent/Immunization.tsx"
click node_midwifeimmunization "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/immunization.tsx"
click node_milestones "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/parent/add_development_milestone.tsx"
click node_confirmation "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/confirm_development_milestone.tsx"
click node_screening "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/view-screening-response.tsx"
click node_report "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/ChildReportScreen.tsx"
click node_chat "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/parent/AIChatScreen.tsx"
click node_authservice "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/firebase/services/authService.ts"
click node_childmilestones "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/firebase/services/childMilestonesService.ts"
click node_ai "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/firebase/services/realAIService.ts"
click node_firestore "https://github.com/nmedussuriya/chdr-mobileapp/blob/main/firebase/firebaseConfig.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_welcome,node_parentlogin,node_midwifelogin,node_parentdashboard,node_midwifedashboard toneBlue
class node_children,node_childform,node_health,node_parentimmunization,node_midwifeimmunization toneAmber
class node_milestones,node_confirmation,node_screening,node_report,node_chat toneMint
class node_authservice,node_childmilestones,node_ai,node_firestore toneRose
class node_parent,node_midwife,node_openai toneIndigo
```

## Components

### Access and dashboards

- [Welcome and routing](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/index.tsx): `app/index.tsx`
- [Parent sign-in](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/parent/parent-login.tsx): `app/parent/parent-login.tsx`
- [Midwife sign-in](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/midwife-login.tsx): `app/midwife_details/midwife-login.tsx`
- [Parent dashboard](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/parent/parent-dashboard.tsx): `app/parent/parent-dashboard.tsx`
- [Midwife dashboard](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/MidwifeDashboard.tsx): `app/midwife_details/MidwifeDashboard.tsx`

### Child records and care

- [Child profiles](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/firebase/services/childrenService.ts): `firebase/services/childrenService.ts`
- [Add child record](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/add_child_form.tsx): `app/midwife_details/add_child_form.tsx`
- [Health and follow-ups](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/child-health-form.tsx): `app/midwife_details/child-health-form.tsx`
- [Parent vaccination view](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/parent/Immunization.tsx): `app/parent/Immunization.tsx`
- [Record immunization](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/immunization.tsx): `app/midwife_details/immunization.tsx`

### Development and screening

- [Parent milestone report](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/parent/add_development_milestone.tsx): `app/parent/add_development_milestone.tsx`
- [Confirm milestones](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/confirm_development_milestone.tsx): `app/midwife_details/confirm_development_milestone.tsx`
- [Screening responses](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/view-screening-response.tsx): `app/midwife_details/view-screening-response.tsx`
- [Child health report](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/midwife_details/ChildReportScreen.tsx): `app/midwife_details/ChildReportScreen.tsx`
- [AI health chat](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/app/parent/AIChatScreen.tsx): `app/parent/AIChatScreen.tsx`

### Services and data

- [Authentication service](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/firebase/services/authService.ts): `firebase/services/authService.ts`
- [Milestone records](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/firebase/services/childMilestonesService.ts): `firebase/services/childMilestonesService.ts`
- [AI response service](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/firebase/services/realAIService.ts): `firebase/services/realAIService.ts`
- [Firestore](https://github.com/nmedussuriya/chdr-mobileapp/blob/main/firebase/firebaseConfig.ts): `firebase/firebaseConfig.ts`

### Other components

- **Parent**
- **Midwife**
- **OpenAI**

## Connections

- Parent → Welcome and routing: opens app (evidence: `README.md`)
- Midwife → Welcome and routing: opens app (evidence: `README.md`)
- Welcome and routing → Parent sign-in: offers sign-in (evidence: `app/index.tsx`)
- Welcome and routing → Midwife sign-in: offers sign-in (evidence: `app/index.tsx`)
- Parent → Parent dashboard: manages child health (evidence: `README.md`)
- Midwife → Midwife dashboard: manages assigned children (evidence: `README.md`)
- Parent sign-in → Authentication service: authenticates via
- Midwife sign-in → Authentication service: authenticates via
- Authentication service → Firestore: reads and writes (evidence: `firebase/services/authService.ts`)
- Midwife dashboard → Child profiles: loads child records
- Add child record → Child profiles: creates child record
- Health and follow-ups → Child profiles: reads child data (evidence: `app/midwife_details/child-health-form.tsx`)
- Parent dashboard → Child profiles: views child information
- Parent → Parent vaccination view: views vaccination schedule (evidence: `README.md`)
- Midwife → Record immunization: records vaccinations (evidence: `README.md`)
- Parent → Parent milestone report: submits milestones (evidence: `README.md`)
- Parent milestone report → Milestone records: submits records (evidence: `app/parent/add_development_milestone.tsx`)
- Midwife → Confirm milestones: confirms milestones (evidence: `README.md`)
- Midwife → Screening responses: reviews screening (evidence: `README.md`)
- Midwife → Child health report: generates report (evidence: `README.md`)
- Child health report → Firestore: reads report data (evidence: `app/midwife_details/ChildReportScreen.tsx`)
- Parent → AI health chat: requests health guidance (evidence: `README.md`)
- AI health chat → AI response service: requests response (evidence: `app/parent/AIChatScreen.tsx`)
- AI response service → OpenAI: requests completion (evidence: `firebase/services/realAIService.ts`)
- Milestone records → Firestore: stores milestone records (evidence: `firebase/services/childMilestonesService.ts`)
