medOS ultra

Specialty Clinic Procedure Map

Per-clinic procedure complexity tiers, extra fields, OR-like feature requirements, standing-order applicability.

14 min read diagramsUpdated 2026-05-18docs/architecture/specialty-clinic-procedure-map.md

Per-clinic procedure complexity tiers, extra input fields, OR-like feature requirements, and standing order applicability.

Architecture Summary

Every OPD specialty clinic uses the same DayProcedureOrder miniapp (mounted via DynamicContentRenderer with clinicKey). The procedure catalog comes from clinic-configs.ts. When ordered, it hits the existing procedureRequest backend (April 2025) with ROUTINE / URGENT / STAT priority. The procedure then flows through the procedure_day_queue system with configurable OR-like features per department.

Existing Building Blocks (already built)

System Location What It Does
DayProcedureOrder miniapp web/packages/miniapps/day-procedure-order/ Order UI with priority picker, per-clinic catalog
procedureRequest API POST v2/medication/procedureRequests Backend order creation (MongoDB)
procedure_day_queue table migration 079 Tracks each procedure through phases with timestamps
ProcedureFeatureConfig procedureWorkflowConfig.types.ts Per-department toggle for 10 OR-style features
or_intraop_counts table migration 080 JSONB sponge/instrument/needle counting
Standing Orders web/packages/medical-kit/src/order/components/standing-order/ RRULE-based recurring orders for all order types
EndoscopySafetyChecklist periops-kit/src/endoscopy/ Reference implementation of procedure-specific safety checklist
PACU Handoff miniapp web/packages/miniapps/pacu-handoff/ Recovery scoring, vitals, drains, lines
OperativeNote miniapp web/packages/miniapps/operative-note/ CountSet, TeamMember, procedure documentation
department_queues → orchestrator encounter-orchestrator/index.ts Aggregates completion → medical worklist green dot

Procedure Complexity Tiers

Tier 1 — Simple (OPD-only, no OR features)

Nurse calls patient → procedure done at bedside/chair → mark complete. No sign-in/time-out/sign-out needed.

ProcedureFeatureConfig: all features enabled: false (default)

Tier 2 — Moderate (sign-in + team + basic safety)

Procedure room with dedicated space. Needs patient ID verification, team assignment, basic consent check. No full WHO checklist or counting.

ProcedureFeatureConfig:

  • sign_in: enabled, required
  • surgical_team: enabled (with reduced roles — e.g. ['proceduralist', 'assistant'])
  • Everything else OFF

Tier 3 — OR-Like (full WHO safety checklist + counting)

Invasive procedure requiring sterile field, instrument counting, specimen tracking, and recovery monitoring. Full OR workflow minus the general anesthesia pathway.

ProcedureFeatureConfig:

  • sign_in: enabled, required
  • time_out: enabled, required
  • sign_out: enabled, required
  • surgical_team: enabled, required (full 5-role roster)
  • intra_op: enabled
  • recovery: enabled (for sedation cases)
  • par_score: enabled (for sedation/GA cases)

Tier 4 — Full OR (existing surgical OR — not covered here)

Standard operating room workflow — already fully implemented.


Per-Clinic Procedure Matrix

GI Endoscopy (gi-endoscopy) — Tier 3

Procedure Code Extra Fields OR Features Standing Order
EGD GI-EGD sedationType (conscious/deep/none), scopeSerial, roomNumber Sign-In, Time-Out, Sign-Out, Team (proceduralist + assistant + anesthetist + scrub_nurse), Recovery, Intra-Op No
Colonoscopy GI-COLON sedationType, scopeSerial, roomNumber, bowelPrepQuality (Boston scale 0-9) Same as EGD No
ERCP GI-ERCP sedationType, scopeSerial, roomNumber, fluoroscopyTime, contrastVolume Same + counting (guidewires, stents) No
Endoscopic Biopsy GI-BIOPSY biopsySite[], biopsyCount, specimenJars Sign-In, Time-Out (specimen tracking), Sign-Out No
Polypectomy GI-POLYPECTOMY polypCount, polypSizes[], technique (cold snare/hot snare/EMR) Same as EGD + counting (snares, clips) No

Notes: GI Endoscopy already has EndoscopySafetyChecklist component with Aldrete recovery scoring. Endoscope serial tracking for infection control. Video/image capture integration (PACS).


