# brasethchun/clinical-kpis-management-systems architecture

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

- Interactive diagram: https://gitdiagram.com/brasethchun/clinical-kpis-management-systems
- Repository: https://github.com/brasethchun/clinical-kpis-management-systems

## Overview

This is a clinical business-unit KPI planning and daily-operations application. Users enter or review KPI actuals, then inspect summaries and trends against configured targets; administrators manage users, business units, departments, patient types, and workspace data mode. The frontend communicates with a server API, which uses a database layer for persistence. KPI analytics and business-KPI calculations provide internal processing. Several UI-to-API and API-to-server links are shown as unverified because the excerpts do not expose the relevant call sites; no README was provided.

Main entry points: [`src/lib/api.ts`](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/lib/api.ts) (API Client), [`src/App.tsx`](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/App.tsx) (App Shell), [`server/db.ts`](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/server/db.ts) (Database Layer), [`server.ts`](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/server.ts) (Server API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["KPI Operations"]
  node_overview["KPI Overview<br/>[OverviewView.tsx]"]
  node_intake["Daily Intake"]
  node_ledger["KPI Ledger<br/>[LedgerView.tsx]"]
  node_trends["KPI Trends<br/>[TrendsView.tsx]"]
  node_analytics["KPI Analytics<br/>[kpiAnalytics.ts]"]
end

subgraph group_planning["KPI Planning"]
  node_settings["KPI Settings<br/>[SettingsView.tsx]"]
  node_matrix["Business KPI Matrix"]
  node_kpi_math["KPI Plan Math<br/>[businessKpiMath.ts]"]
  node_excel["KPI Excel Export"]
  node_domain_types["KPI Domain Types<br/>[kpi.ts]"]
end

subgraph group_admin["Administration"]
  node_admin_settings["Admin Settings"]
  node_bu_manager["Business Units"]
  node_dept_manager["Department Modules"]
  node_patient_manager["Patient Types"]
end

subgraph group_runtime["Application Runtime"]
  node_app["App Shell<br/>[App.tsx]"]
  node_auth["Authentication<br/>[AuthScreen.tsx]"]
  node_api["API Client<br/>[api.ts]"]
  node_server["Server API<br/>[server.ts]"]
end

subgraph group_storage["Persistence"]
  node_db_layer["Database Layer<br/>[db.ts]"]
  node_database[("Application Database<br/>[schema.sql]")]
  node_demo_seed["Demo Data Seed<br/>[demoSeed.ts]"]
end

node_staff(("Staff / Manager"))

node_staff -.->|"uses"| node_app
node_app -->|"renders"| node_auth
node_app -->|"renders"| node_overview
node_app -->|"renders"| node_ledger
node_app -->|"renders"| node_trends
node_app -->|"renders"| node_settings
node_app -->|"renders"| node_admin_settings
node_app -->|"computes with"| node_analytics
node_auth -.->|"requests"| node_api
node_intake -.->|"submits to"| node_api
node_ledger -.->|"requests"| node_api
node_settings -.->|"requests"| node_api
node_matrix -.->|"requests"| node_api
node_admin_settings -.->|"requests"| node_api
node_bu_manager -.->|"requests"| node_api
node_dept_manager -.->|"requests"| node_api
node_patient_manager -.->|"requests"| node_api
node_api -.->|"HTTP requests"| node_server
node_server -->|"uses"| node_db_layer
node_db_layer -.->|"persists to"| node_database
node_db_layer -->|"seeds demo with"| node_demo_seed
node_demo_seed -->|"populates"| node_db_layer
node_demo_seed -->|"recalculates with"| node_kpi_math
node_matrix -->|"calculates with"| node_kpi_math
node_settings -->|"renders"| node_matrix
node_trends -->|"calculates with"| node_analytics
node_ledger -->|"calculates with"| node_analytics
node_server -.->|"exports with"| node_excel
node_server -->|"validates with"| node_domain_types
node_db_layer -->|"parses with"| node_domain_types

click node_app "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/App.tsx"
click node_auth "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/AuthScreen.tsx"
click node_api "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/lib/api.ts"
click node_server "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/server.ts"
click node_overview "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/OverviewView.tsx"
click node_intake "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/DailyIntakeForm.tsx"
click node_ledger "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/LedgerView.tsx"
click node_trends "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/TrendsView.tsx"
click node_analytics "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/lib/kpiAnalytics.ts"
click node_settings "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/SettingsView.tsx"
click node_matrix "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/BusinessKpiMatrixView.tsx"
click node_kpi_math "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/lib/businessKpiMath.ts"
click node_excel "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/server/businessKpiExcel.ts"
click node_admin_settings "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/AdminSettingsView.tsx"
click node_bu_manager "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/BusinessUnitManager.tsx"
click node_dept_manager "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/DepartmentModuleManager.tsx"
click node_patient_manager "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/PatientTypeManager.tsx"
click node_domain_types "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/types/kpi.ts"
click node_db_layer "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/server/db.ts"
click node_database "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/database/schema.sql"
click node_demo_seed "https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/server/demoSeed.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_overview,node_intake,node_ledger,node_trends,node_analytics toneBlue
class node_settings,node_matrix,node_kpi_math,node_excel,node_domain_types toneAmber
class node_admin_settings,node_bu_manager,node_dept_manager,node_patient_manager toneMint
class node_app,node_auth,node_api,node_server toneRose
class node_db_layer,node_database,node_demo_seed,node_staff toneIndigo
```

## Components

### KPI Operations

- [KPI Overview](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/OverviewView.tsx): `src/components/OverviewView.tsx`
- [Daily Intake](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/DailyIntakeForm.tsx): `src/components/DailyIntakeForm.tsx`
- [KPI Ledger](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/LedgerView.tsx): `src/components/LedgerView.tsx`
- [KPI Trends](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/TrendsView.tsx): `src/components/TrendsView.tsx`
- [KPI Analytics](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/lib/kpiAnalytics.ts): `src/lib/kpiAnalytics.ts`

### KPI Planning

- [KPI Settings](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/SettingsView.tsx): `src/components/SettingsView.tsx`
- [Business KPI Matrix](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/BusinessKpiMatrixView.tsx): `src/components/BusinessKpiMatrixView.tsx`
- [KPI Plan Math](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/lib/businessKpiMath.ts): `src/lib/businessKpiMath.ts`
- [KPI Excel Export](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/server/businessKpiExcel.ts): `server/businessKpiExcel.ts`
- [KPI Domain Types](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/types/kpi.ts): `src/types/kpi.ts`

### Administration

- [Admin Settings](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/AdminSettingsView.tsx): `src/components/AdminSettingsView.tsx`
- [Business Units](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/BusinessUnitManager.tsx): `src/components/BusinessUnitManager.tsx`
- [Department Modules](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/DepartmentModuleManager.tsx): `src/components/DepartmentModuleManager.tsx`
- [Patient Types](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/PatientTypeManager.tsx): `src/components/PatientTypeManager.tsx`

### Application Runtime

- [App Shell](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/components/AuthScreen.tsx): `src/components/AuthScreen.tsx`
- [API Client](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/src/lib/api.ts): `src/lib/api.ts`
- [Server API](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/server.ts): `server.ts`

### Persistence

- [Database Layer](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/server/db.ts): `server/db.ts`
- [Application Database](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/database/schema.sql): `database/schema.sql`
- [Demo Data Seed](https://github.com/brasethchun/clinical-kpis-management-systems/blob/main/server/demoSeed.ts): `server/demoSeed.ts`

### Other components

- **Staff / Manager**

## Connections

- Staff / Manager → App Shell: uses
- App Shell → Authentication: renders (evidence: `src/App.tsx`)
- App Shell → KPI Overview: renders (evidence: `src/App.tsx`)
- App Shell → KPI Ledger: renders (evidence: `src/App.tsx`)
- App Shell → KPI Trends: renders (evidence: `src/App.tsx`)
- App Shell → KPI Settings: renders (evidence: `src/App.tsx`)
- App Shell → Admin Settings: renders (evidence: `src/App.tsx`)
- App Shell → KPI Analytics: computes with (evidence: `src/App.tsx`)
- Authentication → API Client: requests (evidence: `src/components/AuthScreen.tsx`)
- Daily Intake → API Client: submits to
- KPI Ledger → API Client: requests (evidence: `src/components/LedgerView.tsx`)
- KPI Settings → API Client: requests (evidence: `src/components/SettingsView.tsx`)
- Business KPI Matrix → API Client: requests (evidence: `src/components/BusinessKpiMatrixView.tsx`)
- Admin Settings → API Client: requests (evidence: `src/components/AdminSettingsView.tsx`)
- Business Units → API Client: requests (evidence: `src/components/BusinessUnitManager.tsx`)
- Department Modules → API Client: requests (evidence: `src/components/DepartmentModuleManager.tsx`)
- Patient Types → API Client: requests (evidence: `src/components/PatientTypeManager.tsx`)
- API Client → Server API: HTTP requests
- Server API → Database Layer: uses (evidence: `server.ts`)
- Database Layer → Application Database: persists to
- Database Layer → Demo Data Seed: seeds demo with (evidence: `server/db.ts`)
- Demo Data Seed → Database Layer: populates (evidence: `server/demoSeed.ts`)
- Demo Data Seed → KPI Plan Math: recalculates with (evidence: `server/demoSeed.ts`)
- Business KPI Matrix → KPI Plan Math: calculates with (evidence: `src/components/BusinessKpiMatrixView.tsx`)
- KPI Settings → Business KPI Matrix: renders (evidence: `src/components/SettingsView.tsx`)
- KPI Trends → KPI Analytics: calculates with (evidence: `src/components/TrendsView.tsx`)
- KPI Ledger → KPI Analytics: calculates with (evidence: `src/components/LedgerView.tsx`)
- Server API → KPI Excel Export: exports with (evidence: `server.ts`)
- Server API → KPI Domain Types: validates with (evidence: `server.ts`)
- Database Layer → KPI Domain Types: parses with (evidence: `server/db.ts`)
