# qamaruzaman1074/rafeeq-health architecture

> Architecture diagram of the GitHub repository qamaruzaman1074/rafeeq-health, 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/qamaruzaman1074/rafeeq-health
- Repository: https://github.com/qamaruzaman1074/rafeeq-health

## Overview

Rafeeq Health is a prototype for genetic-health education, screening-report handling, consent-aware partner sharing, and pathways to professional care. A user explores inherited-risk and screening information, may use the report and partner-sharing workflows, and can seek counselling or care guidance; the product emphasizes informed choices rather than medical decisions. The graph combines documented product capabilities with sampled modules. Several feature implementations and integrations were not inspected, so their internal links are omitted; the Azure Functions evidence shown covers its health endpoint, not a broader clinical API.

Main entry points: [`backend/azure-functions/src/functions/health.ts`](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/functions/health.ts) (Azure health endpoint), [`apps/web/server/website-assistant/chat.mjs`](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/server/website-assistant/chat.mjs) (Website chat handler), [`backend/azure-functions/src/middleware/cors.ts`](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/middleware/cors.ts) (CORS middleware), [`backend/azure-functions/src/utils/http-response.ts`](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/utils/http-response.ts) (HTTP responses)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_webapp["Rafeeq web app<br/>[main.tsx]"]
  node_routing["Application routes<br/>[routes.tsx]"]
  node_ask["FAQ and questions<br/>[ask-view.tsx]"]
end

subgraph group_education["Health education"]
  node_inherited["Inherited-risk education"]
  node_risk_diagrams["Risk diagrams"]
  node_screening_pathways["Screening pathways<br/>[content-model.ts]"]
  node_learn["Learning modules<br/>[learn-view.tsx]"]
  node_assistant_ui["Knowledge assistant UI"]
  node_assistant_search["Knowledge search<br/>[searchKnowledge.ts]"]
end

subgraph group_personal["Personal workflows"]
  node_dashboard["Personal dashboard<br/>[dashboard-view.tsx]"]
  node_check["Screening check<br/>[check-screen.tsx]"]
  node_reports["Report management<br/>[reports-view.tsx]"]
  node_report_storage[("Private report storage")]
  node_report_access["Report-code access"]
  node_partner["Partner sharing"]
  node_privacy["Privacy and consent<br/>[privacy-view.tsx]"]
end

subgraph group_care["Care and clinic"]
  node_care_guidance["Care guidance<br/>[care-view.tsx]"]
  node_referrals["Referral workflow"]
  node_clinic["Clinic workspace<br/>[queue-view.tsx]"]
end

subgraph group_services["Assistant and services"]
  node_chat_handler["Website chat handler<br/>[chat.mjs]"]
  node_chat_prompt["Assistant prompt<br/>[prompt.mjs]"]
  node_chat_limits["Rate limiting<br/>[rate-limit.mjs]"]
  node_chat_validation["Message validation<br/>[validate.mjs]"]
  node_azure_health["Azure health endpoint<br/>[health.ts]"]
  node_azure_registration["Function registration<br/>[index.ts]"]
  node_azure_cors["CORS middleware<br/>[cors.ts]"]
  node_azure_validation["Method validation<br/>[validate.ts]"]
  node_azure_response["HTTP responses<br/>[http-response.ts]"]
  node_azure_logging["Request logging<br/>[logger.ts]"]
  node_azure_env["Service configuration<br/>[env.ts]"]
end

node_visitor(("Visitor"))

node_visitor -->|"uses"| node_webapp
node_webapp -.->|"renders routes"| node_routing
node_visitor -->|"explores risk"| node_inherited
node_visitor -->|"explores screening"| node_screening_pathways
node_visitor -->|"learns"| node_learn
node_visitor -.->|"asks questions"| node_ask
node_visitor -->|"asks questions"| node_assistant_ui
node_assistant_ui -.->|"searches knowledge"| node_assistant_search
node_visitor -->|"reviews progress"| node_dashboard
node_visitor -.->|"uses screening"| node_check
node_visitor -->|"manages reports"| node_reports
node_reports -->|"stores files"| node_report_storage
node_visitor -->|"enters access code"| node_report_access
node_visitor -->|"invites partner"| node_partner
node_visitor -->|"sets consent"| node_privacy
node_visitor -->|"explores care"| node_care_guidance
node_visitor -->|"requests referral"| node_referrals
node_clinic -.->|"handles referrals"| node_referrals
node_chat_handler -->|"checks rate"| node_chat_limits
node_chat_handler -->|"validates message"| node_chat_validation
node_chat_handler -->|"uses prompt"| node_chat_prompt
node_azure_registration -->|"registers"| node_azure_health
node_azure_health -->|"checks origins"| node_azure_cors
node_azure_health -->|"checks method"| node_azure_validation
node_azure_health -->|"returns health"| node_azure_response
node_azure_health -->|"logs request"| node_azure_logging
node_azure_cors -->|"loads settings"| node_azure_env
node_azure_response -->|"adds headers"| node_azure_cors
node_azure_validation -->|"builds error"| node_azure_response