Hemodialysis (hemodialysis) — Tier 2 + Continuous Monitoring

Procedure Code Extra Fields OR Features Standing Order
HD Session HD-SESSION machineNumber, accessType (AVF/AVG/catheter), accessSite, dryWeight, targetUF, dialysateK, dialysateNa, dialysateCa, anticoagulant (heparin/LMWH/none), heparinDose, bloodFlowRate, dialysateFlowRate, preWeight, postWeight, preBP, postBP Sign-In (patient ID + access check), Team (proceduralist + nurse) Yes — 3x/week RRULE (FREQ=WEEKLY;BYDAY=MO,WE,FR)
CRRT/SLED HD-CRRT machineNumber, accessType, mode (CVVH/CVVHD/CVVHDF/SLED), effluent_rate, bloodFlowRate, anticoagulant, citrateDose Sign-In, Team (proceduralist + nurse + ICU nurse), Continuous vitals No (ICU-specific)
Plasmapheresis HD-PLASMA machineNumber, accessType, replacementFluid (albumin/FFP), volumeExchanged, cycleCount Sign-In, Team No
AVF/AVG Care HD-AVF-CARE accessType, accessSite, thrillPresent, bruitPresent, signOfInfection None (Tier 1) Yes — monthly (FREQ=MONTHLY)

Notes: HD Session is the most common standing order in the system. Continuous recording (every 30-60 min) for vitals, UF, BP during session. Machine integration API for realtime monitoring.


Psychiatry (psychiatry) — Tier 2 (ECT) / Tier 1 (therapy)

Procedure Code Extra Fields OR Features Standing Order
ECT PSY-ECT sessionNumber, stimulusEnergy (mC), stimulusDuration, seizureDuration (sec), seizureQuality, anestheticAgent, muscleRelaxant, oxygenSat, recoveryMinutes, sideEffects[] Sign-In (consent + NPO), Time-Out (electrode placement), Team (psychiatrist + anesthesiologist + nurse), Recovery, PAR Score Yes — typically 3x/week for 6-12 sessions (FREQ=WEEKLY;BYDAY=MO,WE,FR;COUNT=12)
TMS PSY-TMS sessionNumber, coilPosition (DLPFC L/R), stimulusIntensity (% MT), pulseFrequency (Hz), pulseCount, motorThreshold Sign-In (seizure history check) Yes — daily x20-30 sessions (FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;COUNT=30)
CBT PSY-CBT sessionNumber, sessionTopic, homeworkAssigned, phq9Score, gad7Score None (Tier 1) Yes — weekly x8-16 sessions (FREQ=WEEKLY;COUNT=16)

Family Medicine (family-medicine) — Tier 1

Procedure Code Extra Fields OR Features Standing Order
Minor Wound Care FM-WOUND woundLocation, woundSize (cm), woundType (laceration/abrasion/burn), closureMethod (suture/staple/glue/steri-strip), sutureType, sutureCount, anestheticUsed, tetanusStatus Sign-In (if suturing) No
Joint Injection FM-INJECT injectionSite, laterality (L/R/bilateral), medication, dose, volume, needleGauge, technique (palpation/US-guided) None Yes — for series (e.g. 3 injections q2w: FREQ=WEEKLY;INTERVAL=2;COUNT=3)
Pap Smear FM-PAP specimenType (conventional/LBC), adequacy, cervicalAppearance, iudPresent None Yes — annual screening (FREQ=YEARLY)

Palliative Care (palliative-care) — Tier 2

Procedure Code Extra Fields OR Features Standing Order
Nerve Block PAL-NERVE-BLOCK blockType (epidural/intercostal/celiac/stellate), laterality, medication, dose, volume, needleGauge, guidance (US/fluoro/blind), preVAS, postVAS Sign-In, Time-Out (site verification), Team (proceduralist + nurse) Yes — for series
Paracentesis PAL-PARACENTESIS indication, volume_drained (mL), fluidAppearance, specimenSent (cell count/cytology/culture), albumin_given Sign-In, Team No
Thoracentesis PAL-THORACENTESIS indication, laterality, volume_drained, fluidAppearance, specimenSent, postCXR Sign-In, Team No

Elderly Clinic (elderly) — Tier 1

