# sohana-018/casebridge architecture

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

- Interactive diagram: https://gitdiagram.com/sohana-018/casebridge
- Repository: https://github.com/sohana-018/casebridge

## Overview

CaseBridge is an internal grievance coordination desk. Officers use the web app to authenticate, review institution and case records, and record case actions; coordinators also review explainable cross-bureau overlap candidates. The README documents institution indexing, append-only history, SLA alerts, role-based visibility, dashboards, and reporting/export. Edges are limited to relationships shown in excerpts, SOURCE INDEX references, or README architecture; unsampled modules are represented at their exact tree paths where their capabilities are documented.

Main entry points: [`backend/app/main.py`](https://github.com/sohana-018/casebridge/blob/main/backend/app/main.py) (FastAPI application), [`frontend/src/api/client.ts`](https://github.com/sohana-018/casebridge/blob/main/frontend/src/api/client.ts) (API client), [`backend/app/db.py`](https://github.com/sohana-018/casebridge/blob/main/backend/app/db.py) (Database access), [`backend/app/routers/cases.py`](https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/cases.py) (Case actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Officer web app"]
  node_spa["CaseBridge interface<br/>[App.tsx]"]
  node_api_client["API client<br/>[client.ts]"]
  node_overview["Overview dashboard<br/>[OverviewPage.tsx]"]
  node_case_pages["Case management<br/>[CasesPage.tsx]"]
  node_institution_pages["Institution profiles"]
  node_overlap_queue["Coordination queue"]
  node_reports_ui["Reports and export<br/>[ReportsPage.tsx]"]
  node_admin_ui["Administration<br/>[AdminPage.tsx]"]
  node_badges["Status indicators<br/>[Badges.tsx]"]
  node_feedback["Loading feedback<br/>[StateFeedback.tsx]"]
  node_toast["Notifications<br/>[Toast.tsx]"]
  node_formatters["Display formatters<br/>[formatters.ts]"]
end

subgraph group_api["API and access"]
  node_api_runtime["FastAPI application<br/>[main.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_auth_utils["Credential utilities<br/>[auth_utils.py]"]
  node_permissions["Role and bureau guards<br/>[permissions.py]"]
end

subgraph group_cases["Case coordination"]
  node_case_router["Case actions<br/>[cases.py]"]
  node_event_router["Case event log<br/>[events.py]"]
  node_institution_router["Institution records<br/>[institutions.py]"]
  node_overlap_router["Overlap review API<br/>[overlaps.py]"]
  node_overlap_engine["Overlap detection<br/>[overlap.py]"]
end

subgraph group_insights["Alerts and insights"]
  node_alert_router["Alert API<br/>[alerts.py]"]
  node_alert_service["SLA and timelines<br/>[alerts.py]"]
  node_dashboard_router["Dashboard API<br/>[dashboard.py]"]
  node_report_service["Analytics and reports<br/>[reports.py]"]
  node_report_router["Report API<br/>[reports.py]"]
  node_email["Email notifications<br/>[email.py]"]
end

subgraph group_persistence["Domain storage"]
  node_db_layer["Database access<br/>[db.py]"]
  node_domain_models["Case domain records<br/>[models.py]"]
  node_database[("CaseBridge database")]
end

node_officer(("Administrative officer"))

node_officer -->|"uses"| node_spa
node_spa -->|"routes through"| node_api_client
node_api_client -->|"REST requests"| node_api_runtime
node_api_runtime -->|"mounts"| node_auth
node_api_runtime -->|"mounts"| node_case_router
node_api_runtime -->|"mounts"| node_event_router
node_api_runtime -->|"mounts"| node_institution_router
node_api_runtime -->|"mounts"| node_overlap_router
node_api_runtime -->|"mounts"| node_alert_router
node_api_runtime -->|"mounts"| node_dashboard_router
node_api_runtime -->|"mounts"| node_report_router
node_auth -->|"verifies credentials"| node_auth_utils
node_case_router -->|"uses notifications"| node_email
node_event_router -->|"uses notifications"| node_email
node_institution_router -->|"runs detection"| node_overlap_engine
node_overlap_router -->|"reviews candidates"| node_overlap_engine
node_alert_router -->|"derives alerts"| node_alert_service
node_dashboard_router -->|"gets analytics"| node_report_service
node_api_runtime -->|"initializes"| node_db_layer
node_db_layer -->|"connects"| node_database
node_case_router -->|"queries records"| node_db_layer
node_event_router -->|"writes events"| node_db_layer
node_overlap_engine -->|"reads and writes"| node_db_layer
node_alert_service -.->|"reads records"| node_db_layer
node_report_service -.->|"aggregates records"| node_db_layer
node_api_client -.->|"serves data"| node_overview
node_api_client -.->|"serves data"| node_case_pages
node_api_client -.->|"serves data"| node_institution_pages
node_api_client -.->|"serves data"| node_overlap_queue
node_api_client -.->|"serves data"| node_reports_ui
node_api_client -.->|"serves data"| node_admin_ui
node_badges -->|"formats signals"| node_formatters

click node_spa "https://github.com/sohana-018/casebridge/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/sohana-018/casebridge/blob/main/frontend/src/api/client.ts"
click node_overview "https://github.com/sohana-018/casebridge/blob/main/frontend/src/pages/OverviewPage.tsx"
click node_case_pages "https://github.com/sohana-018/casebridge/blob/main/frontend/src/pages/CasesPage.tsx"
click node_institution_pages "https://github.com/sohana-018/casebridge/blob/main/frontend/src/pages/InstitutionsPage.tsx"
click node_overlap_queue "https://github.com/sohana-018/casebridge/blob/main/frontend/src/pages/OverlapQueuePage.tsx"
click node_reports_ui "https://github.com/sohana-018/casebridge/blob/main/frontend/src/pages/ReportsPage.tsx"
click node_admin_ui "https://github.com/sohana-018/casebridge/blob/main/frontend/src/pages/AdminPage.tsx"
click node_badges "https://github.com/sohana-018/casebridge/blob/main/frontend/src/components/Badges.tsx"
click node_feedback "https://github.com/sohana-018/casebridge/blob/main/frontend/src/components/StateFeedback.tsx"
click node_toast "https://github.com/sohana-018/casebridge/blob/main/frontend/src/components/Toast.tsx"
click node_formatters "https://github.com/sohana-018/casebridge/blob/main/frontend/src/utils/formatters.ts"
click node_api_runtime "https://github.com/sohana-018/casebridge/blob/main/backend/app/main.py"
click node_auth "https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/auth.py"
click node_auth_utils "https://github.com/sohana-018/casebridge/blob/main/backend/app/auth_utils.py"
click node_permissions "https://github.com/sohana-018/casebridge/blob/main/backend/app/permissions.py"
click node_case_router "https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/cases.py"
click node_event_router "https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/events.py"
click node_institution_router "https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/institutions.py"
click node_overlap_router "https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/overlaps.py"
click node_overlap_engine "https://github.com/sohana-018/casebridge/blob/main/backend/app/services/overlap.py"
click node_alert_router "https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/alerts.py"
click node_alert_service "https://github.com/sohana-018/casebridge/blob/main/backend/app/services/alerts.py"
click node_dashboard_router "https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/dashboard.py"
click node_report_service "https://github.com/sohana-018/casebridge/blob/main/backend/app/services/reports.py"
click node_report_router "https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/reports.py"
click node_email "https://github.com/sohana-018/casebridge/blob/main/backend/app/services/email.py"
click node_db_layer "https://github.com/sohana-018/casebridge/blob/main/backend/app/db.py"
click node_domain_models "https://github.com/sohana-018/casebridge/blob/main/backend/app/models.py"

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_spa,node_api_client,node_overview,node_case_pages,node_institution_pages,node_overlap_queue,node_reports_ui,node_admin_ui,node_badges,node_feedback,node_toast,node_formatters toneBlue
class node_api_runtime,node_auth,node_auth_utils,node_permissions toneAmber
class node_case_router,node_event_router,node_institution_router,node_overlap_router,node_overlap_engine toneMint
class node_alert_router,node_alert_service,node_dashboard_router,node_report_service,node_report_router,node_email toneRose
class node_db_layer,node_domain_models,node_database,node_officer toneIndigo
```

## Components

### Officer web app

- [CaseBridge interface](https://github.com/sohana-018/casebridge/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/sohana-018/casebridge/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Overview dashboard](https://github.com/sohana-018/casebridge/blob/main/frontend/src/pages/OverviewPage.tsx): `frontend/src/pages/OverviewPage.tsx`
- [Case management](https://github.com/sohana-018/casebridge/blob/main/frontend/src/pages/CasesPage.tsx): `frontend/src/pages/CasesPage.tsx`
- [Institution profiles](https://github.com/sohana-018/casebridge/blob/main/frontend/src/pages/InstitutionsPage.tsx): `frontend/src/pages/InstitutionsPage.tsx`
- [Coordination queue](https://github.com/sohana-018/casebridge/blob/main/frontend/src/pages/OverlapQueuePage.tsx): `frontend/src/pages/OverlapQueuePage.tsx`
- [Reports and export](https://github.com/sohana-018/casebridge/blob/main/frontend/src/pages/ReportsPage.tsx): `frontend/src/pages/ReportsPage.tsx`
- [Administration](https://github.com/sohana-018/casebridge/blob/main/frontend/src/pages/AdminPage.tsx): `frontend/src/pages/AdminPage.tsx`
- [Status indicators](https://github.com/sohana-018/casebridge/blob/main/frontend/src/components/Badges.tsx): `frontend/src/components/Badges.tsx`
- [Loading feedback](https://github.com/sohana-018/casebridge/blob/main/frontend/src/components/StateFeedback.tsx): `frontend/src/components/StateFeedback.tsx`
- [Notifications](https://github.com/sohana-018/casebridge/blob/main/frontend/src/components/Toast.tsx): `frontend/src/components/Toast.tsx`
- [Display formatters](https://github.com/sohana-018/casebridge/blob/main/frontend/src/utils/formatters.ts): `frontend/src/utils/formatters.ts`

### API and access

- [FastAPI application](https://github.com/sohana-018/casebridge/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication](https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Credential utilities](https://github.com/sohana-018/casebridge/blob/main/backend/app/auth_utils.py): `backend/app/auth_utils.py`
- [Role and bureau guards](https://github.com/sohana-018/casebridge/blob/main/backend/app/permissions.py): `backend/app/permissions.py`

### Case coordination

- [Case actions](https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/cases.py): `backend/app/routers/cases.py`
- [Case event log](https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/events.py): `backend/app/routers/events.py`
- [Institution records](https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/institutions.py): `backend/app/routers/institutions.py`
- [Overlap review API](https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/overlaps.py): `backend/app/routers/overlaps.py`
- [Overlap detection](https://github.com/sohana-018/casebridge/blob/main/backend/app/services/overlap.py): `backend/app/services/overlap.py`

### Alerts and insights

- [Alert API](https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/alerts.py): `backend/app/routers/alerts.py`
- [SLA and timelines](https://github.com/sohana-018/casebridge/blob/main/backend/app/services/alerts.py): `backend/app/services/alerts.py`
- [Dashboard API](https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/dashboard.py): `backend/app/routers/dashboard.py`
- [Analytics and reports](https://github.com/sohana-018/casebridge/blob/main/backend/app/services/reports.py): `backend/app/services/reports.py`
- [Report API](https://github.com/sohana-018/casebridge/blob/main/backend/app/routers/reports.py): `backend/app/routers/reports.py`
- [Email notifications](https://github.com/sohana-018/casebridge/blob/main/backend/app/services/email.py): `backend/app/services/email.py`

### Domain storage

- [Database access](https://github.com/sohana-018/casebridge/blob/main/backend/app/db.py): `backend/app/db.py`
- [Case domain records](https://github.com/sohana-018/casebridge/blob/main/backend/app/models.py): `backend/app/models.py`
- **CaseBridge database**

### Other components

- **Administrative officer**

## Connections

- Administrative officer → CaseBridge interface: uses
- CaseBridge interface → API client: routes through (evidence: `frontend/src/App.tsx`)
- API client → FastAPI application: REST requests
- FastAPI application → Authentication: mounts (evidence: `backend/app/main.py`)
- FastAPI application → Case actions: mounts (evidence: `backend/app/main.py`)
- FastAPI application → Case event log: mounts (evidence: `backend/app/main.py`)
- FastAPI application → Institution records: mounts (evidence: `backend/app/main.py`)
- FastAPI application → Overlap review API: mounts (evidence: `backend/app/main.py`)
- FastAPI application → Alert API: mounts (evidence: `backend/app/main.py`)
- FastAPI application → Dashboard API: mounts (evidence: `backend/app/main.py`)
- FastAPI application → Report API: mounts (evidence: `backend/app/main.py`)
- Authentication → Credential utilities: verifies credentials (evidence: `backend/app/routers/auth.py`)
- Case actions → Email notifications: uses notifications (evidence: `backend/app/routers/cases.py`)
- Case event log → Email notifications: uses notifications (evidence: `backend/app/routers/events.py`)
- Institution records → Overlap detection: runs detection (evidence: `backend/app/routers/institutions.py`)
- Overlap review API → Overlap detection: reviews candidates (evidence: `backend/app/routers/overlaps.py`)
- Alert API → SLA and timelines: derives alerts (evidence: `backend/app/routers/alerts.py`)
- Dashboard API → Analytics and reports: gets analytics (evidence: `backend/app/routers/dashboard.py`)
- FastAPI application → Database access: initializes (evidence: `backend/app/main.py`)
- Database access → CaseBridge database: connects (evidence: `backend/app/db.py`)
- Case actions → Database access: queries records (evidence: `backend/app/routers/cases.py`)
- Case event log → Database access: writes events (evidence: `backend/app/routers/events.py`)
- Overlap detection → Database access: reads and writes (evidence: `backend/app/services/overlap.py`)
- SLA and timelines → Database access: reads records
- Analytics and reports → Database access: aggregates records
- API client → Overview dashboard: serves data (evidence: `frontend/src/pages/OverviewPage.tsx`)
- API client → Case management: serves data (evidence: `frontend/src/pages/CasesPage.tsx`)
- API client → Institution profiles: serves data
- API client → Coordination queue: serves data (evidence: `frontend/src/pages/OverlapQueuePage.tsx`)
- API client → Reports and export: serves data (evidence: `frontend/src/pages/ReportsPage.tsx`)
- API client → Administration: serves data (evidence: `frontend/src/pages/AdminPage.tsx`)
- Status indicators → Display formatters: formats signals (evidence: `frontend/src/components/Badges.tsx`)
