# darshan-tester/medical-imaging-project architecture

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

- Interactive diagram: https://gitdiagram.com/darshan-tester/medical-imaging-project
- Repository: https://github.com/darshan-tester/medical-imaging-project

## Overview

Meridian is a clinical radiology workstation and PACS-style platform, with both a Next.js web application and a separate desktop application. The primary workflow takes a radiologist from study worklist and image review through annotations, linked 3D inspection, report review, and sign-off. The graph includes documented product stages and the sampled manifest, agent, and worker layers; several viewer, report, and API relationships are documented capabilities rather than inspected call paths.

Main entry points: [`lib/dataset/manifest-store.ts`](https://github.com/darshan-tester/medical-imaging-project/blob/main/lib/dataset/manifest-store.ts) (Dataset Manifest), [`app/api/ai/analyze/route.ts`](https://github.com/darshan-tester/medical-imaging-project/blob/main/app/api/ai/analyze/route.ts) (Analysis API), [`app/(portal)/studies/[id]/page.tsx`](https://github.com/darshan-tester/medical-imaging-project/blob/main/app/(portal)/studies/%5Bid%5D/page.tsx) (Study Workspace), [`components/viewer/ClinicalWorkstation.tsx`](https://github.com/darshan-tester/medical-imaging-project/blob/main/components/viewer/ClinicalWorkstation.tsx) (Image Viewer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Study Intake"]
  node_worklist["Study Worklist<br/>[page.tsx]"]
  node_upload["Upload Studies<br/>[page.tsx]"]
  node_upload_parser["Upload Parser<br/>[parse.ts]"]
  node_study_api["Study API<br/>[route.ts]"]
end

subgraph group_diagnostics["Diagnostic Workstation"]
  node_study_detail["Study Workspace<br/>[page.tsx]"]
  node_viewer["Image Viewer"]
  node_annotations["Finding Annotations"]
  node_three_d["3D Anatomy"]
  node_four_d["4D Cine"]
  node_desktop["Desktop Workstation<br/>[main.py]"]
end

subgraph group_ai["AI Analysis"]
  node_analyze_api["Analysis API<br/>[route.ts]"]
  node_agent_orchestrator["Agent Orchestrator<br/>[orchestrator.ts]"]
  node_ai_jobs["AI Job API<br/>[route.ts]"]
  node_worker["AI Worker<br/>[worker.py]"]
  node_organ_pipelines["Organ Pipelines"]
  node_derived_outputs["Derived Outputs<br/>[manifest.py]"]
end

subgraph group_reporting["Reporting"]
  node_report_review["Report Review<br/>[ReportTab.tsx]"]
  node_report_api["Report API<br/>[route.ts]"]
end

subgraph group_data["Data Services"]
  node_manifest[("Dataset Manifest<br/>[manifest-store.ts]")]
  node_study_mapping["Study Mapping<br/>[to-app-study.ts]"]
  node_data_source["Study Data Source<br/>[data-source.ts]"]
end

node_radiologist(("Radiologist"))
node_dataset[("Imaging Dataset")]

node_radiologist -->|"selects study"| node_worklist
node_worklist -->|"opens study"| node_study_detail
node_radiologist -->|"uploads scans"| node_upload
node_upload -->|"parses files"| node_upload_parser
node_upload_parser -->|"stores upload"| node_data_source
node_study_detail -->|"opens images"| node_viewer
node_viewer -->|"creates findings"| node_annotations
node_annotations -->|"places markers"| node_three_d
node_three_d -->|"jumps to slice"| node_viewer
node_study_detail -->|"views temporal data"| node_four_d
node_radiologist -->|"reviews findings"| node_report_review
node_report_review -.->|"approves report"| node_report_api
node_radiologist -.->|"launches workstation"| node_desktop
node_analyze_api -->|"reads studies"| node_manifest
node_analyze_api -->|"maps study"| node_study_mapping
node_analyze_api -->|"runs agents"| node_agent_orchestrator
node_agent_orchestrator -.->|"returns analysis"| node_report_review
node_ai_jobs -->|"reads studies"| node_manifest
node_ai_jobs -.->|"spawns process"| node_worker
node_worker -->|"dispatches jobs"| node_organ_pipelines
node_organ_pipelines -->|"writes outputs"| node_derived_outputs
node_study_api -->|"reads index"| node_manifest
node_study_api -->|"maps studies"| node_study_mapping
node_data_source -.->|"loads studies"| node_dataset
node_dataset -.->|"indexed into"| node_manifest

click node_worklist "https://github.com/darshan-tester/medical-imaging-project/blob/main/app/(portal)/studies/page.tsx"
click node_upload "https://github.com/darshan-tester/medical-imaging-project/blob/main/app/(portal)/upload/page.tsx"
click node_upload_parser "https://github.com/darshan-tester/medical-imaging-project/blob/main/lib/uploads/parse.ts"
click node_study_api "https://github.com/darshan-tester/medical-imaging-project/blob/main/app/api/studies/route.ts"
click node_study_detail "https://github.com/darshan-tester/medical-imaging-project/blob/main/app/(portal)/studies/%5Bid%5D/page.tsx"
click node_viewer "https://github.com/darshan-tester/medical-imaging-project/blob/main/components/viewer/ClinicalWorkstation.tsx"
click node_annotations "https://github.com/darshan-tester/medical-imaging-project/blob/main/lib/annotation-store.ts"
click node_three_d "https://github.com/darshan-tester/medical-imaging-project/blob/main/components/viewer/Patient3DAnatomyViewer.tsx"
click node_four_d "https://github.com/darshan-tester/medical-imaging-project/blob/main/components/viewer/Patient4DCineViewer.tsx"
click node_desktop "https://github.com/darshan-tester/medical-imaging-project/blob/main/desktop/main.py"
click node_analyze_api "https://github.com/darshan-tester/medical-imaging-project/blob/main/app/api/ai/analyze/route.ts"
click node_agent_orchestrator "https://github.com/darshan-tester/medical-imaging-project/blob/main/lib/agents/orchestrator.ts"
click node_ai_jobs "https://github.com/darshan-tester/medical-imaging-project/blob/main/app/api/ai/jobs/route.ts"
click node_worker "https://github.com/darshan-tester/medical-imaging-project/blob/main/services/ai_worker/worker.py"
click node_organ_pipelines "https://github.com/darshan-tester/medical-imaging-project/tree/main/services/ai_worker/pipelines"
click node_derived_outputs "https://github.com/darshan-tester/medical-imaging-project/blob/main/services/ai_worker/outputs/manifest.py"
click node_report_review "https://github.com/darshan-tester/medical-imaging-project/blob/main/components/report/ReportTab.tsx"
click node_report_api "https://github.com/darshan-tester/medical-imaging-project/blob/main/app/api/studies/%5Bid%5D/report/route.ts"
click node_manifest "https://github.com/darshan-tester/medical-imaging-project/blob/main/lib/dataset/manifest-store.ts"
click node_study_mapping "https://github.com/darshan-tester/medical-imaging-project/blob/main/lib/dataset/to-app-study.ts"
click node_data_source "https://github.com/darshan-tester/medical-imaging-project/blob/main/lib/data-source.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_worklist,node_upload,node_upload_parser,node_study_api toneBlue
class node_study_detail,node_viewer,node_annotations,node_three_d,node_four_d,node_desktop,node_dataset toneAmber
class node_analyze_api,node_agent_orchestrator,node_ai_jobs,node_worker,node_organ_pipelines,node_derived_outputs toneMint
class node_report_review,node_report_api toneRose
class node_manifest,node_study_mapping,node_data_source,node_radiologist toneIndigo
```

## Components

### Study Intake

- [Study Worklist](https://github.com/darshan-tester/medical-imaging-project/blob/main/app/(portal)/studies/page.tsx): `app/(portal)/studies/page.tsx`
- [Upload Studies](https://github.com/darshan-tester/medical-imaging-project/blob/main/app/(portal)/upload/page.tsx): `app/(portal)/upload/page.tsx`
- [Upload Parser](https://github.com/darshan-tester/medical-imaging-project/blob/main/lib/uploads/parse.ts): `lib/uploads/parse.ts`
- [Study API](https://github.com/darshan-tester/medical-imaging-project/blob/main/app/api/studies/route.ts): `app/api/studies/route.ts`

### Diagnostic Workstation

- [Study Workspace](https://github.com/darshan-tester/medical-imaging-project/blob/main/app/(portal)/studies/%5Bid%5D/page.tsx): `app/(portal)/studies/[id]/page.tsx`
- [Image Viewer](https://github.com/darshan-tester/medical-imaging-project/blob/main/components/viewer/ClinicalWorkstation.tsx): `components/viewer/ClinicalWorkstation.tsx`
- [Finding Annotations](https://github.com/darshan-tester/medical-imaging-project/blob/main/lib/annotation-store.ts): `lib/annotation-store.ts`
- [3D Anatomy](https://github.com/darshan-tester/medical-imaging-project/blob/main/components/viewer/Patient3DAnatomyViewer.tsx): `components/viewer/Patient3DAnatomyViewer.tsx`
- [4D Cine](https://github.com/darshan-tester/medical-imaging-project/blob/main/components/viewer/Patient4DCineViewer.tsx): `components/viewer/Patient4DCineViewer.tsx`
- [Desktop Workstation](https://github.com/darshan-tester/medical-imaging-project/blob/main/desktop/main.py): `desktop/main.py`

### AI Analysis

- [Analysis API](https://github.com/darshan-tester/medical-imaging-project/blob/main/app/api/ai/analyze/route.ts): `app/api/ai/analyze/route.ts`
- [Agent Orchestrator](https://github.com/darshan-tester/medical-imaging-project/blob/main/lib/agents/orchestrator.ts): `lib/agents/orchestrator.ts`
- [AI Job API](https://github.com/darshan-tester/medical-imaging-project/blob/main/app/api/ai/jobs/route.ts): `app/api/ai/jobs/route.ts`
- [AI Worker](https://github.com/darshan-tester/medical-imaging-project/blob/main/services/ai_worker/worker.py): `services/ai_worker/worker.py`
- [Organ Pipelines](https://github.com/darshan-tester/medical-imaging-project/tree/main/services/ai_worker/pipelines): `services/ai_worker/pipelines`
- [Derived Outputs](https://github.com/darshan-tester/medical-imaging-project/blob/main/services/ai_worker/outputs/manifest.py): `services/ai_worker/outputs/manifest.py`

### Reporting

- [Report Review](https://github.com/darshan-tester/medical-imaging-project/blob/main/components/report/ReportTab.tsx): `components/report/ReportTab.tsx`
- [Report API](https://github.com/darshan-tester/medical-imaging-project/blob/main/app/api/studies/%5Bid%5D/report/route.ts): `app/api/studies/[id]/report/route.ts`

### Data Services

- [Dataset Manifest](https://github.com/darshan-tester/medical-imaging-project/blob/main/lib/dataset/manifest-store.ts): `lib/dataset/manifest-store.ts`
- [Study Mapping](https://github.com/darshan-tester/medical-imaging-project/blob/main/lib/dataset/to-app-study.ts): `lib/dataset/to-app-study.ts`
- [Study Data Source](https://github.com/darshan-tester/medical-imaging-project/blob/main/lib/data-source.ts): `lib/data-source.ts`

### Other components

- **Radiologist**
- **Imaging Dataset**

## Connections

- Radiologist → Study Worklist: selects study (evidence: `README.md`)
- Study Worklist → Study Workspace: opens study (evidence: `README.md`)
- Radiologist → Upload Studies: uploads scans (evidence: `README.md`)
- Upload Studies → Upload Parser: parses files (evidence: `app/(portal)/upload/page.tsx`)
- Upload Parser → Study Data Source: stores upload (evidence: `lib/data-source.ts`)
- Study Workspace → Image Viewer: opens images (evidence: `README.md`)
- Image Viewer → Finding Annotations: creates findings (evidence: `README.md`)
- Finding Annotations → 3D Anatomy: places markers (evidence: `README.md`)
- 3D Anatomy → Image Viewer: jumps to slice (evidence: `README.md`)
- Study Workspace → 4D Cine: views temporal data (evidence: `README.md`)
- Radiologist → Report Review: reviews findings (evidence: `README.md`)
- Report Review → Report API: approves report
- Radiologist → Desktop Workstation: launches workstation
- Analysis API → Dataset Manifest: reads studies (evidence: `app/api/ai/analyze/route.ts`)
- Analysis API → Study Mapping: maps study (evidence: `app/api/ai/analyze/route.ts`)
- Analysis API → Agent Orchestrator: runs agents (evidence: `app/api/ai/analyze/route.ts`)
- Agent Orchestrator → Report Review: returns analysis
- AI Job API → Dataset Manifest: reads studies (evidence: `app/api/ai/jobs/route.ts`)
- AI Job API → AI Worker: spawns process
- AI Worker → Organ Pipelines: dispatches jobs (evidence: `services/ai_worker/worker.py`)
- Organ Pipelines → Derived Outputs: writes outputs (evidence: `services/ai_worker/pipelines/lungs_pipeline.py`)
- Study API → Dataset Manifest: reads index (evidence: `app/api/studies/route.ts`)
- Study API → Study Mapping: maps studies (evidence: `app/api/studies/route.ts`)
- Study Data Source → Imaging Dataset: loads studies
- Imaging Dataset → Dataset Manifest: indexed into
