DrSyedFaizan commited on
Commit
ddbe648
·
verified ·
1 Parent(s): 40a4382

add README.md

Browse files
Files changed (1) hide show
  1. README.md +100 -7
README.md CHANGED
@@ -1,13 +1,106 @@
1
  ---
2
- title: Deferrl Reader Study
3
- emoji: 🌖
4
- colorFrom: green
5
- colorTo: red
6
  sdk: gradio
7
- sdk_version: 6.19.0
8
- python_version: '3.13'
9
  app_file: app.py
10
  pinned: false
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: DEFER-RL Reader Study
3
+ emoji: 🩻
4
+ colorFrom: indigo
5
+ colorTo: gray
6
  sdk: gradio
7
+ sdk_version: 6.17.3
 
8
  app_file: app.py
9
  pinned: false
10
  ---
11
 
12
+ # DEFER-RL Radiologist Reader Study
13
+
14
+ A blinded, multi-reader appropriateness study for the DEFER-RL project. Each case shows one
15
+ reference imaging panel beside several anonymized, order-randomized **deferral-system decision
16
+ panels** (DEFER-RL plus baselines). Readers rate each panel's decision; the backend derives any
17
+ best/worst rankings. No model names are shown.
18
+
19
+ ## What the reader rates (per case)
20
+
21
+ * **Per panel (one row each):** decision appropriateness (1-5), evidence-gathering adequacy (1-5),
22
+ reading soundness (1-5, only when the panel chose *Trust*), and a yes/no *misleading* judgement
23
+ with an inline definition and worked example.
24
+ * **Per case:** "should this case **not** be auto-read?" (yes/partial/no) and "is the reference
25
+ imaging adequate to judge?" (yes/partial/no).
26
+
27
+ Every scale legend is printed inline, every rating value has a hover tooltip, and each image has its
28
+ own display-only zoom / brightness / contrast strip directly beneath it.
29
+
30
+ ## Deploy as a Hugging Face Space
31
+
32
+ 1. Create a **Gradio** Space (SDK version `6.17.3`, set by this README) and upload `app.py`,
33
+ `requirements.txt`, `README.md`. (Gradio is installed from `sdk_version`; do not pin it in
34
+ `requirements.txt`.)
35
+ 2. Add a **private dataset** for responses (e.g. `your-org/deferrl-reader-responses`).
36
+ 3. In the Space **Settings -> Variables and secrets**, set:
37
+ * `ANNOTATORS` (secret) - JSON of per-user credentials, e.g.
38
+ `{"dr_smith":"s3cret-a","dr_lee":"s3cret-b"}`. The username each reader types is their
39
+ annotator name and keys their own response file.
40
+ * `DATASET_REPO` (variable) - the private dataset id above.
41
+ * `HF_TOKEN` (secret) - a token with **write** access to that dataset.
42
+ * optional: `COMMIT_EVERY_MIN` (default `1`), `MAX_ITEMS` (default `5`), `DATA_DIR`, `RESP_DIR`.
43
+ 4. (Recommended) Enable **persistent storage** on the Space so `responses_local/` survives restarts
44
+ between dataset syncs.
45
+
46
+ If `DATASET_REPO`/`HF_TOKEN` are unset the app still runs and writes responses locally (good for a
47
+ dry run). With them set, every **Save & Next** is streamed to the private dataset by a
48
+ `CommitScheduler`.
49
+
50
+ ## Loading real cases
51
+
52
+ Replace the auto-generated sample data by committing your own `data/cases.json` and `data/images/`.
53
+ Schema for each case:
54
+
55
+ ```json
56
+ {
57
+ "case_id": "C001",
58
+ "cohort": "LIDC-IDRI chest CT",
59
+ "reference_image": "images/C001_ref.png",
60
+ "show_trail": true,
61
+ "ground_truth": {"image": "images/C001_gt.png", "text": "Reference standard: ..."},
62
+ "items": [
63
+ {"item_id": "defer_rl", "action": "Defer", "reading": "(routed to radiologist)",
64
+ "image": "images/C001_defer_rl.png", "trail": ["images/C001_defer_rl_t0.png", "..."]},
65
+ {"item_id": "atcxr", "action": "Trust", "reading": "No suspicious finding. BI-RADS 1.",
66
+ "image": "images/C001_atcxr.png", "trail": ["..."]}
67
+ ]
68
+ }
69
+ ```
70
+
71
+ * `item_id` is the true system name (never shown to readers); the UI shows blinded "Panel A/B/...".
72
+ * `action` is `"Trust"` or `"Defer"`; soundness is only asked for `Trust` panels.
73
+ * `show_trail` is the per-case **evidence-trail ablation** condition (saved with every response).
74
+ * Put a balanced mix of difficulty / cohort / routing in the manifest for stratified analysis.
75
+
76
+ If `data/cases.json` is absent, the app generates six synthetic sample cases so the Space runs
77
+ immediately; delete them once real data is in place.
78
+
79
+ ## Response schema (robust to UI changes)
80
+
81
+ Responses are append-only JSONL, one line per **(annotator, case_id, item_id, dimension) -> value**:
82
+
83
+ ```json
84
+ {"schema_version":"deferrl-reader-1","ts":"...Z","annotator":"dr_smith","case_id":"C001",
85
+ "item_id":"defer_rl","dimension":"appropriateness","value":"4","presented_pos":2,
86
+ "item_action":"Defer","case_condition_show_trail":true}
87
+ ```
88
+
89
+ Case-level answers use `item_id":"__case__"`. Because each value is an atomic, self-describing row,
90
+ later changes to layout, controls, or wording can never overwrite or invalidate prior annotations,
91
+ and best/worst rankings are derived offline from the per-panel scores.
92
+
93
+ ## Analysis pointers (offline)
94
+
95
+ * `P_app` = fraction of *Defer* decisions (per system) with median reader rating >= 4.
96
+ * Inter-rater agreement: weighted Cohen's kappa and Gwet's AC1 over the ordinal ratings.
97
+ * Evidence-trail effect: compare ratings on `show_trail=true` vs `false` cases.
98
+ * Rankings: order systems within each case by appropriateness; readers are never asked to rank.
99
+
100
+ ## Notes / limits
101
+
102
+ * "Zero scrolling" is best on a wide display; each panel is self-contained (its controls, legend, and
103
+ tooltips sit with its image), so you never scroll to learn what a control means. With `MAX_ITEMS`
104
+ large on a small screen, rows may extend below the fold - lower `MAX_ITEMS` or use a wide monitor.
105
+ * Zoom/brightness/contrast are pure CSS on the displayed image and never alter stored data.
106
+ * Closing the tab keeps you logged in (session cookie); use **Log out** to end the session.