[MUSIC]
>> Hi, I'm Doug Seven,
Senior Director at Microsoft Health Next.
Welcome back to our video series on the Azure API for FHIR.
In this video, we'll be looking at how to ingest data into FHIR,
specifically HL7v2 and CDA data.
One of the things we often hear from people is that they
have health care data they want to use in the Azure API for FHIR,
however, it's not already in FHIR format.
Maybe it's HL7v2 messages,
maybe it's CDA documents.
Whatever the case, the need is there to convert that data from
its original format or its legacy format into FHIR.
The FHIR Converter is an open-source tool.
In many environments, you have data
coming from disparate systems like EHRs,
connected devices, third-party datasets.
This could be in HL7v2 data formats,
this could be in CDA documents,
but in lot of cases, it's not already in FHIR.
We've enabled you to convert this legacy data,
HL7v2 or CDA documents,
into FHIR bundles using a tool called the FHIR Converter.
This is part of the ingest and
enrich phase of moving data through the system.
The FHIR Converter is
a template-based system that takes the original data in,
matches it against a predefined template that you create,
and then, converts that data into
FHIR bundles and returns it to you,
and then, you can further modify that data and
store it in the Azure API for FHIR.
These templates are based on community input.
For example, for HL7v2 data,
there's an active community called
2-To-FHIR that is doing the work to map
HL7v2 segments and data to FHIR resources and attributes.
The FHIR Converter simply implements
these standards and enables you to convert
this data relatively easily from its legacy format
into FHIR bundles and then, ingested into the API for FHIR.
The templates that enable the transformation of
HL7v2 messages or CDA documents
into FHIR bundles are entirely customizable.
These templates are based on
work that's been done in the community,
but they're a starting point for you to figure out
how you want to transform your data into FHIR.
The FHIR Converter is an open-source project on GitHub,
so you can go to github.com/Microsoft/FHIR-Converter
to get access to the project.
You can clone this locally and build it with Visual Studio.
As you look through the README documentation,
you'll see that there's two converter engines,
a handlebars engine and a liquid engine.
The liquid engine is the newer engine,
and that's the one we'll be focusing on in this video.
You'll also notice that there's
a VS Code extension for the liquid engine.
You can download and install
the FHIR Converter plug in for Visual Studio Code,
and that will give you an editing environment
for the FHIR Converter.
As we continue to look at what's in the README file,
you'll find information about how to use the converter and
what you can do with it in the Azure API for FHIR.
In this video, we'll just focus on the developer
environment and what you can do with the converter.
But the information for how to use
the converter with the Azure API for FHIR is provided.
When we're converting an HL7v2
or CDA resources into FHIR bundles,
we have to generate resource IDs for the FHIR resources.
There is a note in here on how resource ID generation works.
Within the project, there's
a templates directory which
include all the templates that you need
for the conversion from either HL7v2 or CDA into FHIR.
Within that are a set of ID templates which manage
the creation of the resource IDs based on the source templates.
We also created something called a base ID,
which you can use to create
the reference between one resource to another.
You can maintain, for example,
a patient ID as a base ID,
and as you start mapping encounters or conditions,
we can use that base ID to refer back to the patient.
We'll see how that works in just a second.
I've already cloned the project from GitHub and
built the FHIR Converter locally on my machine.
Now I'm going to work in Visual Studio code to use the converter
to transform some HL7v2 data into FHIR bundles.
Here I have Visual Studio Code.
I'm going to go ahead and press "Control
W" to create a new workspace.
It's asking me to set the root template folder,
so I'm going to go into my demo folder
and into my converter folder.
I've got a folder for templates and within
that are my HL7v2 templates.
So I'm going to go ahead and choose
my HL7v2 templates folder as my root template folder.
Then, I'm prompted to select the data folder,
so I'm going to go back to my demo folder
and into the converter folder.
I've got a sample data folder.
In my sample data folder,
I've got some HL7v2 data.
We'll go ahead and select that as my data folder,
and then, I'm prompted to save my workspace.
Again, I'll go into my demo folder and into my converter folder,
and I'll just call this Demo as
my workspace and I'll save the workspace file.
Now, I've created my workspace in
Visual Studio Code and you can see that
I've got my Demo.FHIR-Converter
which was the name of my workspace,
and I've got a folder for HL7v2 templates
and I've got a folder for my HL7v2 data.
If I look in the HL7v2 data folder,
you can see there's a number of messages here.
These are all sample messages that were provided as
part of the GitHub project when I cloned it.
You can see a number of different things.
We'll be working with this ADT message,
admit discharge transfer message.
Here you can see it's a typical sample,
in this case for a Donald Duck with a bunch of information.
This is a pretty typical HL7v2 ADT message
that we're going to be transforming into FHIR bundle,
and we're going to do that using the templates.
Now, the templates work
on a system where they build up upon each other.
If we look in the templates directory,
we'll see that we have a liquid template
for an ADT message transformation,
and here, you can take a look at what this template does.
You can see it creates a FHIR resource type of bundle which
is just a collection of multiple FHIR resources,
and then you can start to see what's in this bundle.
So we grab some of the segments from the HL7v2 message.
Here, you can see an array of segments that we grabbed
and then, we start to evaluate that
to create the different resources.
You can see here we start using a resource called ID patient,
and that's how we start to form the patient ID or the resource ID.
But then, we start to then use
the patient to create a resource of patients.
So if I look in these folders,
this message is actually made up of multiple templates.
So if I go into my resource and look at the patient template,
the patient template then defines what a patient looks like here.
You can see it's a resource of type patient,
and you just scroll down, you can see it
includes other data types.
So we have resources, we have data types,
we have code systems all making up different resources.
If you look at line 43 in the patient resource,
we're going to create an element called Name.
A name includes things like full name,
given name, things like that.
So here, you can see that we're going to
include a data type for the extended patient names.
XPN is an HL7v2 type for extended patient name.
So if I come back into my templates and
I look at my data types folder
and I scroll down until I find
the XPN template and I can look at that,
and that just creates the name.
Here, we're grabbing the XPN portion of
the patient ID segment and then, we're using
the different values to create this name resource.
If you're familiar with the FHIR patient resource,
you'll recognize the different elements
here of family given suffix,
prefix use, and so on.
This is just how the template is structuring
a FHIR resource from the original HL7v2 data.
That's how it's all put together.
So if I go back to just my ADT message,
this is when I'm ready to convert.
In order to convert this,
I'm going to start by saying this is
the piece of data I want to convert.
Now, we want to convert this ADT message into a FHIR bundle.
Now remember, we're in Visual Studio Code.
This is a DevTest environment.
This is how I'm exploring
what the template will do and how it work.
In a production environment,
you would do this through API calls
against templates that you've already authored.
But for the authoring process,
I'm going to go ahead and experiment a little bit.
I'm going to right-click on this ADT Message
and I'm going to choose that to be my data.
My FHIR Converter: "Select as data",
so I'm going to choose that,
and I'm going to choose the "ADT template" as my template.
I'm going to choose FHIR Converter: "Select as template".
Now I've assigned which file I want to use
as data and which file I want to use this template,
then I can simply hit "Control R" to do the conversion process.
Now, we'll take the data that I've selected
and process it against
the template I've selected and we'll get the result.
Now, we've processed the conversions.
We have the original ADT message on the left-hand side,
we have the ADT liquid template we used in the middle,
and then, on the right hand side is
the result of this transformation.
I'm going to go ahead and give
myself a little bit more space here.
We can look at the original message,
and we can see that this was Donald D Duck was
the patient in the HL7v2 message.
As I look at the liquid template,
we saw earlier how the patient resources created and it uses
the XPN template to craft the patient name fields.
If I look at the result,
what I've got here is a resource type of bundles.
So again, a bundle of multiple FHIR resources.
The first resource in the bundle is the resource type of patient,
and as I scroll down through the patient,
I can see how the data was transformed and I can get to,
for example, the name node that we were looking at earlier.
So I can see that Donald D Duck was transformed into
this name node as part of the transformation process.
Now, if I want to for the purposes
of experimentation during DevTest,
I can come in here and change data in the HL7v2 message.
For example, I'll just change it from Donald to
Ronald and run the transformation again,
and now, I can see what's changed.
So if I want to experiment with the template,
so I want to maybe change data in the original message or
change formatting in the template
that I can see the output of that result.
In this case, I'm using a tool for some DevTest experimentation,
but ultimately, what I'm trying to do is
define the template that will give me the result I want.
The GitHub project provides you
with a set of templates as a starting point,
but they may not match your exact needs.
The idea here is that you can change this template to match
the inputs that you're providing against
the output you are expecting to get what you want.
The FHIR Converter is a tool you can use to transform
HL7v2 data or CDA documents into FHIR bundles.
In this video, we looked at how to transform
an HL7v2 ADT message into a FHIR bundle.
The same concepts apply whether it's
a different kind of HL7v2 message or if it's the CDA message.
There are templates for both HL7v2 and CDA in the GitHub project
that you can use as a starting point and then, you can
modify those templates to suit your own needs.
Over time, we'll support more data transformations using
different data sources and
different templates to get you the outputs you need.
In this video, you saw how you can use
the FHIR Converter to transform data from a legacy format
like HL7v2 or CDA documents into
FHIR bundles and then, adjust them into the Azure API for FHIR.
I look forward to seeing you in the next video. Thank you.
[MUSIC]