click node_webapp "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/main.tsx"
click node_routing "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/app/routes.tsx"
click node_ask "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/ask/ask-view.tsx"
click node_inherited "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/inherited-risk-education/inherited-risk-education-sections.tsx"
click node_risk_diagrams "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/inherited-risk-education/couple-punnett-diagram.tsx"
click node_screening_pathways "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/screening-pathways/content-model.ts"
click node_learn "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/learn/learn-view.tsx"
click node_assistant_ui "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/assistant/KnowledgeAssistant.tsx"
click node_assistant_search "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/assistant/utils/searchKnowledge.ts"
click node_dashboard "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/dashboard/dashboard-view.tsx"
click node_check "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/check/check-screen.tsx"
click node_reports "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/reports/reports-view.tsx"
click node_report_storage "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/reports/supabase-storage.ts"
click node_report_access "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/report-access/report-code-gate.tsx"
click node_partner "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/partner/partner-invitation-flow.tsx"
click node_privacy "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/privacy/privacy-view.tsx"
click node_care_guidance "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/care/care-view.tsx"
click node_referrals "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/genetic-counselling/referral-request-preview.tsx"
click node_clinic "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/clinic/queue-view.tsx"
click node_chat_handler "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/server/website-assistant/chat.mjs"
click node_chat_prompt "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/server/website-assistant/prompt.mjs"
click node_chat_limits "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/server/website-assistant/rate-limit.mjs"
click node_chat_validation "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/server/website-assistant/validate.mjs"
click node_azure_health "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/functions/health.ts"
click node_azure_registration "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/index.ts"
click node_azure_cors "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/middleware/cors.ts"
click node_azure_validation "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/middleware/validate.ts"
click node_azure_response "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/utils/http-response.ts"
click node_azure_logging "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/utils/logger.ts"
click node_azure_env "https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/config/env.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_webapp,node_routing,node_ask toneBlue
class node_inherited,node_risk_diagrams,node_screening_pathways,node_learn,node_assistant_ui,node_assistant_search toneAmber
class node_dashboard,node_check,node_reports,node_report_storage,node_report_access,node_partner,node_privacy toneMint
class node_care_guidance,node_referrals,node_clinic toneRose
class node_chat_handler,node_chat_prompt,node_chat_limits,node_chat_validation,node_azure_health,node_azure_registration,node_azure_cors,node_azure_validation,node_azure_response,node_azure_logging,node_azure_env,node_visitor toneIndigo
```

## Components

### Web experience

- [Rafeeq web app](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/main.tsx): `apps/web/src/main.tsx`
- [Application routes](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/app/routes.tsx): `apps/web/src/app/routes.tsx`
- [FAQ and questions](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/ask/ask-view.tsx): `apps/web/src/features/ask/ask-view.tsx`

### Health education

- [Inherited-risk education](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/inherited-risk-education/inherited-risk-education-sections.tsx): `apps/web/src/features/inherited-risk-education/inherited-risk-education-sections.tsx`
- [Risk diagrams](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/inherited-risk-education/couple-punnett-diagram.tsx): `apps/web/src/features/inherited-risk-education/couple-punnett-diagram.tsx`
- [Screening pathways](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/screening-pathways/content-model.ts): `apps/web/src/features/screening-pathways/content-model.ts`
- [Learning modules](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/learn/learn-view.tsx): `apps/web/src/features/learn/learn-view.tsx`
- [Knowledge assistant UI](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/assistant/KnowledgeAssistant.tsx): `apps/web/src/features/assistant/KnowledgeAssistant.tsx`
- [Knowledge search](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/assistant/utils/searchKnowledge.ts): `apps/web/src/features/assistant/utils/searchKnowledge.ts`

### Personal workflows

- [Personal dashboard](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/dashboard/dashboard-view.tsx): `apps/web/src/features/dashboard/dashboard-view.tsx`
- [Screening check](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/check/check-screen.tsx): `apps/web/src/features/check/check-screen.tsx`
- [Report management](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/reports/reports-view.tsx): `apps/web/src/features/reports/reports-view.tsx`
- [Private report storage](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/reports/supabase-storage.ts): `apps/web/src/features/reports/supabase-storage.ts`
- [Report-code access](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/report-access/report-code-gate.tsx): `apps/web/src/features/report-access/report-code-gate.tsx`
- [Partner sharing](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/partner/partner-invitation-flow.tsx): `apps/web/src/features/partner/partner-invitation-flow.tsx`
- [Privacy and consent](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/privacy/privacy-view.tsx): `apps/web/src/features/privacy/privacy-view.tsx`

### Care and clinic

- [Care guidance](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/care/care-view.tsx): `apps/web/src/features/care/care-view.tsx`
- [Referral workflow](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/genetic-counselling/referral-request-preview.tsx): `apps/web/src/features/genetic-counselling/referral-request-preview.tsx`
- [Clinic workspace](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/src/features/clinic/queue-view.tsx): `apps/web/src/features/clinic/queue-view.tsx`

### Assistant and services

- [Website chat handler](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/server/website-assistant/chat.mjs): `apps/web/server/website-assistant/chat.mjs`
- [Assistant prompt](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/server/website-assistant/prompt.mjs): `apps/web/server/website-assistant/prompt.mjs`
- [Rate limiting](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/server/website-assistant/rate-limit.mjs): `apps/web/server/website-assistant/rate-limit.mjs`
- [Message validation](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/apps/web/server/website-assistant/validate.mjs): `apps/web/server/website-assistant/validate.mjs`
- [Azure health endpoint](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/functions/health.ts): `backend/azure-functions/src/functions/health.ts`
- [Function registration](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/index.ts): `backend/azure-functions/src/index.ts`
- [CORS middleware](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/middleware/cors.ts): `backend/azure-functions/src/middleware/cors.ts`
- [Method validation](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/middleware/validate.ts): `backend/azure-functions/src/middleware/validate.ts`
- [HTTP responses](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/utils/http-response.ts): `backend/azure-functions/src/utils/http-response.ts`
- [Request logging](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/utils/logger.ts): `backend/azure-functions/src/utils/logger.ts`
- [Service configuration](https://github.com/qamaruzaman1074/rafeeq-health/blob/main/backend/azure-functions/src/config/env.ts): `backend/azure-functions/src/config/env.ts`

### Other components

- **Visitor**

## Connections

- Visitor → Rafeeq web app: uses (evidence: `README.md`)
- Rafeeq web app → Application routes: renders routes
- Visitor → Inherited-risk education: explores risk (evidence: `README.md`)
- Visitor → Screening pathways: explores screening (evidence: `README.md`)
- Visitor → Learning modules: learns (evidence: `README.md`)
- Visitor → FAQ and questions: asks questions
- Visitor → Knowledge assistant UI: asks questions (evidence: `README.md`)
- Knowledge assistant UI → Knowledge search: searches knowledge
- Visitor → Personal dashboard: reviews progress (evidence: `README.md`)
- Visitor → Screening check: uses screening
- Visitor → Report management: manages reports (evidence: `README.md`)
- Report management → Private report storage: stores files (evidence: `README.md`)
- Visitor → Report-code access: enters access code (evidence: `README.md`)
- Visitor → Partner sharing: invites partner (evidence: `README.md`)
- Visitor → Privacy and consent: sets consent (evidence: `README.md`)
- Visitor → Care guidance: explores care (evidence: `README.md`)
- Visitor → Referral workflow: requests referral (evidence: `README.md`)
- Clinic workspace → Referral workflow: handles referrals
- Website chat handler → Rate limiting: checks rate (evidence: `apps/web/server/website-assistant/chat.mjs`)
- Website chat handler → Message validation: validates message (evidence: `apps/web/server/website-assistant/chat.mjs`)
- Website chat handler → Assistant prompt: uses prompt (evidence: `apps/web/server/website-assistant/chat.mjs`)
- Function registration → Azure health endpoint: registers (evidence: `backend/azure-functions/src/index.ts`)
- Azure health endpoint → CORS middleware: checks origins (evidence: `backend/azure-functions/src/functions/health.ts`)
- Azure health endpoint → Method validation: checks method (evidence: `backend/azure-functions/src/functions/health.ts`)
- Azure health endpoint → HTTP responses: returns health (evidence: `backend/azure-functions/src/functions/health.ts`)
- Azure health endpoint → Request logging: logs request (evidence: `backend/azure-functions/src/functions/health.ts`)
- CORS middleware → Service configuration: loads settings (evidence: `backend/azure-functions/src/middleware/cors.ts`)
- HTTP responses → CORS middleware: adds headers (evidence: `backend/azure-functions/src/utils/http-response.ts`)
- Method validation → HTTP responses: builds error (evidence: `backend/azure-functions/src/middleware/validate.ts`)
