File size: 1,270 Bytes
8af5905
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# prompt_templates.py
import json
from typing import Dict

DECISION_FRAME = """FRAME:
- SAFETY/RISK: crowding proxy; p95 boarding time; # critical waits; isolation/telemetry constraints.
- CAPACITY: staffed beds now; free beds; unit occupancy & imbalance; EVS/transport turnaround.
- DISCHARGES: # ready now; # by noon; barriers (AH, placement, Rx, paperwork).
- ADMISSIONS: ED admits waiting (by service/needs); forecast next 6–24h; elective admits deferrable.
- STAFFING: RN/RT/Allied gaps; redeploy/OT/agency options.
- MATH: beds needed now to clear ED; additional buffer for next 12h; target occupancy.
- DECISION: ranked actions with owner, ETA, expected beds, and risks.
"""

def build_system_preamble(snapshot: Dict, policy_context: str, computed_numbers: Dict) -> str:
    return f"""
You are ClarityOps, a hospital flow decision co-pilot.
Use the snapshot JSON, computed numbers, and policy excerpts to recommend next actions.
Return EXACTLY: (1) Risks, (2) Beds needed & by when, (3) Actions ranked with owner/ETA/expected beds, (4) Expected impact, (5) Escalations/Comms.

Policies & SOP Excerpts:
{policy_context}

Snapshot (JSON):
{json.dumps(snapshot, indent=2)}

Computed Numbers:
{json.dumps(computed_numbers, indent=2)}

{DECISION_FRAME}
""".strip()