Procedure Code Extra Fields OR Features Standing Order
Fall Prevention Rehab ELD-FALLS-REHAB sessionNumber, exerciseProtocol, bergBalanceScore, tugTime (sec) None Yes — 2x/week x12w (FREQ=WEEKLY;BYDAY=TU,TH;COUNT=24)
Cognitive Stimulation ELD-COGNITIVE-STIM sessionNumber, activityType, preMoCA, postMoCA None Yes — weekly x14 (FREQ=WEEKLY;COUNT=14)
IV Nutrition ELD-NUTRITION-IV formula, volume, infusionRate, duration, accessSite Sign-In (patient ID + allergies) Yes — as prescribed

Holter Monitoring (holter-monitoring) — Tier 1 + Device Tracking

Procedure Code Extra Fields OR Features Standing Order
Holter Fitting HOLTER-FIT deviceSerial, leadPlacement, skinPrep, signalQuality None No
Holter Removal HOLTER-REMOVE deviceSerial, recordingHours, artifactPercent, diaryReturned None No
Event Recorder HOLTER-EVENT deviceSerial, activationType (auto/manual/both), monitoringDays None No

Notes: Uses device_monitoring_cases table for multi-day lifecycle. deviceMonitoringBridge.ts detects these codes and routes to the Holter fitting workflow. Two-visit pattern (attach + return) tracked via deviceQueueService.ts.


ABP Monitoring (abp) — Tier 1 + Device Tracking

Procedure Code Extra Fields OR Features Standing Order
ABP Fitting ABP-FIT deviceSerial, arm (L/R), cuffSize (S/M/L/XL), baselineSystolic, baselineDiastolic, intervalDay (min), intervalNight (min) None No
ABP Removal ABP-REMOVE deviceSerial, readingsTotal, readingsValid, validPercent None No

Notes: Same two-visit device tracking pattern as Holter. Dipping analysis (dipper/non-dipper/reverse-dipper) computed from results.


Respiratory / Thoracic (respiratory-thoracic) — Mixed Tiers

Procedure Code Extra Fields OR Features Standing Order
PFT / Spirometry RESP-PFT fvc, fev1, fev1FvcRatio, dlco, preBronchodilator (bool), postBronchodilator (bool), postFev1Change (%), interpretation None (Tier 1) Yes — annual for COPD/asthma (FREQ=YEARLY)
6MWT RESP-6MWT distanceMeters, preSpO2, nadirSpO2, preHR, peakHR, borgDyspnea (0-10), borgFatigue (0-10), supplementalO2 None (Tier 1) Yes — q6mo for ILD/PH (FREQ=MONTHLY;INTERVAL=6)
Bronchoscopy RESP-BRONCH sedationType, scopeSerial, lavageSite, lavageVolume, biopsySite[], biopsyCount, findings Sign-In, Time-Out, Sign-Out, Team (proceduralist + nurse + anesthetist), Recovery (Tier 3) No
Pleural Tap RESP-PLEURAL-TAP laterality, volumeDrained, fluidAppearance, specimenSent, guidance (US/blind), postCXR Sign-In, Team (Tier 2) No
Nebulizer RESP-NEBULIZER medication, dose, duration, preSpO2, postSpO2, prePEFR, postPEFR None (Tier 1) Yes — per acute episode

Antenatal Care (antenatal-care) — Mixed Tiers

Procedure Code Extra Fields OR Features Standing Order
Obstetric US ANC-US gestationalAge, fetalPosition, fetalHeartRate, amnioticFluidIndex, placentaLocation, estimatedFetalWeight, biophysicalProfile None (Tier 1) Yes — per trimester schedule
NST ANC-NST gestationalAge, baselineHR, variability, accelerations, decelerations, interpretation (reactive/non-reactive), duration None (Tier 1) Yes — weekly after 32w (FREQ=WEEKLY)
Amniocentesis ANC-AMNIO gestationalAge, indication, needleGauge, fluidVolume, fluidColor, specimenSent (karyotype/FISH/AFP), guidance (US) Sign-In (consent + Rh status), Time-Out, Team (MFM + nurse) (Tier 2-3) No
GDM OGTT ANC-GDM-OGTT gestationalAge, fastingGlucose, 1hrGlucose, 2hrGlucose, 3hrGlucose, glucoseLoad (50g/75g/100g), interpretation None (Tier 1) No

