USMLE Case Generator
Generate USMLE Step 1 and Step 2 CK style clinical cases for medical education and board exam preparation.
Features
- Step 1 Cases: Basic science concepts, pathophysiology, pharmacology
- Step 2 Cases: Clinical diagnosis, management, next best steps
- Complete Vignettes: History, physical exam, labs, imaging
- Multiple Choice Questions: Single best answer format
- Answer Explanations: Detailed rationale for learning
Usage
# Generate a Step 1 case (pathophysiology focus)
python scripts/main.py --step 1 --topic cardiology --difficulty medium
# Generate a Step 2 case (clinical management focus)
python scripts/main.py --step 2 --topic nephrology --include-diagnosis
# Generate case with specific conditions
python scripts/main.py --step 2 --condition "diabetic ketoacidosis" --format json
Parameters
| Parameter |
Options |
Description |
--step |
1, 2 |
USMLE Step level |
--topic |
See references/topics.json |
Medical specialty |
--condition |
Any condition |
Specific disease/condition |
--difficulty |
easy, medium, hard |
Case complexity |
--format |
text, json, markdown |
Output format |
--include-diagnosis |
flag |
Include answer key |
--count |
1-10 |
Number of cases to generate |
Topics Covered
- Cardiology
- Pulmonology
- Gastroenterology
- Nephrology
- Endocrinology
- Hematology/Oncology
- Infectious Disease
- Neurology
- Psychiatry
- Musculoskeletal
- Dermatology
- Obstetrics/Gynecology
- Pediatrics
- Surgery
Case Structure
Each generated case includes:
- Patient Demographics: Age, gender, relevant background
- Chief Complaint: Presenting problem
- History of Present Illness: Detailed symptom timeline
- Past Medical History: Relevant comorbidities
- Medications: Current drug regimen
- Allergies: Drug/environmental allergies
- Family History: Genetic conditions
- Social History: Smoking, alcohol, occupation
- Physical Examination: Vital signs, relevant findings
- Laboratory Studies: CBC, CMP, specific markers
- Imaging/Diagnostics: X-ray, CT, ECG, etc.
- Question: USMLE-style multiple choice
- Answer Options: 5 choices (A-E)
- Correct Answer: With detailed explanation
- Educational Objectives: Key learning points
Output Formats
Text Format (Default)
Plain text suitable for printing or reading.
JSON Format
Structured data for integration with applications.
Markdown Format
Formatted for documentation or web display.
Technical Difficulty
High - Requires medical knowledge validation and clinical accuracy.
⚠️ Manual Review Required: Generated cases should be reviewed by medical professionals before use in high-stakes educational settings.
References
references/topics.json - Medical specialty taxonomy
references/case_templates.json - Case structure templates
references/usmle_patterns.md - USMLE question patterns
references/conditions/ - Condition-specific case data
Example Output
Case: A 58-year-old male with chest pain
A 58-year-old man presents to the emergency department with
crushing substernal chest pain radiating to his left arm,
beginning 2 hours ago at rest...
[History, physical, labs, ECG findings...]
Question: What is the most appropriate next step in management?
A. Administer aspirin and nitroglycerin
B. Order CT pulmonary angiography
C. Perform immediate synchronized cardioversion
D. Start heparin drip and call cardiology
E. Discharge with outpatient stress test
Correct Answer: D
Explanation: [Detailed rationale...]
Safety & Limitations
- Cases are AI-generated and may contain inaccuracies
- Not a substitute for professional medical education
- Always verify clinical details with authoritative sources
- Intended for educational purposes only
Dependencies
- Python 3.8+
- No external API dependencies (template-based generation)
- Optional: LLM integration for case variation
Risk Assessment
| Risk Indicator |
Assessment |
Level |
| Code Execution |
Python/R scripts executed locally |
Medium |
| Network Access |
No external API calls |
Low |
| File System Access |
Read input files, write output files |
Medium |
| Instruction Tampering |
Standard prompt guidelines |
Low |
| Data Exposure |
Output files saved to workspace |
Low |
Security Checklist
Prerequisites
# Python dependencies
pip install -r requirements.txt
Evaluation Criteria
Success Metrics
Test Cases
- Basic Functionality: Standard input → Expected output
- Edge Case: Invalid input → Graceful error handling
- Performance: Large dataset → Acceptable processing time
Lifecycle Status
- Current Stage: Draft
- Next Review Date: 2026-03-06
- Known Issues: None
- Planned Improvements:
- Performance optimization
- Additional feature support
1---2name: usmle-case-generator3description: Generate USMLE Step 1/2 style clinical cases with patient history, physical exam, lab results, and diagnosis options. Trigger when user requests medical case studies, USMLE practice questions, clinical vignettes, or medical board exam preparation materials.4license: MIT5---6
7# USMLE Case Generator
8
9Generate USMLE Step 1 and Step 2 CK style clinical cases for medical education and board exam preparation.
10
11## Features
12
13- **Step 1 Cases**: Basic science concepts, pathophysiology, pharmacology
14- **Step 2 Cases**: Clinical diagnosis, management, next best steps
15- **Complete Vignettes**: History, physical exam, labs, imaging
16- **Multiple Choice Questions**: Single best answer format
17- **Answer Explanations**: Detailed rationale for learning
18
19## Usage
20
21```python
22# Generate a Step 1 case (pathophysiology focus)
23python scripts/main.py --step 1 --topic cardiology --difficulty medium
24
25# Generate a Step 2 case (clinical management focus)
26python scripts/main.py --step 2 --topic nephrology --include-diagnosis
27
28# Generate case with specific conditions
29python scripts/main.py --step 2 --condition "diabetic ketoacidosis" --format json
30```
31
32## Parameters
33
34| Parameter | Options | Description |
35|-----------|---------|-------------|
36| `--step` | 1, 2 | USMLE Step level |
37| `--topic` | See references/topics.json | Medical specialty |
38| `--condition` | Any condition | Specific disease/condition |
39| `--difficulty` | easy, medium, hard | Case complexity |
40| `--format` | text, json, markdown | Output format |
41| `--include-diagnosis` | flag | Include answer key |
42| `--count` | 1-10 | Number of cases to generate |
43
44## Topics Covered
45
46- Cardiology
47- Pulmonology
48- Gastroenterology
49- Nephrology
50- Endocrinology
51- Hematology/Oncology
52- Infectious Disease
53- Neurology
54- Psychiatry
55- Musculoskeletal
56- Dermatology
57- Obstetrics/Gynecology
58- Pediatrics
59- Surgery
60
61## Case Structure
62
63Each generated case includes:
64
651. **Patient Demographics**: Age, gender, relevant background
662. **Chief Complaint**: Presenting problem
673. **History of Present Illness**: Detailed symptom timeline
684. **Past Medical History**: Relevant comorbidities
695. **Medications**: Current drug regimen
706. **Allergies**: Drug/environmental allergies
717. **Family History**: Genetic conditions
728. **Social History**: Smoking, alcohol, occupation
739. **Physical Examination**: Vital signs, relevant findings
7410. **Laboratory Studies**: CBC, CMP, specific markers
7511. **Imaging/Diagnostics**: X-ray, CT, ECG, etc.
7612. **Question**: USMLE-style multiple choice
7713. **Answer Options**: 5 choices (A-E)
7814. **Correct Answer**: With detailed explanation
7915. **Educational Objectives**: Key learning points
80
81## Output Formats
82
83### Text Format (Default)
84Plain text suitable for printing or reading.
85
86### JSON Format
87Structured data for integration with applications.
88
89### Markdown Format
90Formatted for documentation or web display.
91
92## Technical Difficulty
93
94**High** - Requires medical knowledge validation and clinical accuracy.
95
96⚠️ **Manual Review Required**: Generated cases should be reviewed by medical professionals before use in high-stakes educational settings.
97
98## References
99
100- `references/topics.json` - Medical specialty taxonomy
101- `references/case_templates.json` - Case structure templates
102- `references/usmle_patterns.md` - USMLE question patterns
103- `references/conditions/` - Condition-specific case data
104
105## Example Output
106
107```
108Case: A 58-year-old male with chest pain
109
110A 58-year-old man presents to the emergency department with
111crushing substernal chest pain radiating to his left arm,
112beginning 2 hours ago at rest...
113
114[History, physical, labs, ECG findings...]
115
116Question: What is the most appropriate next step in management?
117
118A. Administer aspirin and nitroglycerin
119B. Order CT pulmonary angiography
120C. Perform immediate synchronized cardioversion
121D. Start heparin drip and call cardiology
122E. Discharge with outpatient stress test
123
124Correct Answer: D
125Explanation: [Detailed rationale...]
126```
127
128## Safety & Limitations
129
130- Cases are AI-generated and may contain inaccuracies
131- Not a substitute for professional medical education
132- Always verify clinical details with authoritative sources
133- Intended for educational purposes only
134
135## Dependencies
136
137- Python 3.8+
138- No external API dependencies (template-based generation)
139- Optional: LLM integration for case variation
140
141## Risk Assessment
142
143| Risk Indicator | Assessment | Level |
144|----------------|------------|-------|
145| Code Execution | Python/R scripts executed locally | Medium |
146| Network Access | No external API calls | Low |
147| File System Access | Read input files, write output files | Medium |
148| Instruction Tampering | Standard prompt guidelines | Low |
149| Data Exposure | Output files saved to workspace | Low |
150
151## Security Checklist
152
153- [ ] No hardcoded credentials or API keys
154- [ ] No unauthorized file system access (../)
155- [ ] Output does not expose sensitive information
156- [ ] Prompt injection protections in place
157- [ ] Input file paths validated (no ../ traversal)
158- [ ] Output directory restricted to workspace
159- [ ] Script execution in sandboxed environment
160- [ ] Error messages sanitized (no stack traces exposed)
161- [ ] Dependencies audited
162## Prerequisites
163
164```bash
165# Python dependencies
166pip install -r requirements.txt
167```
168
169## Evaluation Criteria
170
171### Success Metrics
172- [ ] Successfully executes main functionality
173- [ ] Output meets quality standards
174- [ ] Handles edge cases gracefully
175- [ ] Performance is acceptable
176
177### Test Cases
1781. **Basic Functionality**: Standard input → Expected output
1792. **Edge Case**: Invalid input → Graceful error handling
1803. **Performance**: Large dataset → Acceptable processing time
181
182## Lifecycle Status
183
184- **Current Stage**: Draft
185- **Next Review Date**: 2026-03-06
186- **Known Issues**: None
187- **Planned Improvements**:
188 - Performance optimization
189 - Additional feature support