# smkzw/enrollment-review-app architecture

> Architecture diagram of the GitHub repository smkzw/enrollment-review-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/smkzw/enrollment-review-app
- Repository: https://github.com/smkzw/enrollment-review-app

## Overview

This is a clinical-trial evidence and eligibility-review application: users manage protocols and subject evidence, the system processes documents and normalizes facts, and reviewers receive eligibility assessments and durable review history. The graph emphasizes that user-to-result path while retaining protocol-control, page-review, and history capabilities. The README is empty; relationships are limited to those visible in sampled excerpts or the SOURCE INDEX, so unsampled subsystem links are not asserted.

Main entry points: [`app/api/v2/app.py`](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/api/v2/app.py) (API v2), [`app/storage/review_context_repository.py`](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/storage/review_context_repository.py) (Context repository), [`app/services/page_review_job_service.py`](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/page_review_job_service.py) (Page review jobs), [`app/storage/repositories.py`](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/storage/repositories.py) (Storage repositories)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry"]
  node_frontend["Web application<br/>[App.tsx]"]
  node_routes["Application routes<br/>[routes.tsx]"]
  node_api["API v2<br/>[app.py]"]
end

subgraph group_protocol["Protocol setup"]
  node_protocol_ingestion["Protocol ingestion<br/>[ingestion.py]"]
  node_protocol_deconstruction["Protocol deconstruction"]
  node_protocol_scope["Protocol scope review"]
  node_protocol_control["Protocol controls"]
end

subgraph group_evidence["Evidence processing"]
  node_evidence_upload["Evidence upload"]
  node_evidence_processing["Evidence processing"]
  node_evidence_pipeline["OCR and bundling<br/>[pipeline.py]"]
  node_fact_normalization["Fact normalization"]
end

subgraph group_review["Review and decisions"]
  node_page_review["Page review jobs"]
  node_reviewer_engine["Review pipeline<br/>[reviewer.py]"]
  node_eligibility_review["Eligibility review"]
  node_review_actions["Review actions"]
  node_review_history["Review history"]
end

subgraph group_foundation["Domain and persistence"]
  node_llm["Language model client<br/>[client.py]"]
  node_contracts["Domain contracts<br/>[rules.py]"]
  node_review_context["Frozen review context"]
  node_publication["Publication integrity<br/>[publication.py]"]
  node_storage[("Storage repositories<br/>[repositories.py]")]
  node_storage_models[("Storage models<br/>[models.py]")]
  node_context_repository[("Context repository")]
end

node_reviewer(("Reviewer"))

node_reviewer -->|"uses"| node_frontend
node_frontend -->|"renders routes"| node_routes
node_routes -.->|"calls API"| node_api
node_api -->|"routes protocol requests"| node_protocol_ingestion
node_api -.->|"routes evidence requests"| node_evidence_upload
node_api -->|"routes page-review requests"| node_page_review
node_api -->|"routes eligibility requests"| node_eligibility_review
node_api -->|"routes history requests"| node_review_history
node_protocol_ingestion -.->|"supplies protocol input"| node_protocol_deconstruction
node_protocol_deconstruction -.->|"supports scope review"| node_protocol_scope
node_protocol_control -.->|"uses contracts"| node_contracts
node_evidence_upload -.->|"prepares processing"| node_evidence_processing
node_evidence_processing -.->|"feeds document pipeline"| node_evidence_pipeline
node_evidence_pipeline -.->|"feeds fact normalization"| node_fact_normalization
node_page_review -->|"assembles frozen context"| node_review_context
node_page_review -->|"creates persistent job"| node_storage
node_reviewer_engine -->|"calls model client"| node_llm
node_eligibility_review -.->|"uses frozen inputs"| node_review_context
node_review_history -->|"loads frozen context"| node_context_repository
node_context_repository -->|"uses append repository"| node_storage
node_context_repository -->|"validates snapshot"| node_review_context
node_storage -->|"maps records"| node_storage_models
node_context_repository -->|"hashes snapshots"| node_publication

