feature: Console Replay Simulator
This commit is contained in:
@@ -0,0 +1,199 @@
|
||||
# VigilCare Scenario Generator Prompt
|
||||
|
||||
Use the following prompt with Claude or any LLM to generate clinical scenario JSON files.
|
||||
|
||||
---
|
||||
|
||||
## Prompt
|
||||
|
||||
You are a clinical scenario generator for a hospital patient monitoring system called VigilCare. Generate a JSON file that simulates a patient's clinical journey through a hospital encounter.
|
||||
|
||||
### JSON Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"scenario": {
|
||||
"id": "kebab-case-id",
|
||||
"name": "Human-readable scenario name",
|
||||
"description": "1-2 sentence clinical summary",
|
||||
"durationMinutes": 240,
|
||||
"tags": ["sepsis", "ed", "deterioration"]
|
||||
},
|
||||
"patient": {
|
||||
"firstName": "Eleanor",
|
||||
"lastName": "Chen",
|
||||
"dateOfBirth": "1954-03-15",
|
||||
"gender": "Female"
|
||||
},
|
||||
"encounter": {
|
||||
"department": "Emergency",
|
||||
"encounterType": "Emergency | Inpatient | Outpatient",
|
||||
"attendingPhysician": "Dr. Sarah Mitchell",
|
||||
"roomBed": "ED-12A",
|
||||
"admissionReason": "Fever, confusion, dysuria"
|
||||
},
|
||||
"events": [
|
||||
{
|
||||
"offsetMinutes": 0,
|
||||
"type": "observation",
|
||||
"data": {
|
||||
"code": "HEART_RATE",
|
||||
"value": 88,
|
||||
"unit": "bpm",
|
||||
"source": "Device"
|
||||
}
|
||||
},
|
||||
{
|
||||
"offsetMinutes": 60,
|
||||
"type": "medication",
|
||||
"data": {
|
||||
"drugName": "ceftriaxone",
|
||||
"dose": 1,
|
||||
"doseUnit": "g",
|
||||
"route": "IV",
|
||||
"administeredBy": "nurse-rn-1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"offsetMinutes": 45,
|
||||
"type": "order",
|
||||
"data": {
|
||||
"orderType": "Lab",
|
||||
"description": "Urinalysis with culture",
|
||||
"orderedBy": "Dr. Sarah Mitchell"
|
||||
}
|
||||
},
|
||||
{
|
||||
"offsetMinutes": 45,
|
||||
"type": "order_result",
|
||||
"data": {
|
||||
"orderDescription": "SEP-1: Blood cultures",
|
||||
"resultSummary": "Pending gram stain"
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectedOutcomes": [
|
||||
{
|
||||
"afterOffsetMinutes": 30,
|
||||
"type": "alert",
|
||||
"alertType": "WARNING_HEART_RATE",
|
||||
"description": "HR enters warning range"
|
||||
},
|
||||
{
|
||||
"afterOffsetMinutes": 120,
|
||||
"type": "alert",
|
||||
"alertType": "SEPSIS_WARNING",
|
||||
"description": "SIRS criteria met"
|
||||
},
|
||||
{
|
||||
"afterOffsetMinutes": 180,
|
||||
"type": "score",
|
||||
"scoreType": "NEWS2",
|
||||
"expectedMinimum": 7,
|
||||
"description": "NEWS2 reaches HIGH risk"
|
||||
},
|
||||
{
|
||||
"afterOffsetMinutes": 120,
|
||||
"type": "bundle",
|
||||
"description": "Sepsis bundle auto-created with 4 orders"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Available Observation Codes
|
||||
|
||||
| Code | Unit | Normal Range | Warning Range | Critical Range |
|
||||
|------|------|-------------|---------------|----------------|
|
||||
| HEART_RATE | bpm | 51–90 | 41–50 or 91–110 | ≤40 or ≥111 |
|
||||
| RESP_RATE | /min | 12–20 | 9–11 or 21–24 | ≤8 or ≥25 |
|
||||
| SYSTOLIC_BP | mmHg | 111–219 | 101–110 | ≤100 or ≥220 |
|
||||
| DIASTOLIC_BP | mmHg | 60–90 | 50–59 or 91–100 | ≤49 or ≥101 |
|
||||
| TEMP_C | °C | 36.1–38.0 | 35.1–36.0 or 38.1–39.0 | ≤35.0 or ≥39.1 |
|
||||
| SPO2 | % | 96–100 | 94–95 | ≤93 |
|
||||
| AVPU | score | 0 (Alert) | — | 1 (Voice) 2 (Pain) 3 (Unresponsive) |
|
||||
| SUPPLEMENTAL_O2 | flag | 0 (No) | — | 1 (Yes) |
|
||||
| WBC_K_UL | ×10³/µL | 4.5–11.0 | — | <4.0 or >12.0 |
|
||||
| POTASSIUM_MEQ_L | mEq/L | 3.5–5.0 | 3.0–3.4 or 5.1–5.5 | <3.0 or >5.5 |
|
||||
| LACTATE_MMOL_L | mmol/L | 0.5–1.5 | 1.6–2.0 | >2.0 |
|
||||
| GLUCOSE_MG_DL | mg/dL | 70–140 | 141–180 | <70 or >180 |
|
||||
|
||||
### Clinical Scoring Rules
|
||||
|
||||
**NEWS2** (computed from: HEART_RATE, RESP_RATE, SYSTOLIC_BP, TEMP_C, SPO2, AVPU, SUPPLEMENTAL_O2):
|
||||
- Total score 5–6 → `NEWS2_WARNING` alert
|
||||
- Total score ≥7 OR any single parameter scores 3 → `NEWS2_EMERGENCY` alert
|
||||
|
||||
**SIRS** (≥2 of 4 criteria → `SEPSIS_WARNING`):
|
||||
- Temperature >38.3°C or <36.0°C
|
||||
- Heart rate >90 bpm
|
||||
- Respiratory rate >20/min
|
||||
- WBC >12.0 or <4.0 ×10³/µL
|
||||
|
||||
**qSOFA** (≥2 of 3 criteria → `QSOFA_WARNING`):
|
||||
- Respiratory rate ≥22/min
|
||||
- Systolic BP ≤100 mmHg
|
||||
- AVPU ≥1 (any altered mentation)
|
||||
|
||||
**Trend alerts** — rapid rise or fall in a vital sign within a 30-minute sliding window triggers `RAPID_DETERIORATION`.
|
||||
|
||||
**Sepsis bundle** — when `SEPSIS_WARNING` or `QSOFA_WARNING` fires, the system auto-creates a sepsis bundle with 4 orders (use these **exact** descriptions in `order_result` events; do **not** add `order` events for them):
|
||||
|
||||
| Description |
|
||||
|---|
|
||||
| `SEP-1: Blood cultures` |
|
||||
| `SEP-1: Serum lactate` |
|
||||
| `SEP-1: Broad-spectrum antibiotics` |
|
||||
| `SEP-1: IV fluid bolus` |
|
||||
|
||||
Place `order_result` events for bundle orders **after** the sepsis alert would fire. For any other lab/imaging order, add an `order` event before `order_result`.
|
||||
|
||||
### Order event types
|
||||
|
||||
Place order (required before `order_result` unless sepsis bundle auto-order):
|
||||
```json
|
||||
{
|
||||
"offsetMinutes": 40,
|
||||
"type": "order",
|
||||
"data": {
|
||||
"orderType": "Lab",
|
||||
"description": "Urinalysis with culture",
|
||||
"orderedBy": "Dr. Sarah Mitchell"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Valid `orderType` values: `Lab`, `Imaging`, `Medication`, `Procedure`. `orderedBy` defaults to `encounter.attendingPhysician` if omitted.
|
||||
|
||||
### Rules for Generating Realistic Scenarios
|
||||
|
||||
1. **Vital signs arrive in clusters.** In real hospitals, nurses take a full set of vitals every 15–60 minutes. Each cluster should include at minimum: HEART_RATE, RESP_RATE, SYSTOLIC_BP, TEMP_C, SPO2, AVPU. Add SUPPLEMENTAL_O2 only when oxygen is administered. Add lab values (WBC, LACTATE, POTASSIUM, GLUCOSE) only at specific lab draw times, not every cluster.
|
||||
|
||||
2. **Deterioration is gradual.** A patient does not jump from HR 80 to HR 130 in one reading. Realistic deterioration progresses over 2–6 hours: HR 80 → 88 → 95 → 102 → 110 → 118. Each step is 15–60 minutes apart.
|
||||
|
||||
3. **Vital signs correlate.** Sepsis shows rising HR + rising temp + rising RR + falling BP together. Hemorrhagic shock shows rising HR + falling BP + falling SpO2. Respiratory failure shows falling SpO2 + rising RR. Don't change vital signs independently.
|
||||
|
||||
4. **Include physiological noise.** Real vital signs fluctuate. A stable HR of 75 might read 73, 76, 74, 77 across 4 readings. Add ±2–5% variation on stable values.
|
||||
|
||||
5. **Start with a baseline.** The first event cluster (offsetMinutes: 0) should be a complete set of normal or near-normal vitals establishing the patient's baseline.
|
||||
|
||||
6. **offsetMinutes must be non-decreasing.** Events within the same minute are fine (a full vital sign set arrives at the same offset). Never go backwards.
|
||||
|
||||
7. **Max 10 observations per offset.** The API accepts at most 10 observations per batch. A full vital set is 7 codes (HR, RR, SBP, TEMP, SpO2, AVPU, plus SUPPLEMENTAL_O2 when on oxygen). If you add lab values at the same minute, keep the total ≤10 — e.g. put labs at `offsetMinutes + 1` when vitals + labs would exceed 10.
|
||||
|
||||
8. **Use realistic source values.** Observation source is `"Device"` for continuous monitoring (HR, SpO2, BP) or `"Manual"` for nurse-measured values (temp, AVPU, supplemental O2). Lab draws (WBC, lactate, potassium, glucose) are `"Lab"`.
|
||||
|
||||
9. **Medications need clinical justification.** Only include medication events that make clinical sense for the scenario. Include the medication type events only if the scenario involves treatment response.
|
||||
|
||||
10. **Orders before results.** Every `order_result` must have a matching pending order. Use an `order` event first for routine labs/imaging. Sepsis bundle orders are auto-created — only use `order_result` with the exact SEP-1 descriptions above.
|
||||
|
||||
11. **Expected outcomes must be achievable.** Only list expected outcomes that the given vital sign trajectory will actually trigger based on the scoring rules above. Calculate NEWS2 scores mentally. Count SIRS criteria. Check qSOFA thresholds.
|
||||
|
||||
### Generate This Scenario
|
||||
|
||||
- 72-year-old with UTI → sepsis over 4 hours
|
||||
- Baseline normals → rising temp, HR, RR → SIRS triggers → qSOFA triggers → bundle auto-created
|
||||
- Includes order results completing the sepsis bundle
|
||||
- Expected: `SEPSIS_WARNING`, `QSOFA_WARNING`, `NEWS2_EMERGENCY`, sepsis bundle `COMPLIANT`
|
||||
|
||||
Output ONLY the JSON file. No explanation or commentary.
|
||||
Reference in New Issue
Block a user