# sjyzy/csmd architecture

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

- Interactive diagram: https://gitdiagram.com/sjyzy/csmd
- Repository: https://github.com/sjyzy/csmd

## Overview

MMCSD is a cervical-spondylosis imaging dataset accompanied by code for evaluating pain classification from medical images. The documented workflow supplies an image modality, trained weights, and clinical labels to `roc.py`, which selects patient samples, evaluates predictions, computes classification metrics, and saves an ROC plot. The repository tree does not contain the documented image folders; model and checkpoint wiring beyond the sampled excerpts is therefore represented only where documented. `image_dataset.py` separately implements optional paired-image loading and transforms.

Main entry points: [`roc.py`](https://github.com/sjyzy/csmd/blob/main/roc.py) (Model evaluation), [`image_dataset.py`](https://github.com/sjyzy/csmd/blob/main/image_dataset.py) (Paired image loader), [`high_pain_text.xlsx`](https://github.com/sjyzy/csmd/blob/main/high_pain_text.xlsx) (Clinical labels), [`train_id4.txt`](https://github.com/sjyzy/csmd/blob/main/train_id4.txt) (Patient splits)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Dataset inputs"]
  node_modalities[("MRI and CT volumes")]
  node_clinical[("Clinical labels")]
  node_splits["Patient splits<br/>[train_id4.txt]"]
  node_weights["Model weights<br/>[best_auc.pth]"]
end

subgraph group_runtime["Evaluation runtime"]
  node_evaluation["Model evaluation<br/>[roc.py]"]
  node_pair_loader["Paired image loader<br/>[image_dataset.py]"]
end

subgraph group_outputs["Evaluation results"]
  node_metrics["Classification metrics<br/>[roc.py]"]
  node_roc_plot["ROC plot<br/>[roc.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"runs"| node_evaluation
node_modalities -->|"provides volumes"| node_evaluation
node_clinical -->|"provides labels"| node_evaluation
node_splits -->|"provides IDs"| node_evaluation
node_weights -->|"provides checkpoint"| node_evaluation
node_evaluation -->|"computes"| node_metrics
node_evaluation -->|"saves"| node_roc_plot
node_researcher -.->|"uses"| node_pair_loader
node_modalities -.->|"loads pairs"| node_pair_loader

click node_clinical "https://github.com/sjyzy/csmd/blob/main/high_pain_text.xlsx"
click node_splits "https://github.com/sjyzy/csmd/blob/main/train_id4.txt"
click node_weights "https://github.com/sjyzy/csmd/blob/main/assets/best_auc.pth"
click node_evaluation "https://github.com/sjyzy/csmd/blob/main/roc.py"
click node_pair_loader "https://github.com/sjyzy/csmd/blob/main/image_dataset.py"
click node_metrics "https://github.com/sjyzy/csmd/blob/main/roc.py"
click node_roc_plot "https://github.com/sjyzy/csmd/blob/main/roc.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_modalities,node_clinical,node_splits,node_weights toneBlue
class node_evaluation,node_pair_loader toneAmber
class node_metrics,node_roc_plot toneMint
class node_researcher toneIndigo
```

## Components

### Dataset inputs

- **MRI and CT volumes**
- [Clinical labels](https://github.com/sjyzy/csmd/blob/main/high_pain_text.xlsx): `high_pain_text.xlsx`
- [Patient splits](https://github.com/sjyzy/csmd/blob/main/train_id4.txt): `train_id4.txt`
- [Model weights](https://github.com/sjyzy/csmd/blob/main/assets/best_auc.pth): `assets/best_auc.pth`

### Evaluation runtime

- [Model evaluation](https://github.com/sjyzy/csmd/blob/main/roc.py): `roc.py`
- [Paired image loader](https://github.com/sjyzy/csmd/blob/main/image_dataset.py): `image_dataset.py`

### Evaluation results

- [Classification metrics](https://github.com/sjyzy/csmd/blob/main/roc.py): `roc.py`
- [ROC plot](https://github.com/sjyzy/csmd/blob/main/roc.py): `roc.py`

### Other components

- **Researcher**

## Connections

- Researcher → Model evaluation: runs
- MRI and CT volumes → Model evaluation: provides volumes
- Clinical labels → Model evaluation: provides labels
- Patient splits → Model evaluation: provides IDs
- Model weights → Model evaluation: provides checkpoint
- Model evaluation → Classification metrics: computes
- Model evaluation → ROC plot: saves
- Researcher → Paired image loader: uses
- MRI and CT volumes → Paired image loader: loads pairs
