# yale-bids-chen-lab/medpmc architecture

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

- Interactive diagram: https://gitdiagram.com/yale-bids-chen-lab/medpmc
- Repository: https://github.com/yale-bids-chen-lab/medpmc

## Overview

MedPMC’s sampled runtime tree and README describe a five-stage curation workflow: permissively licensed PMC article figure text is screened, figures are downloaded and classified as single- or multi-panel, panels are separated and ordered, captions are aligned to panels, and medical-content classification produces filtered manifests. The graph focuses on this executable curation pipeline; README also describes training, evaluation, and released resources, but those source trees are not present in the supplied file tree. Stage-level wiring follows the README where source excerpts were not sampled.

Main entry points: [`data_curation/01_initial_screening/src/medpmc_initial_screening/pipeline.py`](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/01_initial_screening/src/medpmc_initial_screening/pipeline.py) (Screen workflow), [`data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/pipeline.py`](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/pipeline.py) (Detection workflow), [`data_curation/04_caption_separation_and_alignment/src/medpmc_caption_separation_and_alignment/alignment.py`](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/04_caption_separation_and_alignment/src/medpmc_caption_separation_and_alignment/alignment.py) (Caption alignment), [`data_curation/01_initial_screening/src/medpmc_initial_screening/storage.py`](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/01_initial_screening/src/medpmc_initial_screening/storage.py) (Screened records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_screen["Initial screening"]
  node_screen_cli["Screen CLI<br/>[cli.py]"]
  node_screen_flow["Screen workflow<br/>[pipeline.py]"]
  node_screen_download["Article download<br/>[download.py]"]
  node_screen_extract["Figure-text extraction<br/>[extract.py]"]
  node_screen_model["Caption screening<br/>[screen.py]"]
  node_screen_store["Screened records<br/>[storage.py]"]
end

subgraph group_detect["Figure detection"]
  node_detect_cli["Detection CLI<br/>[cli.py]"]
  node_detect_flow["Detection workflow<br/>[pipeline.py]"]
  node_image_prep["Image preparation<br/>[manifest.py]"]
  node_detect_model["Panel detector<br/>[model.py]"]
  node_detect_store["Detection records<br/>[storage.py]"]
end

subgraph group_separate["Panel separation"]
  node_separate_cli["Separation CLI<br/>[cli.py]"]
  node_separate_model["Panel separation<br/>[separation.py]"]
  node_panel_store["Ordered panel records<br/>[storage.py]"]
end

subgraph group_align["Caption alignment"]
  node_align_cli["Alignment CLI<br/>[cli.py]"]
  node_align_model["Caption alignment<br/>[alignment.py]"]
  node_vlm_backend["Vision-language backend"]
  node_caption_store["Aligned records<br/>[storage.py]"]
end

subgraph group_classify["Medical classification"]
  node_classify_cli["Classification CLI<br/>[cli.py]"]
  node_medical_model["Medical classifier<br/>[classification.py]"]
  node_medical_store["Medical manifests<br/>[storage.py]"]
end

node_researcher(("Curator"))
node_pmc[("PMC articles")]
node_s3[("AWS image store")]

node_researcher -->|"runs"| node_screen_cli
node_pmc -->|"supplies articles"| node_screen_download
node_screen_cli -->|"invokes"| node_screen_flow
node_screen_flow -->|"downloads"| node_screen_download
node_screen_flow -->|"extracts text"| node_screen_extract
node_screen_flow -->|"screens captions"| node_screen_model
node_screen_extract -->|"writes records"| node_screen_store
node_screen_model -->|"writes results"| node_screen_store
node_screen_store -->|"feeds stage one"| node_detect_cli
node_detect_cli -->|"invokes"| node_detect_flow
node_detect_flow -->|"prepares images"| node_image_prep
node_image_prep -->|"fetches images"| node_s3
node_detect_flow -->|"classifies figures"| node_detect_model
node_detect_model -->|"writes detections"| node_detect_store
node_detect_store -->|"feeds stage two"| node_separate_cli
node_separate_cli -->|"runs separation"| node_separate_model
node_separate_model -->|"writes ordered crops"| node_panel_store
node_panel_store -->|"feeds stage three"| node_align_cli
node_align_cli -->|"runs alignment"| node_align_model
node_align_model -->|"requests inference"| node_vlm_backend
node_align_model -->|"writes aligned captions"| node_caption_store
node_caption_store -->|"feeds stage four"| node_classify_cli
node_classify_cli -->|"runs classification"| node_medical_model
node_medical_model -->|"writes filtered results"| node_medical_store

click node_screen_cli "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/01_initial_screening/src/medpmc_initial_screening/cli.py"
click node_screen_flow "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/01_initial_screening/src/medpmc_initial_screening/pipeline.py"
click node_screen_download "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/01_initial_screening/src/medpmc_initial_screening/download.py"
click node_screen_extract "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/01_initial_screening/src/medpmc_initial_screening/extract.py"
click node_screen_model "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/01_initial_screening/src/medpmc_initial_screening/screen.py"
click node_screen_store "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/01_initial_screening/src/medpmc_initial_screening/storage.py"
click node_detect_cli "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/cli.py"
click node_detect_flow "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/pipeline.py"
click node_image_prep "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/manifest.py"
click node_detect_model "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/model.py"
click node_detect_store "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/storage.py"
click node_separate_cli "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/03_multi_panel_figure_separation/src/medpmc_multi_panel_figure_separation/cli.py"
click node_separate_model "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/03_multi_panel_figure_separation/src/medpmc_multi_panel_figure_separation/separation.py"
click node_panel_store "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/03_multi_panel_figure_separation/src/medpmc_multi_panel_figure_separation/storage.py"
click node_align_cli "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/04_caption_separation_and_alignment/src/medpmc_caption_separation_and_alignment/cli.py"
click node_align_model "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/04_caption_separation_and_alignment/src/medpmc_caption_separation_and_alignment/alignment.py"
click node_vlm_backend "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/04_caption_separation_and_alignment/src/medpmc_caption_separation_and_alignment/backends/lmdeploy_backend.py"
click node_caption_store "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/04_caption_separation_and_alignment/src/medpmc_caption_separation_and_alignment/storage.py"
click node_classify_cli "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/05_medical_figure_classification/src/medpmc_medical_figure_classification/cli.py"
click node_medical_model "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/05_medical_figure_classification/src/medpmc_medical_figure_classification/classification.py"
click node_medical_store "https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/05_medical_figure_classification/src/medpmc_medical_figure_classification/storage.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_screen_cli,node_screen_flow,node_screen_download,node_screen_extract,node_screen_model,node_screen_store toneBlue
class node_detect_cli,node_detect_flow,node_image_prep,node_detect_model,node_detect_store,node_pmc,node_s3 toneAmber
class node_separate_cli,node_separate_model,node_panel_store toneMint
class node_align_cli,node_align_model,node_vlm_backend,node_caption_store toneRose
class node_classify_cli,node_medical_model,node_medical_store,node_researcher toneIndigo
```

## Components

### Initial screening

- [Screen CLI](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/01_initial_screening/src/medpmc_initial_screening/cli.py): `data_curation/01_initial_screening/src/medpmc_initial_screening/cli.py`
- [Screen workflow](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/01_initial_screening/src/medpmc_initial_screening/pipeline.py): `data_curation/01_initial_screening/src/medpmc_initial_screening/pipeline.py`
- [Article download](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/01_initial_screening/src/medpmc_initial_screening/download.py): `data_curation/01_initial_screening/src/medpmc_initial_screening/download.py`
- [Figure-text extraction](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/01_initial_screening/src/medpmc_initial_screening/extract.py): `data_curation/01_initial_screening/src/medpmc_initial_screening/extract.py`
- [Caption screening](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/01_initial_screening/src/medpmc_initial_screening/screen.py): `data_curation/01_initial_screening/src/medpmc_initial_screening/screen.py`
- [Screened records](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/01_initial_screening/src/medpmc_initial_screening/storage.py): `data_curation/01_initial_screening/src/medpmc_initial_screening/storage.py`

### Figure detection

- [Detection CLI](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/cli.py): `data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/cli.py`
- [Detection workflow](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/pipeline.py): `data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/pipeline.py`
- [Image preparation](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/manifest.py): `data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/manifest.py`
- [Panel detector](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/model.py): `data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/model.py`
- [Detection records](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/storage.py): `data_curation/02_multi_panel_figure_detection/src/medpmc_multi_panel_figure_detection/storage.py`

### Panel separation

- [Separation CLI](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/03_multi_panel_figure_separation/src/medpmc_multi_panel_figure_separation/cli.py): `data_curation/03_multi_panel_figure_separation/src/medpmc_multi_panel_figure_separation/cli.py`
- [Panel separation](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/03_multi_panel_figure_separation/src/medpmc_multi_panel_figure_separation/separation.py): `data_curation/03_multi_panel_figure_separation/src/medpmc_multi_panel_figure_separation/separation.py`
- [Ordered panel records](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/03_multi_panel_figure_separation/src/medpmc_multi_panel_figure_separation/storage.py): `data_curation/03_multi_panel_figure_separation/src/medpmc_multi_panel_figure_separation/storage.py`

### Caption alignment

- [Alignment CLI](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/04_caption_separation_and_alignment/src/medpmc_caption_separation_and_alignment/cli.py): `data_curation/04_caption_separation_and_alignment/src/medpmc_caption_separation_and_alignment/cli.py`
- [Caption alignment](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/04_caption_separation_and_alignment/src/medpmc_caption_separation_and_alignment/alignment.py): `data_curation/04_caption_separation_and_alignment/src/medpmc_caption_separation_and_alignment/alignment.py`
- [Vision-language backend](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/04_caption_separation_and_alignment/src/medpmc_caption_separation_and_alignment/backends/lmdeploy_backend.py): `data_curation/04_caption_separation_and_alignment/src/medpmc_caption_separation_and_alignment/backends/lmdeploy_backend.py`
- [Aligned records](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/04_caption_separation_and_alignment/src/medpmc_caption_separation_and_alignment/storage.py): `data_curation/04_caption_separation_and_alignment/src/medpmc_caption_separation_and_alignment/storage.py`

### Medical classification

- [Classification CLI](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/05_medical_figure_classification/src/medpmc_medical_figure_classification/cli.py): `data_curation/05_medical_figure_classification/src/medpmc_medical_figure_classification/cli.py`
- [Medical classifier](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/05_medical_figure_classification/src/medpmc_medical_figure_classification/classification.py): `data_curation/05_medical_figure_classification/src/medpmc_medical_figure_classification/classification.py`
- [Medical manifests](https://github.com/yale-bids-chen-lab/medpmc/blob/main/data_curation/05_medical_figure_classification/src/medpmc_medical_figure_classification/storage.py): `data_curation/05_medical_figure_classification/src/medpmc_medical_figure_classification/storage.py`

### Other components

- **Curator**
- **PMC articles**
- **AWS image store**

## Connections

- Curator → Screen CLI: runs
- PMC articles → Article download: supplies articles
- Screen CLI → Screen workflow: invokes
- Screen workflow → Article download: downloads
- Screen workflow → Figure-text extraction: extracts text
- Screen workflow → Caption screening: screens captions
- Figure-text extraction → Screened records: writes records
- Caption screening → Screened records: writes results
- Screened records → Detection CLI: feeds stage one
- Detection CLI → Detection workflow: invokes
- Detection workflow → Image preparation: prepares images
- Image preparation → AWS image store: fetches images
- Detection workflow → Panel detector: classifies figures
- Panel detector → Detection records: writes detections
- Detection records → Separation CLI: feeds stage two
- Separation CLI → Panel separation: runs separation
- Panel separation → Ordered panel records: writes ordered crops
- Ordered panel records → Alignment CLI: feeds stage three
- Alignment CLI → Caption alignment: runs alignment
- Caption alignment → Vision-language backend: requests inference
- Caption alignment → Aligned records: writes aligned captions
- Aligned records → Classification CLI: feeds stage four
- Classification CLI → Medical classifier: runs classification
- Medical classifier → Medical manifests: writes filtered results
