# sadc-lab/mypicu architecture

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

- Interactive diagram: https://gitdiagram.com/sadc-lab/mypicu
- Repository: https://github.com/sadc-lab/mypicu

## Overview

MYPICU is a pediatric intensive-care monitoring platform. Clinicians enter through authenticated routing, select patients, and view organ-specific clinical dashboards; patient records and time-series data are obtained through service and Supabase layers. A separate study workflow analyzes uploaded data for cerebral autoregulation. The graph preserves the documented organ, import, feedback, and Teams capabilities. Some service internals and page-to-data links are unsampled, so relationships not established by excerpts, the source index, or README are omitted.

Main entry points: [`src/App.tsx`](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/App.tsx) (App routing), [`src/pages/AutoregStudy.tsx`](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/pages/AutoregStudy.tsx) (Autoreg study page), [`src/hooks/usePatients.ts`](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/hooks/usePatients.ts) (Patient queries), [`src/pages/Optibrain.tsx`](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/pages/Optibrain.tsx) (Brain monitoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application access"]
  node_app["App routing<br/>[App.tsx]"]
  node_auth["Authentication<br/>[useAuth.tsx]"]
  node_manager_signup["Manager signup<br/>[ManagerSignup.tsx]"]
  node_ui_primitives["UI primitives"]
  node_feedback["Feedback page<br/>[Feedback.tsx]"]
end

subgraph group_clinical["Clinical monitoring"]
  node_dashboard["Patient dashboard<br/>[Dashboard.tsx]"]
  node_brain["Brain monitoring<br/>[Optibrain.tsx]"]
  node_organ_pages["Organ dashboards"]
  node_header["Clinical navigation<br/>[Header.tsx]"]
  node_chart_range["Shared chart range"]
  node_zoom_controls["Chart zoom controls"]
end

subgraph group_study["Autoregulation studies"]
  node_autoreg_page["Autoreg study page<br/>[AutoregStudy.tsx]"]
  node_autoreg_results["Study result views"]
  node_autoreg_compute["Autoreg computation"]
  node_study_services["Autoreg services"]
end

subgraph group_data["Data and services"]
  node_patient_queries["Patient queries<br/>[usePatients.ts]"]
  node_patient_service["Patient service<br/>[patient.service.ts]"]
  node_patient_files["Patient time series"]
  node_supabase_data["Supabase patient data"]
end

subgraph group_platform["Platform integration"]
  node_supabase["Supabase client<br/>[client.ts]"]
  node_teams_bridge["Teams host bridge"]
  node_import_function["Patient import function<br/>[index.ts]"]
end

node_clinician(("Clinician"))
node_store[("Supabase")]

node_clinician -->|"opens"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_brain
node_app -->|"routes to"| node_organ_pages
node_app -->|"routes to"| node_autoreg_page
node_app -->|"routes to"| node_feedback
node_app -->|"routes to"| node_manager_signup
node_manager_signup -->|"submits signup"| node_auth
node_auth -->|"authenticates"| node_supabase
node_header -->|"loads patients"| node_patient_queries
node_app -->|"queries patient"| node_patient_queries
node_patient_queries -->|"calls"| node_patient_service
node_brain -->|"loads patients"| node_patient_queries
node_brain -->|"loads time series"| node_patient_files
node_patient_files -->|"loads and lists"| node_supabase_data
node_supabase -.->|"connects"| node_store
node_autoreg_page -->|"analyzes uploads"| node_autoreg_compute
node_autoreg_results -->|"uses results"| node_autoreg_compute
node_autoreg_page -->|"shares time range"| node_chart_range
node_autoreg_page -.->|"renders controls"| node_zoom_controls
node_autoreg_results -->|"renders controls"| node_zoom_controls
node_app -->|"mounts"| node_teams_bridge
node_clinician -.->|"imports patient data"| node_import_function
node_app -.->|"uses interface"| node_ui_primitives

click node_app "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/App.tsx"
click node_auth "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/hooks/useAuth.tsx"
click node_manager_signup "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/pages/auth/ManagerSignup.tsx"
click node_dashboard "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/pages/Dashboard.tsx"
click node_brain "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/pages/Optibrain.tsx"
click node_organ_pages "https://github.com/sadc-lab/mypicu/tree/Auto_reg_test/src/pages"
click node_header "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/components/Header.tsx"
click node_patient_queries "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/hooks/usePatients.ts"
click node_patient_service "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/services/patient.service.ts"
click node_patient_files "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/services/patientFileData.service.ts"
click node_supabase_data "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/services/supabasePatientData.service.ts"
click node_supabase "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/integrations/supabase/client.ts"
click node_autoreg_page "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/pages/AutoregStudy.tsx"
click node_autoreg_results "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/components/autoreg/AutoregResultViews.tsx"
click node_autoreg_compute "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/services/autoregComputation.service.ts"
click node_study_services "https://github.com/sadc-lab/mypicu/tree/Auto_reg_test/src/services"
click node_chart_range "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/contexts/ChartTimeRangeContext.tsx"
click node_zoom_controls "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/components/ChartZoomControls.tsx"
click node_ui_primitives "https://github.com/sadc-lab/mypicu/tree/Auto_reg_test/src/components/ui"
click node_teams_bridge "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/components/TeamsHostBridge.tsx"
click node_import_function "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/supabase/functions/import-patient-data/index.ts"
click node_feedback "https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/pages/Feedback.tsx"

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_auth,node_manager_signup,node_ui_primitives,node_feedback toneBlue
class node_dashboard,node_brain,node_organ_pages,node_header,node_chart_range,node_zoom_controls,node_store toneAmber
class node_autoreg_page,node_autoreg_results,node_autoreg_compute,node_study_services toneMint
class node_patient_queries,node_patient_service,node_patient_files,node_supabase_data toneRose
class node_supabase,node_teams_bridge,node_import_function,node_clinician toneIndigo
```

## Components

### Application access

- [App routing](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/App.tsx): `src/App.tsx`
- [Authentication](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/hooks/useAuth.tsx): `src/hooks/useAuth.tsx`
- [Manager signup](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/pages/auth/ManagerSignup.tsx): `src/pages/auth/ManagerSignup.tsx`
- [UI primitives](https://github.com/sadc-lab/mypicu/tree/Auto_reg_test/src/components/ui): `src/components/ui`
- [Feedback page](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/pages/Feedback.tsx): `src/pages/Feedback.tsx`

### Clinical monitoring

- [Patient dashboard](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/pages/Dashboard.tsx): `src/pages/Dashboard.tsx`
- [Brain monitoring](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/pages/Optibrain.tsx): `src/pages/Optibrain.tsx`
- [Organ dashboards](https://github.com/sadc-lab/mypicu/tree/Auto_reg_test/src/pages): `src/pages`
- [Clinical navigation](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/components/Header.tsx): `src/components/Header.tsx`
- [Shared chart range](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/contexts/ChartTimeRangeContext.tsx): `src/contexts/ChartTimeRangeContext.tsx`
- [Chart zoom controls](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/components/ChartZoomControls.tsx): `src/components/ChartZoomControls.tsx`

### Autoregulation studies

- [Autoreg study page](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/pages/AutoregStudy.tsx): `src/pages/AutoregStudy.tsx`
- [Study result views](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/components/autoreg/AutoregResultViews.tsx): `src/components/autoreg/AutoregResultViews.tsx`
- [Autoreg computation](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/services/autoregComputation.service.ts): `src/services/autoregComputation.service.ts`
- [Autoreg services](https://github.com/sadc-lab/mypicu/tree/Auto_reg_test/src/services): `src/services`

### Data and services

- [Patient queries](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/hooks/usePatients.ts): `src/hooks/usePatients.ts`
- [Patient service](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/services/patient.service.ts): `src/services/patient.service.ts`
- [Patient time series](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/services/patientFileData.service.ts): `src/services/patientFileData.service.ts`
- [Supabase patient data](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/services/supabasePatientData.service.ts): `src/services/supabasePatientData.service.ts`

### Platform integration

- [Supabase client](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- [Teams host bridge](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/src/components/TeamsHostBridge.tsx): `src/components/TeamsHostBridge.tsx`
- [Patient import function](https://github.com/sadc-lab/mypicu/blob/Auto_reg_test/supabase/functions/import-patient-data/index.ts): `supabase/functions/import-patient-data/index.ts`

### Other components

- **Clinician**
- **Supabase**

## Connections

- Clinician → App routing: opens (evidence: `src/App.tsx`)
- App routing → Patient dashboard: routes to (evidence: `src/App.tsx`)
- App routing → Brain monitoring: routes to (evidence: `src/App.tsx`)
- App routing → Organ dashboards: routes to (evidence: `src/App.tsx`)
- App routing → Autoreg study page: routes to (evidence: `src/App.tsx`)
- App routing → Feedback page: routes to (evidence: `src/App.tsx`)
- App routing → Manager signup: routes to (evidence: `src/App.tsx`)
- Manager signup → Authentication: submits signup (evidence: `src/pages/auth/ManagerSignup.tsx`)
- Authentication → Supabase client: authenticates (evidence: `src/hooks/useAuth.tsx`)
- Clinical navigation → Patient queries: loads patients (evidence: `src/components/Header.tsx`)
- App routing → Patient queries: queries patient (evidence: `src/App.tsx`)
- Patient queries → Patient service: calls (evidence: `src/hooks/usePatients.ts`)
- Brain monitoring → Patient queries: loads patients (evidence: `src/pages/Optibrain.tsx`)
- Brain monitoring → Patient time series: loads time series (evidence: `src/pages/Optibrain.tsx`)
- Patient time series → Supabase patient data: loads and lists (evidence: `src/services/patientFileData.service.ts`)
- Supabase client → Supabase: connects (evidence: `README.md`)
- Autoreg study page → Autoreg computation: analyzes uploads (evidence: `src/pages/AutoregStudy.tsx`)
- Study result views → Autoreg computation: uses results (evidence: `src/components/autoreg/AutoregResultViews.tsx`)
- Autoreg study page → Shared chart range: shares time range (evidence: `src/pages/AutoregStudy.tsx`)
- Autoreg study page → Chart zoom controls: renders controls (evidence: `src/pages/AutoregStudy.tsx`)
- Study result views → Chart zoom controls: renders controls (evidence: `src/components/autoreg/AutoregResultViews.tsx`)
- App routing → Teams host bridge: mounts (evidence: `src/App.tsx`)
- Clinician → Patient import function: imports patient data (evidence: `README.md`)
- App routing → UI primitives: uses interface (evidence: `src/App.tsx`)
