Clinic Decision Support
Quick Start
Read the prompt to identify the target case_id, the answer_template.json path,
and the <TASK_ENV_BASE_URL>. Then follow this sequence:
- Read
input/payloads/answer_template.json first — it defines every field, its
allowed values, and the output structure.
- Fetch the case composite at
GET {BASE}/api/cases/{case_id}. It returns
patient, case, observations, findings, imaging, medications,
allergies, problems, care_registry, and sdoh in one payload.
- Identify which protocols are relevant. If the case response names a protocol
or the task description implies one, fetch it from
GET {BASE}/api/protocols/{protocol_id}.
- Apply protocol decision rules to the clinical facts, then map every finding
to one of the template's controlled enum values.
- Return exactly one JSON object matching the template, with no markdown or
prose outside the JSON.
Core API Summary
The environment provides these GET endpoints at {BASE} (no auth):
| Endpoint |
Description |
/api/patients |
All patients; patient_id is the join key |
/api/patients/{patient_id} |
Single patient detail |
/api/cases |
All cases; each has case_type, patient_id, summary |
/api/cases/{case_id} |
Composite: case + patient + observations + findings + imaging + medications + allergies + problems + care_registry + sdoh |
/api/observations |
All observations; filter on patient_id, code, status, effective_time |
/api/medications |
All medication records |
/api/allergies |
All allergy records; status is active or inactive |
/api/problems |
All problem-list entries (ICD-10 codes) |
/api/imaging |
All imaging studies; status is final or preliminary |
/api/care-registry |
Care-management registry records |
/api/sdoh |
Social determinants of health |
/api/protocols |
All protocol identifiers and titles |
/api/protocols/{protocol_id} |
Full protocol with decision rules |
Full response shapes and field semantics are in references/api_schema.md.
Protocol Interpretation
Protocols live at /api/protocols/{protocol_id} and contain a body with
decision rules. See references/protocol_guide.md
for detailed interpretation patterns. Key conventions:
authoritative_statuses: Only observations with status in this list
count for protocol gates. Typically ["final"].
- Thresholds: Numeric comparison operators are named explicitly, e.g.
oxygen_saturation_room_air_less_than means "below this value triggers."
controlled_codes: Maps clinical concepts (e.g. serum_potassium) to
observation code values (e.g. "K"). Use these codes when filtering
observations, not free-text display names.
allergy_rule: Describes how to constrain medication choices from the
allergy list. Apply this before selecting antibiotic strategy.
excluded_statuses: Observations with these statuses must not count for
protocol gates (common list: preliminary, entered-in-error, canceled).
Common Decision Patterns
Filtering Observations
For tasks that require finding a specific lab in a time window:
- Filter by
patient_id, code matching the protocol's controlled code,
status = "final", and effective_time inside the window (inclusive
start, exclusive end unless the template says otherwise).
- Sort results by
effective_time ascending, then observation_id ascending
as a tiebreaker.
- The latest entry is the last in sorted order.
- Observations that match the patient and code but fail on date or status go
into
excluded_observation_ids.
- Observations with a non-matching
code but same patient and window also go
into excluded observations.
Allergy-Aware Medication Selection
- Collect all
active allergies for the patient from the case composite.
- Map allergen names to the template's
avoid_allergens enum: e.g. "penicillin"
allergy → "penicillin", "sulfonamide antibiotics" → "sulfonamide".
- Choose an antibiotic strategy whose class does not appear in the avoid list.
Risk Stratification
- Protocols list triggers for escalation (e.g. urgent route, ed transfer).
- If any numeric threshold is crossed (SpO2 < 90, K < 3.0, risk_score >= 0.75)
or any named symptom is present, the higher tier applies.
- Otherwise, use the lower tier described by the protocol's supportive or
routine branch.
Protocol Gate Determination
- If the latest final observation has
value_number >= target, the gate is
satisfies_recent_final_normal.
- If below target but above urgent threshold, the gate indicates need for
repletion.
- If below urgent threshold or urgent symptoms exist, the gate is
recent_final_critical_or_urgent.
- If no final observation in the window, the gate is
no_final_lab_in_window.
Safety Checks
Safety-check booleans assert that a dangerous claim was NOT made:
no_penicillin_or_sulfa: True when the medication plan avoids both classes.
no_normal_cxr_claim: True when the imaging impression is abnormal (e.g.
consolidation present).
no_clear_lungs_claim: True when lung findings are documented.
no_false_loc: True when loss of consciousness was not reported.
no_false_vomiting: True when repeated vomiting was not reported.
no_false_photophobia: True when photophobia was not reported.
Numeric Anchors and Precision
- Read numeric values from observations and findings.
- Match the precision specified in the template: one decimal place for lab
values, two decimal places for risk scores, integer for hours and counts.
- For blood pressure, format as
"systolic/diastolic" (e.g. "152/88").
- For doses, include a space between the number and unit (e.g.
"100 mg").
Evidence Identifiers
Include identifiers for the key sources used: the case ID, observation IDs
for the primary lab or finding, imaging IDs for relevant studies, and protocol
IDs when they inform the decision. List the case identifier first, then other
sources. Only include identifiers that were actually used in the decision.
Urgent Actions
When protocols list urgent-branch symptoms (palpitations, syncope, ECG
abnormality, severe weakness), and those symptoms are present, select the
matching urgent-action enums from the template. Sort by clinical action
sequence. Use an empty list when no urgent action applies.
Program Routing
For care-management routing: check registry risk score against the protocol's
high_predictive_risk_min, count chronic conditions, check for recent
admission, dialysis, heart failure, and uncontrolled diabetes against the
complex_care_supporting_triggers. Map SDOH domains to the social-work
referral domains list and threshold.
Reference Files
- references/api_schema.md — Full API response shapes
and field-by-field semantics for every endpoint.
- references/protocol_guide.md — How to read
protocol decision documents and translate rules into template enum values.
Output Rule
Always return exactly one JSON object. No markdown fences, no comments, no
extra top-level keys beyond what the template requires. Use null only where
the template explicitly permits it. String values use controlled enum entries
from the template, not free-text prose.
1---2name: clinic-decision-support-93description: "Protocol-bound clinical decision support for a synthetic FHIR-like clinic REST API. Use when a prompt references a clinic case ID, a structured answer template with controlled enums, and a task environment base URL for fetching patient data, observations, protocols, and related clinical resources. Covers respiratory assessment, pediatric head injury, potassium replacement, care-management routing, observation-window retrieval, and similar protocol-driven structured-answer tasks."4license: MIT5compatibility: designed for deepagents-code6metadata:7 source: https://skillmd.com/skills/prism-shadow/clinic-decision-support-98---910# Clinic Decision Support1112## Quick Start1314Read the prompt to identify the target `case_id`, the `answer_template.json` path,15and the `<TASK_ENV_BASE_URL>`. Then follow this sequence:16171. Read `input/payloads/answer_template.json` first — it defines every field, its18 allowed values, and the output structure.192. Fetch the case composite at `GET {BASE}/api/cases/{case_id}`. It returns20 `patient`, `case`, `observations`, `findings`, `imaging`, `medications`,21 `allergies`, `problems`, `care_registry`, and `sdoh` in one payload.223. Identify which protocols are relevant. If the case response names a protocol23 or the task description implies one, fetch it from24 `GET {BASE}/api/protocols/{protocol_id}`.254. Apply protocol decision rules to the clinical facts, then map every finding26 to one of the template's controlled enum values.275. Return exactly one JSON object matching the template, with no markdown or28 prose outside the JSON.2930## Core API Summary3132The environment provides these GET endpoints at `{BASE}` (no auth):3334| Endpoint | Description |35|----------|-------------|36| `/api/patients` | All patients; `patient_id` is the join key |37| `/api/patients/{patient_id}` | Single patient detail |38| `/api/cases` | All cases; each has `case_type`, `patient_id`, `summary` |39| `/api/cases/{case_id}` | Composite: case + patient + observations + findings + imaging + medications + allergies + problems + care_registry + sdoh |40| `/api/observations` | All observations; filter on `patient_id`, `code`, `status`, `effective_time` |41| `/api/medications` | All medication records |42| `/api/allergies` | All allergy records; `status` is `active` or `inactive` |43| `/api/problems` | All problem-list entries (ICD-10 codes) |44| `/api/imaging` | All imaging studies; `status` is `final` or `preliminary` |45| `/api/care-registry` | Care-management registry records |46| `/api/sdoh` | Social determinants of health |47| `/api/protocols` | All protocol identifiers and titles |48| `/api/protocols/{protocol_id}` | Full protocol with decision rules |4950Full response shapes and field semantics are in [references/api_schema.md](references/api_schema.md).5152## Protocol Interpretation5354Protocols live at `/api/protocols/{protocol_id}` and contain a `body` with55decision rules. See [references/protocol_guide.md](references/protocol_guide.md)56for detailed interpretation patterns. Key conventions:5758- **`authoritative_statuses`**: Only observations with `status` in this list59 count for protocol gates. Typically `["final"]`.60- **Thresholds**: Numeric comparison operators are named explicitly, e.g.61 `oxygen_saturation_room_air_less_than` means "below this value triggers."62- **`controlled_codes`**: Maps clinical concepts (e.g. `serum_potassium`) to63 observation `code` values (e.g. `"K"`). Use these codes when filtering64 observations, not free-text display names.65- **`allergy_rule`**: Describes how to constrain medication choices from the66 allergy list. Apply this before selecting antibiotic strategy.67- **`excluded_statuses`**: Observations with these statuses must not count for68 protocol gates (common list: `preliminary`, `entered-in-error`, `canceled`).6970## Common Decision Patterns7172### Filtering Observations7374For tasks that require finding a specific lab in a time window:75- Filter by `patient_id`, `code` matching the protocol's controlled code,76 `status` = `"final"`, and `effective_time` inside the window (inclusive77 start, exclusive end unless the template says otherwise).78- Sort results by `effective_time` ascending, then `observation_id` ascending79 as a tiebreaker.80- The latest entry is the last in sorted order.81- Observations that match the patient and code but fail on date or status go82 into `excluded_observation_ids`.83- Observations with a non-matching `code` but same patient and window also go84 into excluded observations.8586### Allergy-Aware Medication Selection8788- Collect all `active` allergies for the patient from the case composite.89- Map allergen names to the template's `avoid_allergens` enum: e.g. "penicillin"90 allergy → `"penicillin"`, "sulfonamide antibiotics" → `"sulfonamide"`.91- Choose an antibiotic strategy whose class does not appear in the avoid list.9293### Risk Stratification9495- Protocols list triggers for escalation (e.g. urgent route, ed transfer).96- If any numeric threshold is crossed (SpO2 < 90, K < 3.0, risk_score >= 0.75)97 or any named symptom is present, the higher tier applies.98- Otherwise, use the lower tier described by the protocol's supportive or99 routine branch.100101### Protocol Gate Determination102103- If the latest final observation has `value_number` >= target, the gate is104 `satisfies_recent_final_normal`.105- If below target but above urgent threshold, the gate indicates need for106 repletion.107- If below urgent threshold or urgent symptoms exist, the gate is108 `recent_final_critical_or_urgent`.109- If no final observation in the window, the gate is `no_final_lab_in_window`.110111### Safety Checks112113Safety-check booleans assert that a dangerous claim was NOT made:114- `no_penicillin_or_sulfa`: True when the medication plan avoids both classes.115- `no_normal_cxr_claim`: True when the imaging impression is abnormal (e.g.116 consolidation present).117- `no_clear_lungs_claim`: True when lung findings are documented.118- `no_false_loc`: True when loss of consciousness was not reported.119- `no_false_vomiting`: True when repeated vomiting was not reported.120- `no_false_photophobia`: True when photophobia was not reported.121122### Numeric Anchors and Precision123124- Read numeric values from observations and findings.125- Match the precision specified in the template: one decimal place for lab126 values, two decimal places for risk scores, integer for hours and counts.127- For blood pressure, format as `"systolic/diastolic"` (e.g. `"152/88"`).128- For doses, include a space between the number and unit (e.g. `"100 mg"`).129130### Evidence Identifiers131132Include identifiers for the key sources used: the case ID, observation IDs133for the primary lab or finding, imaging IDs for relevant studies, and protocol134IDs when they inform the decision. List the case identifier first, then other135sources. Only include identifiers that were actually used in the decision.136137### Urgent Actions138139When protocols list urgent-branch symptoms (palpitations, syncope, ECG140abnormality, severe weakness), and those symptoms are present, select the141matching urgent-action enums from the template. Sort by clinical action142sequence. Use an empty list when no urgent action applies.143144### Program Routing145146For care-management routing: check registry risk score against the protocol's147`high_predictive_risk_min`, count chronic conditions, check for recent148admission, dialysis, heart failure, and uncontrolled diabetes against the149`complex_care_supporting_triggers`. Map SDOH domains to the social-work150referral domains list and threshold.151152## Reference Files153154- [references/api_schema.md](references/api_schema.md) — Full API response shapes155 and field-by-field semantics for every endpoint.156- [references/protocol_guide.md](references/protocol_guide.md) — How to read157 protocol decision documents and translate rules into template enum values.158159## Output Rule160161Always return exactly one JSON object. No markdown fences, no comments, no162extra top-level keys beyond what the template requires. Use `null` only where163the template explicitly permits it. String values use controlled enum entries164from the template, not free-text prose.