Bidirectional MuleSoft integration between Epic Willow and automated TPN compounders, translating ingredient-level parenteral nutrition orders into compounder work orders and reconciling actual-fill results back to the MAR and pharmacy verification queue.
Tags: healthcare, epic, hl7v2, connected-devices, system-api, process-api, interoperability
TPN Compounders
Objective: TPN orders carry dozens of additive components, each with its own concentration, dose, and stability constraint. When they reach an automated compounder by manual re-keying, transcription errors and dose-limit violations follow, and the actual volumes pumped never make it cleanly back into Epic. Done looks like a verified Willow ingredient-level order flowing as a structured work order to the compounder, the device returning actual per-additive volumes and lot numbers, and MuleSoft reconciling ordered-versus-compounded into Willow so the pharmacist verifies what was physically made, with dose and stability checks enforced before any bag is compounded. This accelerator packages the TPN Compounders Epic Data Sharing Playbook as a MuleSoft-anchored solution plan.
What's Getting Built
- Willow (System API) — consumes outbound Willow RDE orders over MLLP and parses repeating RXC additive components ·
MLLP LISTEN RDE^O11, ACK^O11
- TPN Orchestrator (Process API) — maps RXC additives to source containers, enforces per-kg dose and calcium-phosphate stability rules, and reconciles gravimetric results ·
CHECK dose + Ca-P stability, POST /work-order, RECONCILE gravimetric → RXA
- Compounder (System API) — emits the vendor work order to the compounder and ingests the gravimetric fill result ·
POST /work-order (DoseEdge/APEX), RECEIVE gravimetric result
- Order-to-Bag Correlation (Object Store) — holds the correlation ID tying the Willow order, work order, and gravimetric result across hops ·
PUT /{correlationId}, GET /{correlationId}
- Per-failure dead-letter queues (target) — routes unmappable additives, dose/stability failures, and device faults to distinct DLQs for selective replay ·
PUBLISH unmapped-additive, PUBLISH rule-failure, PUBLISH device-fault
- Bridges / Epic Willow (target) — receives the inbound RAS/RXA carrying actual per-additive volumes and lot numbers for MAR reconciliation ·
MLLP SEND RAS^O17, RXA post
Prerequisites
- Epic Bridges interface engine configured to send outbound RDE encoded pharmacy orders and receive inbound RAS/RXA administration messages over MLLP
- Willow build for ingredient-level TPN order records with additive components mapped to a maintained formulary and RxNorm/NDC codes
- Compounder vendor integration spec (Baxter Exacta-Mix DoseEdge or B. Braun APEX) and its work-order and gravimetric-result formats
- Anypoint Platform with an MLLP/TCP connector, Anypoint MQ for queuing, and a persistent object store for order-to-bag correlation
- A curated additive master mapping Willow formulary IDs to compounder source-container IDs with per-additive concentration and density
- Pharmacist-configured hard maximum dose and calcium-phosphate stability rulesets for neonatal and adult TPN
1. Epic interfaces and standards
This accelerator implements the TPN Compounders Epic Data Sharing Playbook. Register the connecting app on Epic on FHIR and confirm the customer has the relevant Epic modules licensed before building.
- Willow inpatient pharmacy ingredient-level TPN orders
- Bridges HL7v2 RDE/RDS outbound and RAS/RXA inbound
- HL7v2 RXC additive component with RXO/RXE pharmacy segments
- FHIR R4 MedicationRequest dosageInstruction and MedicationAdministration for reconciliation
- Cogito for TPN compounding turnaround and waste analytics
Architecture
2. Business requirements
- Deliver only pharmacist-verified Willow TPN orders to the compounder; a draft or unverified order must never reach the device.
- Preserve ingredient-level fidelity end to end so every RXC additive maps to exactly one compounder source container, or the order is rejected, not partially compounded.
- Return actual gravimetric per-additive volumes and lot numbers to Willow so verification reflects what was physically made, not what was ordered.
- Enforce hard dose-per-kg and calcium-phosphate stability limits before compounding, separately tuned for neonatal versus adult profiles.
- Give pharmacy a single reconciliation view of ordered-versus-compounded variance rather than two disconnected systems.
3. Order ingestion and mapping
- Consume outbound RDE messages from Bridges over MLLP in the Willow System API and parse RXO/RXE plus repeating RXC additive segments in DataWeave.
- Map each RXC component from Willow formulary ID to a compounder source-container ID using the additive master; fail closed on any unmapped additive.
- Normalize ordered amounts to the compounder's expected units using per-additive concentration and density, not a naive unit label swap.
- Attach a correlation ID that ties the Willow order number, the emitted work order, and the eventual gravimetric result across every hop.
- Emit the vendor work order in DoseEdge or APEX format only after mapping and validation both pass.
4. Dose and stability verification
- Run per-kg dose-limit checks in the Process API against the configured neonatal and adult rulesets before generating the work order.
- Compute the calcium-phosphate solubility ceiling from final additive concentrations and reject orders that exceed the stability curve.
- Validate total osmolarity against the ordered line, peripheral versus central, and flag mismatches back to pharmacy for reroute.
- Treat every rule failure as a hard stop that returns a coded rejection to Willow, never a silent downgrade or auto-adjust.
- Keep the rulesets externalized as configuration so pharmacy can revise limits without a code deploy.
5. Result reconciliation and orchestration
- Ingest the compounder's gravimetric result, matching it to the original order by correlation ID from the object store.
- Compute per-additive ordered-versus-compounded variance and classify each bag as within tolerance or flagged for pharmacist review.
- Emit an inbound RAS/RXA to Bridges carrying actual volumes and additive lot numbers so Willow records true administration data.
- Persist lot numbers and source-container assignments to support recall traceability from bag back to raw additive.
- Publish turnaround, waste, and variance events to Cogito for compounding operations analytics.
6. Error handling and operations
- Route unmappable additives, dose-limit failures, and device faults to distinct dead-letter queues so each has its own runbook.
- Alert on the absence of an expected gravimetric result within the bag's compounding SLA, which is the failure mode dashboards miss most often.
- Never auto-retry a work order that already reached the device; a blind retry risks a duplicate physical bag.
- Reconcile the object store nightly to surface orders sent to the compounder with no returned result.
- Expose correlation-ID trace lookup so a pharmacist can follow one bag across Willow, MuleSoft, and the device in one query.
7. Security and compliance
- Encrypt PHI in transit and at rest.
- Audit-log every access to and modification of patient data, and carry a correlation ID end to end.
- Enforce minimum-necessary access for integration operators and support users.
- Enforce that only verified-state Willow orders are dispatched; gate the compounder System API so a nonverified order is structurally incapable of emitting a work order.
- Sign or checksum inbound gravimetric results and reject tampered or malformed device payloads before they touch the reconciliation path.
- Segment the compounder device network and terminate MLLP/TLS at the System API so the device never sees raw Epic traffic.
- Retain additive lot numbers and source-container assignments as immutable records to support parenteral nutrition recall investigations.
Sample payload — Outbound Willow RDE with ingredient-level TPN additives
MSH|^~\&|WILLOW|HOSP|MULE_TPN|COMPOUNDER|20260820T081500||RDE^O11|MSG00042|P|2.5.1
PID|1||MRN00987^^^HOSP^MR||NEONATE^BABY^A||20260812|F
ORC|NW|TPN0001^WILLOW|||||^^^20260820T090000
RXE|^^^20260820T090000|TPN-NEONATAL^Neonatal TPN Base^LOCAL|105|110|mL|||||1
RXC|B|DEXTROSE-70^Dextrose 70%^LOCAL|18.9|mL
RXC|A|AMINOSYN-10^Amino Acids 10%^LOCAL|30|mL
RXC|A|LIPID-20^Lipid Emulsion 20%^LOCAL|15|mL
RXC|A|CAGLUC-10^Calcium Gluconate 10%^LOCAL|3.2|mL
RXC|A|KPHOS^Potassium Phosphate^LOCAL|1.1|mL
RXC|A|TRACE-NEO^Neonatal Trace Elements^LOCAL|0.5|mL
Testing and validation
- Send an RDE with an unmapped RXC additive and confirm the order fails closed with a coded rejection to Willow, not a partial work order.
- Submit a neonatal order that breaches the per-kg amino acid limit and verify a hard-stop rejection with the correct reason code.
- Feed additive concentrations that exceed the calcium-phosphate solubility curve and confirm the stability check blocks compounding.
- Return a gravimetric result whose actual volume deviates beyond tolerance and confirm the bag is flagged for pharmacist review, not auto-passed.
- Replay a duplicate device result for one correlation ID and confirm idempotent handling with no second RXA to Willow.
- Simulate a missing gravimetric result past the SLA and confirm the absence-of-event alert fires.
Phased rollout
Phase 1 — Connect
- Stand up MLLP connectivity between Bridges and the Willow System API and the vendor System API to the compounder in a non-production environment.
- Confirm bidirectional message flow with RDE outbound and RXA inbound round-trips using vendor-supplied test payloads.
Phase 2 — Map and test
- Load and validate the additive master mapping every Willow formulary TPN ingredient to a compounder source container.
- Run parallel shadow compounding where MuleSoft generates work orders that pharmacy compares against manual entry before any device acts on them.
Phase 3 — Production
- Cut over one compounder and one order set, typically adult central TPN, with pharmacy watching the reconciliation view live.
- Expand to neonatal profiles and additional compounders only after variance and turnaround metrics hold steady.
Success metrics
- Ingredient-level mapping success rate, target above 99.9 percent with zero silent partial orders
- Ordered-versus-compounded variance within tolerance per bag
- Manual re-keying entries eliminated per week
- Compounding turnaround time from verified order to returned result
- Rate of orders blocked by dose or stability rules that were true safety catches
Troubleshooting
- A verified TPN order reaches MuleSoft but no work order is emitted to the compounder. — Likely cause: One RXC additive has no entry in the additive master and the order failed closed as designed. Fix: Check the unmapped-additive dead-letter queue by correlation ID, add the missing formulary-to-source-container mapping, and reprocess the order.
- Willow verification shows volumes that differ from what the pharmacist expected on the order. — Likely cause: Reconciliation is correctly writing the compounder's actual gravimetric volumes, which differ from ordered amounts. Fix: Open the ordered-versus-compounded variance view for the bag; treat within-tolerance differences as expected and investigate flagged deviations against device calibration.
- Bags compound but no administration data appears back in Willow. — Likely cause: Inbound RXA messages are failing at Bridges or the correlation ID is not matching the stored order. Fix: Trace the correlation ID through the object store and Bridges inbound log, confirm the RXA passes structure validation, and replay from the reconciliation queue.
Deliverable: A deployable Anypoint project with a Willow System API, a compounder vendor System API, and a TPN Orchestration Process API implementing ingredient-level RXC mapping, externalized dose and calcium-phosphate stability rules, correlation-ID tracking, gravimetric-result reconciliation to RXA, and per-failure dead-letter routing.