amirmmahdavikia/pelviset-validation
PelviSet Clinical Validation Reviewer App
A mobile-friendly Gradio app for Dr. Nabian (and any future reviewers) to score the 200-case validation sample (100 random + 100 high-risk) for segmentation and keypoint plausibility. Progress saves after every case and resumes automatically, so a reviewer can do a few cases at a time on their phone and pick up where they left off.
1. Prepare the data
The app expects:
data/
cases.csv
cases/
ustc_005678/
01_raw.jpg
02_seg.png
03_kp.png
ustc_005388/
01_raw.png
02_seg.png
03_kp.png
...This matches your existing cases/ folder as-is — just copy it under data/cases/. File extensions can vary per case/file (the app looks for .png, .jpg, or .jpeg for each of 01_raw, 02_seg, 03_kp).
data/cases.csv is your manifest (review_order, case_id, source, stratum, risk_block, age_months, age_group, sex). Only case_id is required; the rest are shown to the reviewer as context on each case and used to sort cases in review_order.
Before deploying, run the validator to catch anything missing:
python validate_cases.pyIt checks every case_id in data/cases.csv has a matching directory under data/cases/ with all three files present, and flags anything mismatched.
2. Create a private dataset repo for score persistence
HF Spaces have ephemeral disks on the free tier, so scores are pushed to a small private HF dataset repo after every save (near-zero cost, and gives you a full history of every commit as a bonus audit trail).
- On huggingface.co, create a new private dataset repo, e.g.
amirmmahdavikia/pelviset-validation-scores. - Create an HF access token with write access to that repo (Settings → Access Tokens).
3. Create the Space
- New Space → SDK: Gradio → visibility: Private (recommended, since this contains real patient radiographs).
- Push these files to the Space repo:
app.py,requirements.txt,data/cases.csv,data/cases/. - If
data/cases/is large, HF will handle it via git-lfs automatically for you on push. - In the Space's Settings → Variables and secrets, add:
HF_TOKEN— the write token from step 2 (mark as secret)SCORES_DATASET_REPO— e.g.amirmmahdavikia/pelviset-validation-scoresREVIEWERS— e.g.nabian:choose-a-password,reviewer2:another-password(mark as secret; add oneuser:passpair per reviewer)- Restart the Space. It will prompt for username/password on load — send Dr. Nabian his username/password directly (not through the Space itself).
4. Using the app
- Log in with the reviewer credentials you set.
- The app jumps straight to the first unscored case.
- Three tabs per case: Radiograph / Segmentation overlay / Keypoint overlay — tabs keep each image full-width, which works better on a phone than three side-by-side images.
- Score both Likert scales (1–5) and optionally add a note, then Save & Next. Saving is instant and pushes to the dataset repo.
- Skip moves on without saving (for a case they want to revisit).
- Jump to case # lets them go straight to a specific case if needed.
5. Pulling results later
At any point, download scores.csv from the dataset repo (amirmmahdavikia/pelviset-validation-scores) — it has one row per (reviewer, case_id) with seg_score, kp_score, notes, timestamp. This maps directly onto the Likert-scale validation table in the Scientific Data draft.
Notes
- Multiple reviewers are already supported — just add more
user:passpairs toREVIEWERS. Each reviewer's progress and scores are tracked independently by username. - If
SCORES_DATASET_REPO/HF_TOKENaren't set (e.g. local testing), the app falls back to a local temp file so you can try it before wiring up persistence.
