# medventures/haqaton-030 architecture

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

- Interactive diagram: https://gitdiagram.com/medventures/haqaton-030
- Repository: https://github.com/medventures/haqaton-030

## Overview

AqylRoute AI is a parent-facing support-route demo. The main journey gathers family and child information, generates a suggested route, and lets the parent upload, review, correct, and confirm a PMPK document. The README also describes later KPPK booking and weekly scheduling as synthetic browser-tab steps. The graph preserves the catalog and case-plan domain as internal planning capabilities. Some UI and persistence details were not sampled; those links are shown only where the README or indexed source references support them.

Main entry points: [`src/server/pmpk-api.ts`](https://github.com/medventures/haqaton-030/blob/main/src/server/pmpk-api.ts) (PMPK API), [`src/server/parent-route-api.ts`](https://github.com/medventures/haqaton-030/blob/main/src/server/parent-route-api.ts) (Route API), [`src/domain/parent-route.ts`](https://github.com/medventures/haqaton-030/blob/main/src/domain/parent-route.ts) (Route assembly), [`src/app/parent/parent-journey.tsx`](https://github.com/medventures/haqaton-030/blob/main/src/app/parent/parent-journey.tsx) (Parent dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_parent_experience["Parent experience"]
  node_auth["Sign-in actions<br/>[actions.ts]"]
  node_dashboard["Parent dashboard<br/>[parent-journey.tsx]"]
  node_interview_ui["Interview UI<br/>[interview.tsx]"]
end

subgraph group_route_planning["Route planning"]
  node_interview_model["Interview questions<br/>[interview.ts]"]
  node_route_api["Route API"]
  node_route_domain["Route assembly<br/>[parent-route.ts]"]
  node_catalog["Service catalog<br/>[v1.ts]"]
  node_conditions["Eligibility conditions<br/>[conditions.ts]"]
  node_route_ai["Route generation<br/>[route-openai.ts]"]
  node_route_stages["Route stages and scheduling<br/>[route.ts]"]
end

subgraph group_pmpk["PMPK documents"]
  node_pmpk_ui["PMPK review UI<br/>[pmpk-step.tsx]"]
  node_pmpk_client["PMPK client<br/>[pmpk-client.ts]"]
  node_pmpk_api["PMPK API<br/>[pmpk-api.ts]"]
  node_pmpk_domain["PMPK validation<br/>[pmpk.ts]"]
  node_pmpk_ai["Document extraction<br/>[pmpk-openai.ts]"]
end

subgraph group_platform["Services and data"]
  node_supabase[("Supabase")]
  node_openai["OpenAI"]
end

subgraph group_case_plan["Case-plan domain"]
  node_case_schema["Case-plan schema<br/>[schema.ts]"]
  node_case_validation["Plan validation<br/>[validate.ts]"]
  node_case_transitions["Plan transitions<br/>[transitions.ts]"]
end

node_parent(("Parent"))

node_parent -->|"signs in"| node_auth
node_auth -->|"authenticates"| node_supabase
node_parent -.->|"provides answers"| node_interview_ui
node_interview_ui -.->|"validates answers"| node_interview_model
node_parent -->|"uses dashboard"| node_dashboard
node_dashboard -.->|"requests route"| node_route_api
node_route_api -->|"reads and saves route"| node_supabase
node_route_api -->|"checks completeness"| node_route_domain
node_route_api -->|"generates plan"| node_route_ai
node_route_domain -->|"selects actions"| node_catalog
node_route_domain -->|"evaluates eligibility"| node_conditions
node_route_ai -->|"requests generation"| node_openai
node_route_ai -->|"assembles output"| node_route_domain
node_parent -->|"uploads and reviews"| node_pmpk_ui
node_pmpk_ui -->|"calls client"| node_pmpk_client
node_pmpk_client -->|"calls API"| node_pmpk_api
node_pmpk_api -->|"validates fields"| node_pmpk_domain
node_pmpk_api -->|"stores document"| node_supabase
node_pmpk_api -->|"requests parsing"| node_pmpk_ai
node_pmpk_ai -->|"extracts fields"| node_openai
node_pmpk_api -->|"supplies route inputs"| node_route_api
node_dashboard -.->|"shows later steps"| node_route_stages
node_case_validation -->|"validates against"| node_case_schema
node_case_transitions -->|"uses plan types"| node_case_schema

click node_auth "https://github.com/medventures/haqaton-030/blob/main/src/app/auth/actions.ts"
click node_dashboard "https://github.com/medventures/haqaton-030/blob/main/src/app/parent/parent-journey.tsx"
click node_interview_ui "https://github.com/medventures/haqaton-030/blob/main/src/app/parent/interview/interview.tsx"
click node_interview_model "https://github.com/medventures/haqaton-030/blob/main/src/lib/interview.ts"
click node_route_api "https://github.com/medventures/haqaton-030/blob/main/src/server/parent-route-api.ts"
click node_route_domain "https://github.com/medventures/haqaton-030/blob/main/src/domain/parent-route.ts"
click node_catalog "https://github.com/medventures/haqaton-030/blob/main/src/domain/catalog/v1.ts"
click node_conditions "https://github.com/medventures/haqaton-030/blob/main/src/domain/conditions.ts"
click node_route_ai "https://github.com/medventures/haqaton-030/blob/main/src/server/route-openai.ts"
click node_pmpk_ui "https://github.com/medventures/haqaton-030/blob/main/src/app/parent/pmpk-step.tsx"
click node_pmpk_client "https://github.com/medventures/haqaton-030/blob/main/src/app/parent/pmpk-client.ts"
click node_pmpk_api "https://github.com/medventures/haqaton-030/blob/main/src/server/pmpk-api.ts"
click node_pmpk_domain "https://github.com/medventures/haqaton-030/blob/main/src/domain/pmpk.ts"
click node_pmpk_ai "https://github.com/medventures/haqaton-030/blob/main/src/server/pmpk-openai.ts"
click node_route_stages "https://github.com/medventures/haqaton-030/blob/main/src/domain/route/route.ts"
click node_case_schema "https://github.com/medventures/haqaton-030/blob/main/src/domain/case-plan/schema.ts"
click node_case_validation "https://github.com/medventures/haqaton-030/blob/main/src/domain/case-plan/validate.ts"
click node_case_transitions "https://github.com/medventures/haqaton-030/blob/main/src/domain/case-plan/transitions.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_auth,node_dashboard,node_interview_ui toneBlue
class node_interview_model,node_route_api,node_route_domain,node_catalog,node_conditions,node_route_ai,node_route_stages toneAmber
class node_pmpk_ui,node_pmpk_client,node_pmpk_api,node_pmpk_domain,node_pmpk_ai toneMint
class node_supabase,node_openai toneRose
class node_case_schema,node_case_validation,node_case_transitions,node_parent toneIndigo
```

## Components

### Parent experience

- [Sign-in actions](https://github.com/medventures/haqaton-030/blob/main/src/app/auth/actions.ts): `src/app/auth/actions.ts`
- [Parent dashboard](https://github.com/medventures/haqaton-030/blob/main/src/app/parent/parent-journey.tsx): `src/app/parent/parent-journey.tsx`
- [Interview UI](https://github.com/medventures/haqaton-030/blob/main/src/app/parent/interview/interview.tsx): `src/app/parent/interview/interview.tsx`

### Route planning

- [Interview questions](https://github.com/medventures/haqaton-030/blob/main/src/lib/interview.ts): `src/lib/interview.ts`
- [Route API](https://github.com/medventures/haqaton-030/blob/main/src/server/parent-route-api.ts): `src/server/parent-route-api.ts`
- [Route assembly](https://github.com/medventures/haqaton-030/blob/main/src/domain/parent-route.ts): `src/domain/parent-route.ts`
- [Service catalog](https://github.com/medventures/haqaton-030/blob/main/src/domain/catalog/v1.ts): `src/domain/catalog/v1.ts`
- [Eligibility conditions](https://github.com/medventures/haqaton-030/blob/main/src/domain/conditions.ts): `src/domain/conditions.ts`
- [Route generation](https://github.com/medventures/haqaton-030/blob/main/src/server/route-openai.ts): `src/server/route-openai.ts`
- [Route stages and scheduling](https://github.com/medventures/haqaton-030/blob/main/src/domain/route/route.ts): `src/domain/route/route.ts`

### PMPK documents

- [PMPK review UI](https://github.com/medventures/haqaton-030/blob/main/src/app/parent/pmpk-step.tsx): `src/app/parent/pmpk-step.tsx`
- [PMPK client](https://github.com/medventures/haqaton-030/blob/main/src/app/parent/pmpk-client.ts): `src/app/parent/pmpk-client.ts`
- [PMPK API](https://github.com/medventures/haqaton-030/blob/main/src/server/pmpk-api.ts): `src/server/pmpk-api.ts`
- [PMPK validation](https://github.com/medventures/haqaton-030/blob/main/src/domain/pmpk.ts): `src/domain/pmpk.ts`
- [Document extraction](https://github.com/medventures/haqaton-030/blob/main/src/server/pmpk-openai.ts): `src/server/pmpk-openai.ts`

### Services and data

- **Supabase**
- **OpenAI**

### Case-plan domain

- [Case-plan schema](https://github.com/medventures/haqaton-030/blob/main/src/domain/case-plan/schema.ts): `src/domain/case-plan/schema.ts`
- [Plan validation](https://github.com/medventures/haqaton-030/blob/main/src/domain/case-plan/validate.ts): `src/domain/case-plan/validate.ts`
- [Plan transitions](https://github.com/medventures/haqaton-030/blob/main/src/domain/case-plan/transitions.ts): `src/domain/case-plan/transitions.ts`

### Other components

- **Parent**

## Connections

- Parent → Sign-in actions: signs in
- Sign-in actions → Supabase: authenticates (evidence: `src/app/auth/actions.ts`)
- Parent → Interview UI: provides answers (evidence: `README.md`)
- Interview UI → Interview questions: validates answers
- Parent → Parent dashboard: uses dashboard (evidence: `README.md`)
- Parent dashboard → Route API: requests route (evidence: `README.md`)
- Route API → Supabase: reads and saves route (evidence: `src/server/parent-route-api.ts`)
- Route API → Route assembly: checks completeness (evidence: `src/server/parent-route-api.ts`)
- Route API → Route generation: generates plan (evidence: `src/server/parent-route-api.ts`)
- Route assembly → Service catalog: selects actions (evidence: `src/domain/parent-route.ts`)
- Route assembly → Eligibility conditions: evaluates eligibility (evidence: `src/domain/parent-route.ts`)
- Route generation → OpenAI: requests generation (evidence: `src/server/route-openai.ts`)
- Route generation → Route assembly: assembles output (evidence: `src/server/route-openai.ts`)
- Parent → PMPK review UI: uploads and reviews (evidence: `README.md`)
- PMPK review UI → PMPK client: calls client (evidence: `src/app/parent/pmpk-client.ts`)
- PMPK client → PMPK API: calls API (evidence: `src/app/parent/pmpk-client.ts`)
- PMPK API → PMPK validation: validates fields (evidence: `src/server/pmpk-api.ts`)
- PMPK API → Supabase: stores document (evidence: `src/server/pmpk-api.ts`)
- PMPK API → Document extraction: requests parsing (evidence: `src/server/pmpk-api.ts`)
- Document extraction → OpenAI: extracts fields (evidence: `README.md`)
- PMPK API → Route API: supplies route inputs (evidence: `src/server/pmpk-api.ts`)
- Parent dashboard → Route stages and scheduling: shows later steps (evidence: `README.md`)
- Plan validation → Case-plan schema: validates against (evidence: `src/domain/case-plan/validate.ts`)
- Plan transitions → Case-plan schema: uses plan types (evidence: `src/domain/case-plan/transitions.ts`)
