Create a routing TCL script:
# Return data unchanged (pass to next process) return $data
proc route_by_type data args "] set msg_type [lindex $fields 8] set event [lindex $fields 9] switch "$msg_type^$event" "ADT^A01" # Route to Thread: EHR_ADT_OUT return [list "EHR_ADT_OUT" $data] "ADT^A03" # Route to Thread: PHARMACY_UPD_OUT return [list "PHARMACY_UPD_OUT" $data] default # Send to error queue error "Unhandled message type: $msg_type^$event" $data cloverleaf interface engine tutorial pdf
# process_msg.tcl - Basic HL7 logging proc process_msg data args "] set msg_type [lindex $fields 8] ; # MSH-9.1 set event [lindex $fields 9] ; # MSH-9.2
set sql "INSERT INTO inbound_log (mrn, hl7_raw, received_dt) VALUES ('$mrn', '$hl7_text', GETDATE())" hciodbc::exec $conn $sql hciodbc::disconnect $conn Create a routing TCL script: # Return data
Send ADT^A01 to an EHR, but ADT^A03 to a Pharmacy system.
return $data When a TCL error command is called or a process crashes, Cloverleaf moves the message to: Copy the content, save as Cloverleaf_Tutorial
For advanced topics (X12 translation, BLOB storage, clustering), refer to the official Cloverleaf Administrator Guide (PDF) from Orion Health. This document provides a complete, actionable foundation for building interfaces with Cloverleaf. Copy the content, save as Cloverleaf_Tutorial.pdf , and distribute to your integration team.