@@ -77,3 +77,66 @@ This modular structure allows you to:
7777- Reuse the foundational code
7878- Develop multiple applications in parallel
7979- Easily share specific models without unnecessary files
80+
81+ ## Medical Model Directory Map (v2)
82+
83+ ```
84+ medical_diagnosis_model/
85+ backend/
86+ app.py # FastAPI app: /api/v2/diagnose, /export, /adaptive/*
87+ security/jwt_dep.py # OIDC/JWT scaffold (feature-flagged)
88+ selector/eig_selector.py # EIG ranking util (math-only)
89+ configs/
90+ clinical_schema.yaml # Clinical data mappings (scaffold)
91+ training.yaml # Training/optimizer toggles (scaffold)
92+ data/
93+ case.schema.json # JSON Schema for clinical cases
94+ dictionaries/ # Canonical symptoms/diseases
95+ samples/ # Example JSONL dataset
96+ validate_cases.py # Schema validator CLI
97+ tests/
98+ test_api_phase1.py # API TestClient expected primaries
99+ test_selector.py # EIG selector unit test
100+ phase_1_backend/ # cURL-based test harness & outputs
101+ tools/
102+ sanity.py # Modular sanity CLI (data/tests/api/export/rate/adaptive/suite)
103+ versions/
104+ v1/, v2/ # Model implementations and demos
105+ exports/ # Generated reports (gitignored)
106+ models/ # Saved models (dev artifacts)
107+ diagnosis_history/ # Session logs (gitignored)
108+ README.md # Usage + Auth
109+ NEXT_STEPS.md # Roadmap & acceptance criteria
110+ ```
111+
112+ ## Task Map (completed → pending)
113+
114+ - Completed
115+ - Data scaffolding: ` data/case.schema.json ` , ` data/dictionaries/* ` , ` data/samples/* ` , ` data/validate_cases.py `
116+ - Backend phase 1: ` /diagnose ` , ` /export ` endpoints; CORS; API key auth; request logging; rate limiting
117+ - Security scaffold: OIDC/JWT dependency (` backend/security/jwt_dep.py ` ) behind ` MDM_AUTH_MODE=oidc `
118+ - CI: GitHub Actions runs dataset validation and unit tests via sanity CLI
119+ - Adaptive (alpha): ` /api/v2/adaptive/{start,answer,finish} ` + EIG selector; sanity CLI coverage
120+
121+ - Pending (next)
122+ - Synthetic generator → emit JSONL to schema (` medical_training_generator.py ` refactor)
123+ - Golden set (100 curated cases) with rationale/certainty
124+ - Data quality tests (sanity rules, leakage, balance) and ` DATA_CARD.md `
125+ - Metrics & calibration module (AUROC/AUPRC/F1, reliability/ECE)
126+ - Batch scoring CLI (` backend/tools/batch ` ) and outputs
127+ - Adaptive end-to-end unit tests (FastAPI TestClient)
128+ - RAG PoC (knowledge/, index/, retriever/generator)
129+ - Frontend adaptive mode; persistence/workers; deployment
130+
131+ ## Quick Testing Commands
132+
133+ ``` bash
134+ # From medical_diagnosis_model/
135+ python tools/sanity.py data
136+ python tools/sanity.py tests
137+ python tools/sanity.py api --auto-start --api-key devkey
138+ python tools/sanity.py export --auto-start --api-key devkey
139+ python tools/sanity.py rate --auto-start --api-key devkey --count 140 --expect-over-limit
140+ python tools/sanity.py adaptive --auto-start --api-key devkey
141+ python tools/sanity.py suite --auto-start --api-key devkey --with-api --with-export --with-rate --with-adaptive
142+ ```
0 commit comments