Diabetes Registry (diabetes-registry) — Tier 1

Procedure Code Extra Fields OR Features Standing Order
Diabetic Foot Care DM-FOOT-CARE footSide (L/R/both), nailTrimming, callousRemoval, woundPresent, woundGrade (Wagner 0-5), monofilamentScore (0-10), pulsesPalpable None Yes — monthly for high-risk (FREQ=MONTHLY)
ABI Test DM-ABI abiLeft, abiRight, interpretation (normal/mild/moderate/severe PAD), toeBrachialIndex None Yes — annual (FREQ=YEARLY)
Fundus Photography DM-FUNDUS eyeSide (L/R/both), pupilDilation, retinaGrade (none/mild NPDR/moderate/severe/PDR), maculaEdema, referToOphth None Yes — annual (FREQ=YEARLY)
Insulin Pump DM-INSULIN-PUMP pumpModel, pumpSerial, infusionSite, basalRate, bolusCalculator, sensorConnected, targetRange None No

Vaccination (vaccination) — Tier 1

Procedure Code Extra Fields OR Features Standing Order
Vaccination VACC-INJECT vaccineName, vaccineBrand, lotNumber, expiryDate, site (deltoid L/R, thigh L/R), route (IM/SC/ID/oral), dose (mL), doseNumber (1st/2nd/3rd/booster), coldChainTemp None Yes — per schedule (e.g. HBV 0-1-6mo: FREQ=MONTHLY;BYMONTH=1;COUNT=3 with custom dtstart)
Post-Vax Observation VACC-OBSERVE observationStartTime, observationEndTime, adverseReaction (none/local/systemic), reactionDetails, anaphylaxisKit None No
Skin Test VACC-SKIN-TEST testType (Mantoux/PPD/allergy panel), antigen, site, readingAt48h (mm induration), interpretation None No

Palliative Care Center (palliative-care other_service) — Tier 1-2

Procedure Code Extra Fields OR Features Standing Order
Symptom Management PC-SYMPTOM-MGMT painVAS, nausea, dyspnea, delirium, agitation, esasTotal, medicationsGiven[], route None Yes — per visit schedule
Pleural Drainage PC-PLEURAL-DRAIN Same as PAL-THORACENTESIS Sign-In, Team (Tier 2) No
Family Meeting PC-FAMILY-MEETING attendees[], decisionsReached, acpUpdated, codeStatus, goalOfCare None No

Home Visit (home-visit) — Tier 1

Procedure Code Extra Fields OR Features Standing Order
Home Wound Care HV-WOUND-CARE woundLocation, woundSize, woundStage, dressingType, healingProgress None Yes — 2-3x/week (FREQ=WEEKLY;BYDAY=MO,WE,FR)
Home IV Infusion HV-IV-INFUSION medication, volume, rate, accessType, accessSite, duration None Yes — per schedule
Home Catheter Change HV-CATHETER catheterType (Foley/suprapubic), catheterSize (Fr), balloonVolume, urineAppearance, residualVolume None Yes — monthly (FREQ=MONTHLY)

Home Isolation (home-isolation) — Tier 1

Procedure Code Extra Fields OR Features Standing Order
Teleconsultation HI-TELECONSULT platform (video/voice/chat), chiefComplaint, assessment, plan, followUpDays None Yes — daily during isolation (FREQ=DAILY)
Home Vitals Check HI-VITALS-CHECK temperature, heartRate, bloodPressure, spO2, respiratoryRate, alertLevel (green/yellow/red) None Yes — daily (FREQ=DAILY)

Standing Order Summary

Clinic Procedures Using Standing Orders Typical RRULE
Hemodialysis HD Session, AVF Care 3x/week, monthly
Psychiatry ECT, TMS, CBT 3x/week x12, daily x30, weekly x16
Family Medicine Joint Injection, Pap Smear q2w x3, yearly
Elderly Falls Rehab, Cognitive Stim, IV Nutrition 2x/week x24, weekly x14
Respiratory PFT, 6MWT, Nebulizer yearly, q6mo
ANC Obstetric US, NST per trimester, weekly after 32w
Diabetes Foot Care, ABI, Fundus Photo monthly, yearly
Vaccination Vaccination series per EPI schedule
Home Visit Wound Care, IV, Catheter 2-3x/week, monthly
Home Isolation Teleconsult, Vitals Check daily
Palliative Symptom Management per visit

