Skip to content
Get started

Concepts

Workflows, triggers, steps, transforms, adapters and executions, in a few minutes.

On this page

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.

A workflow graph: an MLLP trigger feeds a transform step, then a router sends one copy to a FHIR server and one to a webhook

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

TriggerStarts the workflow when
manualsomeone runs it from the UI or the API
webhookan HTTP POST arrives: HMAC-signed when the trigger has a secret, otherwise from an authenticated caller
cronan advanced cron expression fires, in the trigger's time zone
schedulethe same as cron (an alias)
pollingan adapter is read every interval, and each new item runs once
mllpan HL7v2 message arrives on an MLLP listener
fhir-subscriptiona FHIR server sends a subscription notification
sftpa file lands in a folder on an SFTP server; it runs once per file, or once per row of a CSV file
filea 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
x12an 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

StepWhat it does
adapterreads from or writes to another system through an adapter
transformchanges the data (see below)
conditionbranches on an expression or a set of rules
parallelruns branches at the same time
routergives each destination its own copy of the message, at the same time or one after another
loopruns steps once per item in a list (up to 1000), then continues on its done edge
triggerstarts 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

TransformWhat it does
field-mappingmaps fields visually: builds a new object or copies the message and edits fields, with value operations, HL7 repeats and code-table lookups
javascriptruns your JavaScript in isolated-vm (128 MB, 5 seconds) with HL7, date and lookup helpers
code-tabletranslates codes with a lookup table
sql-lookupreads one row from an SQL database to enrich the message
hl7v2-to-fhirconverts HL7v2 (ADT, ORU, SIU and more) to FHIR R4
fhir-to-hl7v2converts FHIR R4 resources to HL7v2 messages
fhir-bulk-splitsplits a FHIR Bulk Data file into one item per resource
x12-parseparses X12 EDI into JSON
x12-generatebuilds X12 EDI from JSON
cda-parseparses CDA and C-CDA XML into JSON
csv-parsereads delimited text (CSV, tab or pipe) into rows
csv-generatewrites rows as delimited text
xml-parsereads XML and picks values with XPath
fixed-width-parse / fixed-width-generateread and write fixed-width text, by column positions, with header, detail and trailer record types
ncpdp-parse / ncpdp-generateread and write NCPDP Telecommunication (D.0) pharmacy claims as JSON
hl7-validatechecks an HL7v2 message against a conformance profile, then rejects it or annotates it
xsltruns an XSLT 1.0 stylesheet over XML: CDA to a summary, XML to HL7 v2 text, and more
deidentifyremoves, masks, pseudonymizes or generalizes patient identifiers (HIPAA Safe Harbor) in HL7v2, FHIR and JSON
hl7-to-xmlwrites an HL7v2 message as Mirth's HL7 v2 XML
xml-to-hl7reads Mirth's HL7 v2 XML back into an HL7v2 message
templaterenders 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.

Reference