# adammeg/haouaweb architecture

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

- Interactive diagram: https://gitdiagram.com/adammeg/haouaweb
- Repository: https://github.com/adammeg/haouaweb

## Overview

HawaeMD is a French-language clinical practice application for gynecology, obstetrics and infertility care. A clinician manages patient records and appointments in the web workspace, then uses specialized clinical tools and AI assistance; authenticated APIs persist workspace data and support training workflows. The tree also shows document generation, analytics, waiting-room, PMA and administration capabilities. Relationships are limited to those visible in sampled source or SOURCE INDEX references; several feature implementations were not sampled, so their internal connections are omitted.

Main entry points: [`src/app/api/ia/route.ts`](https://github.com/adammeg/haouaweb/blob/main/src/app/api/ia/route.ts) (AI assistance API), [`src/lib/auth/session.ts`](https://github.com/adammeg/haouaweb/blob/main/src/lib/auth/session.ts) (Session and access), [`src/components/agenda/agenda-client.tsx`](https://github.com/adammeg/haouaweb/blob/main/src/components/agenda/agenda-client.tsx) (Agenda), [`src/lib/training/ingest-full.ts`](https://github.com/adammeg/haouaweb/blob/main/src/lib/training/ingest-full.ts) (Learning ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Clinical workspace"]
  node_agenda["Agenda<br/>[agenda-client.tsx]"]
  node_patient["Patient dossier"]
  node_waiting["Waiting room"]
  node_reminders["Reminders<br/>[rappels-client.tsx]"]
end

subgraph group_clinical["Clinical tools"]
  node_clinicaltools["Clinical modules<br/>[bridge-client.tsx]"]
  node_scores["Clinical scores<br/>[scores-client.tsx]"]
  node_growth["Growth curves"]
  node_pma["PMA analysis<br/>[ivf-engine.ts]"]
  node_documents["Clinical documents"]
  node_rag["Clinical knowledge search<br/>[rag-engine.ts]"]
  node_analytics["Clinical analytics<br/>[epidemiology.ts]"]
end

subgraph group_platform["Application platform"]
  node_workspaceapi["Workspace API<br/>[route.ts]"]
  node_patientsapi["Patients API<br/>[route.ts]"]
  node_auth["Session and access<br/>[session.ts]"]
  node_assistantapi["AI assistance API<br/>[route.ts]"]
  node_admin["Administration<br/>[route.ts]"]
end

subgraph group_data["Persistence and learning"]
  node_patientstate["Patient state<br/>[hawae-store.ts]"]
  node_appointments["Appointment state<br/>[rdv-store.ts]"]
  node_workspacedb[("Workspace records")]
  node_training["Learning ingestion<br/>[ingest-full.ts]"]
  node_trainingdb[("Training records")]
end

node_clinician(("Clinician"))
node_ai_provider["AI provider"]

node_clinician -.->|"manages visits"| node_agenda
node_clinician -.->|"updates records"| node_patient
node_agenda -->|"uses state"| node_appointments
node_agenda -->|"uses state"| node_patientstate
node_reminders -->|"uses state"| node_appointments
node_waiting -->|"uses state"| node_patientstate
node_waiting -->|"registers arrivals"| node_clinician
node_patientsapi -->|"reads and writes"| node_workspacedb
node_workspaceapi -->|"reads and writes"| node_workspacedb
node_workspaceapi -->|"checks session"| node_auth
node_patientsapi -->|"requires doctor"| node_auth
node_patientstate -->|"scopes local data"| node_clinician
node_assistantapi -->|"checks session"| node_auth
node_assistantapi -->|"retrieves evidence"| node_rag
node_assistantapi -->|"resolves provider"| node_ai_provider
node_assistantapi -->|"prepares learning"| node_training
node_training -->|"loads workspace"| node_workspacedb
node_training -->|"upserts records"| node_trainingdb
node_admin -->|"checks session"| node_auth

click node_agenda "https://github.com/adammeg/haouaweb/blob/main/src/components/agenda/agenda-client.tsx"
click node_patient "https://github.com/adammeg/haouaweb/blob/main/src/components/dossier/dossier-workspace.tsx"
click node_waiting "https://github.com/adammeg/haouaweb/blob/main/src/components/salle-attente/salle-attente-client.tsx"
click node_reminders "https://github.com/adammeg/haouaweb/blob/main/src/components/rappels/rappels-client.tsx"
click node_patientstate "https://github.com/adammeg/haouaweb/blob/main/src/stores/hawae-store.ts"
click node_appointments "https://github.com/adammeg/haouaweb/blob/main/src/stores/rdv-store.ts"
click node_workspaceapi "https://github.com/adammeg/haouaweb/blob/main/src/app/api/workspace/state/route.ts"
click node_patientsapi "https://github.com/adammeg/haouaweb/blob/main/src/app/api/patients/route.ts"
click node_workspacedb "https://github.com/adammeg/haouaweb/blob/main/src/lib/db/workspace-repository.ts"
click node_auth "https://github.com/adammeg/haouaweb/blob/main/src/lib/auth/session.ts"
click node_clinicaltools "https://github.com/adammeg/haouaweb/blob/main/src/components/bridge/bridge-client.tsx"
click node_scores "https://github.com/adammeg/haouaweb/blob/main/src/components/scores/scores-client.tsx"
click node_growth "https://github.com/adammeg/haouaweb/blob/main/src/lib/growth-curves/percentile-engine.ts"
click node_pma "https://github.com/adammeg/haouaweb/blob/main/src/lib/pma/ivf-engine.ts"
click node_documents "https://github.com/adammeg/haouaweb/blob/main/src/components/documents/documents-client.tsx"
click node_assistantapi "https://github.com/adammeg/haouaweb/blob/main/src/app/api/ia/route.ts"
click node_rag "https://github.com/adammeg/haouaweb/blob/main/src/lib/rag/rag-engine.ts"
click node_analytics "https://github.com/adammeg/haouaweb/blob/main/src/lib/stats/epidemiology.ts"
click node_training "https://github.com/adammeg/haouaweb/blob/main/src/lib/training/ingest-full.ts"
click node_trainingdb "https://github.com/adammeg/haouaweb/blob/main/src/lib/db/full-training-repository.ts"
click node_admin "https://github.com/adammeg/haouaweb/blob/main/src/app/api/admin/overview/route.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_agenda,node_patient,node_waiting,node_reminders toneBlue
class node_clinicaltools,node_scores,node_growth,node_pma,node_documents,node_rag,node_analytics toneAmber
class node_workspaceapi,node_patientsapi,node_auth,node_assistantapi,node_admin toneMint
class node_patientstate,node_appointments,node_workspacedb,node_training,node_trainingdb toneRose
class node_clinician,node_ai_provider toneIndigo
```

## Components

### Clinical workspace

- [Agenda](https://github.com/adammeg/haouaweb/blob/main/src/components/agenda/agenda-client.tsx): `src/components/agenda/agenda-client.tsx`
- [Patient dossier](https://github.com/adammeg/haouaweb/blob/main/src/components/dossier/dossier-workspace.tsx): `src/components/dossier/dossier-workspace.tsx`
- [Waiting room](https://github.com/adammeg/haouaweb/blob/main/src/components/salle-attente/salle-attente-client.tsx): `src/components/salle-attente/salle-attente-client.tsx`
- [Reminders](https://github.com/adammeg/haouaweb/blob/main/src/components/rappels/rappels-client.tsx): `src/components/rappels/rappels-client.tsx`

### Clinical tools

- [Clinical modules](https://github.com/adammeg/haouaweb/blob/main/src/components/bridge/bridge-client.tsx): `src/components/bridge/bridge-client.tsx`
- [Clinical scores](https://github.com/adammeg/haouaweb/blob/main/src/components/scores/scores-client.tsx): `src/components/scores/scores-client.tsx`
- [Growth curves](https://github.com/adammeg/haouaweb/blob/main/src/lib/growth-curves/percentile-engine.ts): `src/lib/growth-curves/percentile-engine.ts`
- [PMA analysis](https://github.com/adammeg/haouaweb/blob/main/src/lib/pma/ivf-engine.ts): `src/lib/pma/ivf-engine.ts`
- [Clinical documents](https://github.com/adammeg/haouaweb/blob/main/src/components/documents/documents-client.tsx): `src/components/documents/documents-client.tsx`
- [Clinical knowledge search](https://github.com/adammeg/haouaweb/blob/main/src/lib/rag/rag-engine.ts): `src/lib/rag/rag-engine.ts`
- [Clinical analytics](https://github.com/adammeg/haouaweb/blob/main/src/lib/stats/epidemiology.ts): `src/lib/stats/epidemiology.ts`

### Application platform

- [Workspace API](https://github.com/adammeg/haouaweb/blob/main/src/app/api/workspace/state/route.ts): `src/app/api/workspace/state/route.ts`
- [Patients API](https://github.com/adammeg/haouaweb/blob/main/src/app/api/patients/route.ts): `src/app/api/patients/route.ts`
- [Session and access](https://github.com/adammeg/haouaweb/blob/main/src/lib/auth/session.ts): `src/lib/auth/session.ts`
- [AI assistance API](https://github.com/adammeg/haouaweb/blob/main/src/app/api/ia/route.ts): `src/app/api/ia/route.ts`
- [Administration](https://github.com/adammeg/haouaweb/blob/main/src/app/api/admin/overview/route.ts): `src/app/api/admin/overview/route.ts`

### Persistence and learning

- [Patient state](https://github.com/adammeg/haouaweb/blob/main/src/stores/hawae-store.ts): `src/stores/hawae-store.ts`
- [Appointment state](https://github.com/adammeg/haouaweb/blob/main/src/stores/rdv-store.ts): `src/stores/rdv-store.ts`
- [Workspace records](https://github.com/adammeg/haouaweb/blob/main/src/lib/db/workspace-repository.ts): `src/lib/db/workspace-repository.ts`
- [Learning ingestion](https://github.com/adammeg/haouaweb/blob/main/src/lib/training/ingest-full.ts): `src/lib/training/ingest-full.ts`
- [Training records](https://github.com/adammeg/haouaweb/blob/main/src/lib/db/full-training-repository.ts): `src/lib/db/full-training-repository.ts`

### Other components

- **Clinician**
- **AI provider**

## Connections

- Clinician → Agenda: manages visits
- Clinician → Patient dossier: updates records
- Agenda → Appointment state: uses state (evidence: `src/components/agenda/agenda-client.tsx`)
- Agenda → Patient state: uses state (evidence: `src/components/agenda/agenda-client.tsx`)
- Reminders → Appointment state: uses state (evidence: `src/components/rappels/rappels-client.tsx`)
- Waiting room → Patient state: uses state (evidence: `src/components/salle-attente/salle-attente-client.tsx`)
- Waiting room → Clinician: registers arrivals (evidence: `src/components/salle-attente/salle-attente-client.tsx`)
- Patients API → Workspace records: reads and writes (evidence: `src/app/api/patients/route.ts`)
- Workspace API → Workspace records: reads and writes (evidence: `src/app/api/workspace/state/route.ts`)
- Workspace API → Session and access: checks session (evidence: `src/app/api/workspace/state/route.ts`)
- Patients API → Session and access: requires doctor (evidence: `src/app/api/patients/route.ts`)
- Patient state → Clinician: scopes local data (evidence: `src/stores/hawae-store.ts`)
- AI assistance API → Session and access: checks session (evidence: `src/app/api/ia/route.ts`)
- AI assistance API → Clinical knowledge search: retrieves evidence (evidence: `src/app/api/ia/route.ts`)
- AI assistance API → AI provider: resolves provider (evidence: `src/app/api/ia/route.ts`)
- AI assistance API → Learning ingestion: prepares learning (evidence: `src/app/api/ia/route.ts`)
- Learning ingestion → Workspace records: loads workspace (evidence: `src/lib/training/ingest-full.ts`)
- Learning ingestion → Training records: upserts records (evidence: `src/lib/training/ingest-full.ts`)
- Administration → Session and access: checks session (evidence: `src/app/api/admin/overview/route.ts`)