OR Feature Requirement Summary

Clinic Sign-In Time-Out Sign-Out Team Intra-Op Recovery PAR Counting
GI Endoscopy Required Required Required Full 4-role Yes Yes (Aldrete) Yes Yes (guidewires, clips, snares)
Hemodialysis Required 2-role
Psychiatry (ECT) Required Required 3-role Yes Yes
Psychiatry (TMS/CBT)
Family Medicine Optional
Palliative (blocks) Required Required 2-role
Palliative (taps) Required 2-role
Respiratory (Bronch) Required Required Required 3-role Yes Yes Yes (biopsy forceps)
Respiratory (Pleural) Required 2-role
ANC (Amniocentesis) Required Required 2-role
All others

Implementation Plan

Phase 1 — Extend Procedure Type with Extra Fields

  1. Add extraFields to SpecialtyClinicDayProcedure type:
    interface ProcedureExtraField {
      key: string;
      labelTh: string;
      labelEn: string;
      type: 'text' | 'number' | 'select' | 'boolean' | 'date' | 'time' | 'laterality';
      options?: { value: string; labelTh: string; labelEn: string }[];
      required?: boolean;
      unit?: string;
      min?: number;
      max?: number;
    }
    
  2. Add extraFields: ProcedureExtraField[] to each procedure in clinic-configs.ts
  3. Update DayProcedureOrder NewProcedureOrderPanel to dynamically render extra fields
  4. Store extra field values in procedureRequest.metadata JSONB

Phase 2 — Wire OR Feature Toggles per Clinic

  1. Seed procedure_workflow_config rows for each clinic department:
    • GI Endoscopy: Tier 3 (full safety checklist)
    • Hemodialysis: Tier 2 (sign-in + team)
    • Psychiatry: Tier 2 for ECT, Tier 1 for CBT
    • Respiratory: Tier 3 for Bronchoscopy, Tier 1 for PFT
    • etc.
  2. The existing ProcedureWorkflowConfigService already resolves per-department — no new code needed, just seed data

Phase 3 — Standing Order Integration

  1. Add “Convert to Standing Order” button in DayProcedureOrder when priority = ROUTINE
  2. Pre-fill the CreateStandingOrderInput from the procedure:
    • order_type: 'procedure'
    • order_template: procedure code + extra field values
    • rrule: suggest based on clinic defaults (see table above)
    • activation_mode: 'confirm' (nurse confirms each occurrence)
  3. Show StandingOrderBadge on the patient profile procedure tab

Phase 4 — Generalize Safety Checklist Component

  1. Abstract EndoscopySafetyChecklist into ``
  2. Each clinic’s custom items come from ProcedureFeatureConfig.fieldOverrides.items[]
  3. Reuse existing sign_in, time_out, sign_out phase infrastructure

File References

File Purpose
web/packages/miniapps/specialty-clinics/clinic-configs.ts Per-clinic procedure catalog
web/packages/miniapps/specialty-clinics/types.ts SpecialtyClinicDayProcedure type
web/packages/miniapps/day-procedure-order/index.tsx Order UI miniapp
web/src/services/procedure-workflow-config/procedureWorkflowConfig.types.ts OR feature toggle system
web/packages/medical-kit/src/order/components/standing-order/interface.ts Standing order types
web/packages/periops-kit/src/endoscopy/components/EndoscopySafetyChecklist.tsx Reference safety checklist
web/packages/miniapps/operative-note/types.ts CountSet, TeamMember types
web/packages/miniapps/pacu-handoff/ Recovery/PACU handoff
infrastructure/medbase/migrations/079_procedure_day_queue.sql Phase tracking table
infrastructure/medbase/migrations/080_or_intraop_counts.sql Counting table
infrastructure/medbase/functions/encounter-orchestrator/index.ts dept_type rollup (holter/abp → procedure)
web/packages/periops-kit/src/shared/deviceMonitoringBridge.ts Device procedure code detection
web/packages/periops-kit/src/shared/deviceQueueService.ts Device visit queue integration
Ask Anything