brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
preoperative-lab-checklistDetermines required preoperative labs based on planned procedure, patient conditions, and ASA classification, then checks existing results and generates orders for missing labs. Use when user asks to "check pre-op labs", "preoperative workup", "surgery lab clearance", "pre-surgical labs", "OR readiness", "clearance labs", or needs to verify lab requirements…
Independent GitHub snapshot · Automated classification · Original documentation governs
Evaluate preoperative laboratory readiness for a scheduled surgical procedure. Determine required labs based on procedure type (low/medium/high risk), patient comorbidities, ASA physical status classification, and current medications. Query existing Observation resources to identify which required labs are already available within acceptable timeframes. Generate ServiceRequest resources for missing labs. Assess anticoagulation status and bridging needs.
| Resource | Purpose | Key Fields |
|---|---|---|
| Procedure | Planned surgery details | code, status, performedDateTime |
| Condition | Patient comorbidities for risk stratification | code, clinicalStatus, category |
| Observation | Existing lab results | code, valueQuantity, effectiveDateTime, status |
| MedicationStatement | Current medications (anticoagulants, etc.) | medicationCodeableConcept, status, dosage |
| Patient | Demographics, age | birthDate, gender |
| ServiceRequest | Lab orders to create | code, intent, priority, subject |
Tool: fhir_read
resourceType: "Patient"
id: "[patient-id]"
Extract age and gender. Age > 65 triggers additional requirements. Pregnancy-capable patients may need HCG.
Retrieve the planned procedure:
Tool: fhir_search
resourceType: "Procedure"
queryParams: "patient=[patient-id]&status=preparation&_sort=-date&_count=5"
If no Procedure with status preparation, check ServiceRequest for surgical orders:
Tool: fhir_search
resourceType: "ServiceRequest"
queryParams: "patient=[patient-id]&category=http://snomed.info/sct|387713003&status=active"
SNOMED 387713003 = Surgical procedure. Extract procedure type and planned date.
Based on the procedure code, classify into bleeding risk categories:
Low Risk (minimal blood loss expected):
Medium Risk (moderate blood loss possible):
High Risk (significant blood loss expected):
Tool: fhir_search
resourceType: "Condition"
queryParams: "patient=[patient-id]&clinical-status=active"
Use conditions to estimate ASA Physical Status Classification:
Apply requirements matrix based on surgery risk + ASA class + specific conditions:
All patients (medium/high risk surgery or ASA >= II):
Age > 65 OR cardiac/pulmonary disease:
Diabetes (SNOMED 44054006, 73211009):
Renal disease (SNOMED 709044004) or Cr > 1.5:
Liver disease (SNOMED 235856003) or hepatic surgery:
High-risk surgery (expected blood loss > 500mL):
Anticoagulant use:
Pregnancy-capable patients (female, age 12-55, unless documented otherwise):
Cardiac history or major vascular surgery:
See references/preop-requirements.md for complete requirements matrix.
For each required lab, search for existing results within the acceptable timeframe:
Tool: fhir_search
resourceType: "Observation"
queryParams: "patient=[patient-id]&code=[loinc-code]&date=ge[acceptable-date]&status=final&_sort=-date&_count=1"
Classify each required lab as:
Tool: fhir_search
resourceType: "MedicationStatement"
queryParams: "patient=[patient-id]&status=active"
Check for anticoagulants and antiplatelets:
See references/anticoagulation-bridging.md for complete protocols.
For each missing or expired required lab, create a ServiceRequest:
Tool: fhir_create
resourceType: "ServiceRequest"
resource: {
"status": "active",
"intent": "order",
"priority": "[routine|urgent]",
"code": {
"coding": [{
"system": "http://loinc.org",
"code": "[loinc-code]",
"display": "[test-name]"
}]
},
"subject": { "reference": "Patient/[patient-id]" },
"reasonCode": [{
"coding": [{
"system": "http://snomed.info/sct",
"code": "387713003",
"display": "Surgical procedure"
}],
"text": "Preoperative laboratory evaluation for [procedure name]"
}],
"note": [{ "text": "Pre-op lab -- surgery scheduled [date]" }]
}
Set priority to urgent if surgery is within 48 hours.
PREOPERATIVE LAB CHECKLIST -- [Patient Name] ([Age][Sex])
=========================================================
Planned Procedure: [procedure name]
Scheduled Date: [date]
Surgery Risk: [Low/Medium/High]
ASA Class: [I-IV]
Relevant Conditions: [list]
Anticoagulation: [medication or "None"]
REQUIRED LABS STATUS
====================
Test Status Result Date Acceptable By
---- ------ ------ ---- -------------
CBC Available WBC 7.2, Hgb 13 2025-01-10 2025-01-25 (30d)
BMP EXPIRED Na 140, K 4.1 2024-11-15 2025-01-25 (30d)
PT/INR MISSING -- -- [pre-op date]
Type & Screen MISSING -- -- [72h pre-op]
HbA1c Available 7.2% 2024-12-01 2025-02-01 (90d)
ANTICOAGULATION PLAN
====================
Warfarin 5mg daily: HOLD starting [5 days pre-op]
Target INR < 1.5 on day of surgery
Bridge: Enoxaparin 1mg/kg BID starting [3 days pre-op], last dose [24h pre-op]
Rationale: Mechanical aortic valve -- high thromboembolic risk
ORDERS GENERATED
================
1. BMP (LOINC 51990-0) -- routine
2. PT/INR (LOINC 5902-2) -- urgent (draw within 48h of surgery)
3. Type & Screen (LOINC 34532-2) -- urgent (draw within 72h of surgery)
ABNORMAL VALUES REQUIRING ATTENTION
====================================
[None / or list values that may delay surgery]
User says: "Check pre-op labs for patient 8812, scheduled for laparoscopic cholecystectomy"
Actions:
fhir_read Patient/8812 -- returns 52-year-old femalefhir_search Condition?patient=8812&clinical-status=active -- returns hypertension (controlled), GERDfhir_search MedicationStatement?patient=8812&status=active -- returns lisinopril, omeprazole (no anticoagulants)fhir_search Observation?patient=8812&code=58410-2&date=ge[30-days-ago]&status=final&_sort=-date&_count=1 -- CBC from 2 weeks ago, normalfhir_search Observation?patient=8812&code=51990-0&date=ge[30-days-ago]&status=final&_sort=-date&_count=1 -- BMP from 2 weeks ago, normalfhir_search Observation?patient=8812&code=2106-3&date=ge[7-days-ago]&status=final&_sort=-date&_count=1 -- no HCG resultResult: Medium-risk surgery, ASA II. CBC and BMP available and current. Missing: urine HCG (pregnancy-capable patient). Order generated for HCG. No anticoagulation concerns. Patient is cleared pending HCG result.
User says: "Pre-op workup for patient 4456, total knee replacement next week"
Actions:
fhir_read Patient/4456 -- returns 72-year-old malefhir_search Condition?patient=4456&clinical-status=active -- returns CKD stage 3, Type 2 DM, atrial fibrillation, osteoarthritisfhir_search MedicationStatement?patient=4456&status=active -- returns warfarin, metformin, amlodipinefhir_search Observation?patient=4456&code=6301-6&_sort=-date&_count=1 -- INR 2.8 from 3 days agoResult: High-risk surgery, ASA III. Required: CBC, CMP (renal disease), HbA1c, PT/INR (on warfarin), Type & Screen, Mg, Phos, BNP (age > 65 + cardiac). Anticoagulation plan: hold warfarin 5 days pre-op, bridge with enoxaparin (afib with CHA2DS2-VASc likely >= 4), recheck INR day before surgery, target < 1.5. Hold metformin 48h pre-op (renal, contrast risk). 4 labs missing, orders generated.
intent=plan or intent=order and category matching surgical SNOMED codes.component array rather than as separate Observation resources. Check component[].code and component[].valueQuantity.component where code.coding.code = "2823-3" (potassium).lab-result-interpreter -- for detailed interpretation of pre-op lab resultscritical-value-alert-generator -- if pre-op labs reveal critical valuesrenal-function-dashboard -- for detailed renal assessment when CKD is present