Concepts
Workflows, triggers, steps, transforms, adapters and executions, in a few minutes.
MedHook's unit of work is the workflow. A workflow takes a message in, transforms it, and delivers it to one or more systems. This is the familiar extract, transform and load (ETL) pattern.
Workflows
A workflow is a directed graph with no loops back on itself. A trigger starts it, steps do the work, and edges connect the steps. Branching, fan-out and iteration are steps too, so there is no separate orchestration layer.
In the engine UI a workflow is edited as a channel: one inbound source with a filter, then one or more destinations, each with its own filter, outputs and sender. One failing destination never blocks the others. Destinations run at the same time, or one after another when a later one needs an earlier one's reply.
Triggers
| Trigger | Starts the workflow when |
|---|---|
manual | someone runs it from the UI or the API |
webhook | an HTTP POST arrives: HMAC-signed when the trigger has a secret, otherwise from an authenticated caller |
cron | an advanced cron expression fires, in the trigger's time zone |
schedule | the same as cron (an alias) |
polling | an adapter is read every interval, and each new item runs once |
mllp | an HL7v2 message arrives on an MLLP listener |
fhir-subscription | a FHIR server sends a subscription notification |
sftp | a file lands in a folder on an SFTP server; it runs once per file, or once per row of a CSV file |
file | a file lands in the folder of a file, FTP/FTPS, SMB, WebDAV, S3 or SFTP adapter profile; it runs once per file, or once per row of a CSV file |
x12 | an X12 interchange arrives by webhook, upload or an SFTP folder the engine polls; it runs once per transaction set and can answer with a 999 or TA1 |
See Triggers for every setting, and SFTP file to FHIR and X12 claims intake for an SFTP pickup, and File pickup for the other transports.
Steps
| Step | What it does |
|---|---|
adapter | reads from or writes to another system through an adapter |
transform | changes the data (see below) |
condition | branches on an expression or a set of rules |
parallel | runs branches at the same time |
router | gives each destination its own copy of the message, at the same time or one after another |
loop | runs steps once per item in a list (up to 1000), then continues on its done edge |
trigger | starts another workflow in the same workspace as a queued run; it does not wait for it (up to 5 levels deep) |
There is no wait step, and edges carry no conditions. Both never ran and were removed, and saving a workflow with either is refused. Branch with a condition step instead.
Transforms
| Transform | What it does |
|---|---|
field-mapping | maps fields visually: builds a new object or copies the message and edits fields, with value operations, HL7 repeats and code-table lookups |
javascript | runs your JavaScript in isolated-vm (128 MB, 5 seconds) with HL7, date and lookup helpers |
code-table | translates codes with a lookup table |
sql-lookup | reads one row from an SQL database to enrich the message |
hl7v2-to-fhir | converts HL7v2 (ADT, ORU, SIU and more) to FHIR R4 |
fhir-to-hl7v2 | converts FHIR R4 resources to HL7v2 messages |
fhir-bulk-split | splits a FHIR Bulk Data file into one item per resource |
x12-parse | parses X12 EDI into JSON |
x12-generate | builds X12 EDI from JSON |
cda-parse | parses CDA and C-CDA XML into JSON |
csv-parse | reads delimited text (CSV, tab or pipe) into rows |
csv-generate | writes rows as delimited text |
xml-parse | reads XML and picks values with XPath |
fixed-width-parse / fixed-width-generate | read and write fixed-width text, by column positions, with header, detail and trailer record types |
ncpdp-parse / ncpdp-generate | read and write NCPDP Telecommunication (D.0) pharmacy claims as JSON |
hl7-validate | checks an HL7v2 message against a conformance profile, then rejects it or annotates it |
xslt | runs an XSLT 1.0 stylesheet over XML: CDA to a summary, XML to HL7 v2 text, and more |
deidentify | removes, masks, pseudonymizes or generalizes patient identifiers (HIPAA Safe Harbor) in HL7v2, FHIR and JSON |
hl7-to-xml | writes an HL7v2 message as Mirth's HL7 v2 XML |
xml-to-hl7 | reads Mirth's HL7 v2 XML back into an HL7v2 message |
template | renders text with loops, conditions and escaping |
Adapters and profiles
An adapter knows how to talk to one kind of system. An adapter profile is one configured connection: a base URL plus credentials. Credentials are encrypted at rest. See Adapters for the list.
Executions
Every run of a workflow is an execution, with a status and a result for each step. You can watch executions live, replay one with its original message, or dry-run a sample message through a workflow without sending anything.