click node_frontend "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/frontend/src/App.tsx"
click node_routes "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/frontend/src/app/routes.tsx"
click node_api "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/api/v2/app.py"
click node_protocol_ingestion "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/protocols/ingestion.py"
click node_protocol_deconstruction "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/protocols/deconstruction_service.py"
click node_protocol_scope "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/protocol_scope_review_service.py"
click node_protocol_control "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/protocol_control_execution.py"
click node_evidence_upload "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/evidence_upload_service.py"
click node_evidence_processing "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/evidence_processing_executor.py"
click node_evidence_pipeline "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/router/pipeline.py"
click node_fact_normalization "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/fact_normalization_executor.py"
click node_page_review "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/page_review_job_service.py"
click node_reviewer_engine "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/pipeline/reviewer.py"
click node_eligibility_review "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/prepared_review_workflow.py"
click node_review_actions "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/review_action_command.py"
click node_review_history "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/review_history_service.py"
click node_llm "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/llm/client.py"
click node_contracts "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/domain/contracts/rules.py"
click node_review_context "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/domain/contracts/review_context_v2.py"
click node_publication "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/domain/publication.py"
click node_storage "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/storage/repositories.py"
click node_storage_models "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/storage/models.py"
click node_context_repository "https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/storage/review_context_repository.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_frontend,node_routes,node_api,node_reviewer toneBlue
class node_protocol_ingestion,node_protocol_deconstruction,node_protocol_scope,node_protocol_control toneAmber
class node_evidence_upload,node_evidence_processing,node_evidence_pipeline,node_fact_normalization toneMint
class node_page_review,node_reviewer_engine,node_eligibility_review,node_review_actions,node_review_history toneRose
class node_llm,node_contracts,node_review_context,node_publication,node_storage,node_storage_models,node_context_repository toneIndigo
```

## Components

### User entry

- [Web application](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Application routes](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/frontend/src/app/routes.tsx): `frontend/src/app/routes.tsx`
- [API v2](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/api/v2/app.py): `app/api/v2/app.py`

### Protocol setup

- [Protocol ingestion](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/protocols/ingestion.py): `app/protocols/ingestion.py`
- [Protocol deconstruction](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/protocols/deconstruction_service.py): `app/protocols/deconstruction_service.py`
- [Protocol scope review](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/protocol_scope_review_service.py): `app/services/protocol_scope_review_service.py`
- [Protocol controls](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/protocol_control_execution.py): `app/services/protocol_control_execution.py`

### Evidence processing

- [Evidence upload](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/evidence_upload_service.py): `app/services/evidence_upload_service.py`
- [Evidence processing](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/evidence_processing_executor.py): `app/services/evidence_processing_executor.py`
- [OCR and bundling](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/router/pipeline.py): `app/router/pipeline.py`
- [Fact normalization](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/fact_normalization_executor.py): `app/services/fact_normalization_executor.py`

### Review and decisions

- [Page review jobs](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/page_review_job_service.py): `app/services/page_review_job_service.py`
- [Review pipeline](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/pipeline/reviewer.py): `app/pipeline/reviewer.py`
- [Eligibility review](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/prepared_review_workflow.py): `app/services/prepared_review_workflow.py`
- [Review actions](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/review_action_command.py): `app/services/review_action_command.py`
- [Review history](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/services/review_history_service.py): `app/services/review_history_service.py`

### Domain and persistence

- [Language model client](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/llm/client.py): `app/llm/client.py`
- [Domain contracts](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/domain/contracts/rules.py): `app/domain/contracts/rules.py`
- [Frozen review context](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/domain/contracts/review_context_v2.py): `app/domain/contracts/review_context_v2.py`
- [Publication integrity](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/domain/publication.py): `app/domain/publication.py`
- [Storage repositories](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/storage/repositories.py): `app/storage/repositories.py`
- [Storage models](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/storage/models.py): `app/storage/models.py`
- [Context repository](https://github.com/smkzw/enrollment-review-app/blob/codex/phase5-clinical-facts-profile/app/storage/review_context_repository.py): `app/storage/review_context_repository.py`

### Other components

- **Reviewer**

## Connections

- Reviewer → Web application: uses
- Web application → Application routes: renders routes (evidence: `frontend/src/app/routes.tsx`)
- Application routes → API v2: calls API
- API v2 → Protocol ingestion: routes protocol requests (evidence: `app/api/v2/app.py`)
- API v2 → Evidence upload: routes evidence requests (evidence: `app/api/v2/app.py`)
- API v2 → Page review jobs: routes page-review requests (evidence: `app/api/v2/app.py`)
- API v2 → Eligibility review: routes eligibility requests (evidence: `app/api/v2/app.py`)
- API v2 → Review history: routes history requests (evidence: `app/api/v2/app.py`)
- Protocol ingestion → Protocol deconstruction: supplies protocol input
- Protocol deconstruction → Protocol scope review: supports scope review
- Protocol controls → Domain contracts: uses contracts
- Evidence upload → Evidence processing: prepares processing
- Evidence processing → OCR and bundling: feeds document pipeline
- OCR and bundling → Fact normalization: feeds fact normalization
- Page review jobs → Frozen review context: assembles frozen context (evidence: `app/services/page_review_job_service.py`)
- Page review jobs → Storage repositories: creates persistent job (evidence: `app/services/page_review_job_service.py`)
- Review pipeline → Language model client: calls model client (evidence: `app/pipeline/reviewer.py`)
- Eligibility review → Frozen review context: uses frozen inputs
- Review history → Context repository: loads frozen context (evidence: `app/services/review_history_service.py`)
- Context repository → Storage repositories: uses append repository (evidence: `app/storage/review_context_repository.py`)
- Context repository → Frozen review context: validates snapshot (evidence: `app/storage/review_context_repository.py`)
- Storage repositories → Storage models: maps records (evidence: `app/storage/repositories.py`)
- Context repository → Publication integrity: hashes snapshots (evidence: `app/storage/review_context_repository.py`)
