Use an HL7v2 ADT registration event to automatically identify the patient and invoke the Da Vinci DEQM FHIR $care-gaps operation, enabling care teams to identify and address open care gaps while the patient is already present for care.
Tags: healthcare, provider, population-health, interoperability, hl7v2, fhir, da-vinci, event-driven
Detect Care Gaps at Patient Registration Using HL7v2 and FHIR
Objective
Turn a patient registration event into an opportunity to identify unmet care needs while the patient is already present.
When an HL7v2 ADT registration message arrives, MuleSoft parses the message, identifies the patient, and invokes the Da Vinci DEQM FHIR $care-gaps operation. If an open care gap is returned, the information can be surfaced to the care team so they can potentially address it during the current visit.
How It Works
- A patient registers for a visit and an HL7v2 ADT A01 message is generated.
- MuleSoft receives and parses the ADT using the HL7 EDI Connector.
- The patient's identifier is extracted from PID-3 / CX-01.
- MuleSoft constructs the corresponding FHIR reference:
Patient/{patientId}.
- The HTTP Connector invokes the Da Vinci DEQM FHIR R4
Measure/$care-gaps operation.
- MuleSoft interprets the returned FHIR
Parameters, Gaps in Care Bundle, DetectedIssue, and MeasureReport.
- If an open gap exists, the result can be surfaced to the care team while the patient is already present.
The demo flow is intentionally simple:
HL7v2 ADT A01
↓
File Listener
↓
HL7 EDI Read
↓
Extract PID-3
↓
FHIR $care-gaps
↓
DetectedIssue / MeasureReport
↓
CARE GAP RESULT
Demo Scenario
The demo evaluates CMS124 — Cervical Cancer Screening.
The FHIR request uses:
periodStart = 2025-01-01
periodEnd = 2025-12-31
subject = Patient/{patientId}
status = open-gap
measureId = CMS124FHIRCervicalCancerScreen
nonDocument = true
The demonstration FHIR server is:
https://cloud.alphora.com/sandbox/r4/cqm/fhir
For the supplied test patient, the returned MeasureReport shows:
Initial Population: 1
Denominator: 1
Denominator Exclusion: 0
Numerator: 0
The resulting care-gap status is:
OPEN GAP
This means the patient qualifies for the measure, is not excluded, and has not satisfied the numerator.
Sample HL7v2 ADT Message
Save the following as an .hl7 file:
MSH|^~\&|DemoADT|DemoHospital|MuleSoftVibes|CareGapsDemo|20250811100000||ADT^A01^ADT_A01|MSG00000001|P|2.5.1
EVN|A01|20250811100000
PID|1||321abfa0-2c0e-4885-8b5b-20208512e605^^^FHIR^MR||Bertha^Betty||20011231|F|||123 Main Street^^Anytown^CA^90210||5555551212
PV1|1|AMB||||1234^Demo^Provider^^^^^^NPI|||||||||||V1234567890|||||||||||||||||||||||||20250601100000
The important mapping is:
PID-3 / CX-01
321abfa0-2c0e-4885-8b5b-20208512e605
↓
FHIR Subject
Patient/321abfa0-2c0e-4885-8b5b-20208512e605
Build the Demo with MuleSoft Vibes
Create a Mule application and provide MuleSoft Vibes with the following prompt:
Build a minimal Mule 4 demonstration application for an event-driven healthcare care-gap workflow.
The purpose of the demo is:
HL7 v2 ADT A01 file arrives
→ parse the HL7 message
→ extract the patient ID from PID-3
→ call the FHIR Da Vinci DEQM $care-gaps operation
→ display the care-gap result.
Keep the implementation small and demo-oriented.
INPUT
Use the MuleSoft File connector to monitor:
C:\File\Input
Poll for new files every 5 seconds.
After successfully processing a file, move it to:
C:\File\Processed
Allow an existing file with the same name in the Processed directory to be overwritten so the demo can be run repeatedly.
HL7 PARSING
Use the MuleSoft HL7 EDI connector to parse an HL7 v2.5.1 ADT_A01 message.
Use the standard HL7 v2.5.1 ADT_A01 ESL/schema.
If the required schema is not already available in the project, locate the appropriate MuleSoft HL7 schema asset from Anypoint Exchange and add the required dependency.
Do not replace HL7 EDI parsing with a custom DataWeave HL7 parser.
PATIENT IDENTIFICATION
Extract the FHIR patient logical ID from PID-3/CX-01.
The HL7 EDI parsed payload path for this demo is:
payload.Data.ADT_A01.PID."PID-03"[0]."CX-01"
Store this value as vars.patientId.
Construct vars.subject as:
Patient/{patientId}
For the supplied test message:
vars.patientId must be:
321abfa0-2c0e-4885-8b5b-20208512e605
and vars.subject must be:
Patient/321abfa0-2c0e-4885-8b5b-20208512e605
Also extract these fields for demonstration purposes:
Patient family name:
payload.Data.ADT_A01.PID."PID-05"[0]."XPN-01"."FN-01"
Patient given name:
payload.Data.ADT_A01.PID."PID-05"[0]."XPN-02"
Date of birth:
payload.Data.ADT_A01.PID."PID-07"."TS-01"
Administrative sex:
payload.Data.ADT_A01.PID."PID-08"
FHIR CARE-GAPS REQUEST
Use the MuleSoft HTTP Request connector.
Call:
GET https://cloud.alphora.com/sandbox/r4/cqm/fhir/Measure/$care-gaps
Use these query parameters:
periodStart=2025-01-01
periodEnd=2025-12-31
subject=vars.subject
status=open-gap
measureId=CMS124FHIRCervicalCancerScreen
nonDocument=true
Set:
Accept: application/fhir+json
The expected response is a FHIR Parameters resource containing a parameter named "return".
That parameter contains a Da Vinci DEQM Gaps in Care Bundle containing a DetectedIssue.
Extract the gap-status extension from the DetectedIssue and the population counts from its contained MeasureReport.
For the known demo patient, the expected result is:
Status: OPEN GAP
Initial Population: 1
Denominator: 1
Denominator Exclusion: 0
Numerator: 0
Create a concise final INFO logger that displays:
CARE GAP RESULT
Status: <gap status>
Patient: <FHIR patient reference>
Measure: <measure reference>
Initial Population: <count>
Denominator: <count>
Denominator Exclusion: <count>
Numerator: <count>
Keep intermediate diagnostic loggers at DEBUG so the final CARE GAP RESULT is the primary business output shown in the console.
MAIN FLOW
Keep the flow visually simple:
File Listener
→ HL7 EDI Read
→ Extract PID Fields
→ Check Patient ID
→ HTTP Request to FHIR $care-gaps
→ Extract Care Gap Result
→ Log Care Gap Result
Do not add APIs, subflows, databases, queues, retry logic, or other functionality that is unnecessary for this demo.
TEST MESSAGE
The application must work with:
MSH|^~\&|DemoADT|DemoHospital|MuleSoftVibes|CareGapsDemo|20250811100000||ADT^A01^ADT_A01|MSG00000001|P|2.5.1
EVN|A01|20250811100000
PID|1||321abfa0-2c0e-4885-8b5b-20208512e605^^^FHIR^MR||Bertha^Betty||20011231|F|||123 Main Street^^Anytown^CA^90210||5555551212
PV1|1|AMB||||1234^Demo^Provider^^^^^^NPI|||||||||||V1234567890|||||||||||||||||||||||||20250601100000
Validate the generated Mule XML and DataWeave expressions before completing the project.
Run the Demo
- Start the generated Mule application.
- Wait until the application is deployed and the File Listener is running.
- Place the sample
.hl7 file in C:\File\Input.
- MuleSoft parses the ADT and extracts the patient from PID-3.
- MuleSoft invokes the FHIR
$care-gaps operation.
- Review the resulting care-gap output.
Expected result:
CARE GAP RESULT
Status: OPEN GAP
Patient: Patient/321abfa0-2c0e-4885-8b5b-20208512e605
Measure: Measure/CMS124FHIRCervicalCancerScreen
Initial Population: 1
Denominator: 1
Denominator Exclusion: 0
Numerator: 0
Business Value
This pattern turns an administrative registration event into a real-time clinical opportunity.
Instead of discovering a care gap retrospectively, the organization can identify the gap while the patient is already present and potentially incorporate the appropriate intervention into the current encounter.
The same pattern can be extended to real-time ADT feeds over MLLP, additional quality measures, enterprise patient identity resolution, authenticated FHIR servers, and delivery of the resulting care gap directly into an EHR or care-management workflow.
Deliverable: A MuleSoft Vibes-generated Mule 4 integration that converts an HL7v2 patient registration event into a Da Vinci DEQM FHIR care-gap check.