Converting your data to FHIR for Azure API for FHIR
Articol
Important
Azure API for FHIR will be retired on September 30, 2026. Follow the migration strategies to transition to Azure Health Data Services FHIR® service by that date. Due to the retirement of Azure API for FHIR, new customer deployments won't be allowed beginning April 1, 2025.
Azure Health Data Services FHIR service is the evolved version of Azure API for FHIR that enables customers to manage FHIR, DICOM, and MedTech services with integrations into other Azure services.
The $convert-data custom endpoint in the FHIR® service is meant for data conversion from different data types to FHIR. It uses the Liquid template engine and the templates from the FHIR Converter project as the default templates. You can customize these conversion templates as needed.
Currently the $convert-data custom endpoint supports four types of data conversion:
Origin Data Format
Destination Data Format
C-CDA
FHIR
HL7v2
FHIR
JSON
FHIR
FHIR STU3
FHIR R4
Notă
The $convert-data endpoint can be used as a component within an export, transform, load (ETL) pipeline for the conversion of raw healthcare data from legacy formats into FHIR format. However, it is not itself an ETL pipeline. We recommend you use an ETL engine such as Logic Apps or Azure Data Factory for a complete workflow in preparing your FHIR data to be persisted into the FHIR server. The workflow might include: data reading and ingestion, data validation, making $convert-data API calls, data pre/post-processing, data enrichment, and data de-duplication.
Use the $convert-data endpoint
The $convert-data operation is integrated into the FHIR service to run as part of the service. After enabling $convert-data in your server, you can make API calls to the server to convert your data into FHIR using https://<<FHIR service base URL>>/$convert-data.
Parameter Resource
$convert-data takes a Parameter resource in the request body as described in the following table. In the API call request body, you would include the following parameters:
Parameter Name
Description
Accepted values
inputData
Data to be converted.
For Hl7v2: string For Ccda: XML For Json: JSON For FHIR STU3: JSON
inputDataType
Data type of input.
HL7v2, Ccda, Json, Fhir
templateCollectionReference
Reference to an OCI image template collection on Azure Container Registry (ACR). It's the image containing Liquid templates to use for conversion. It can be a reference either to the default templates or a custom template image that is registered within the FHIR service. See the following to learn about customizing the templates, hosting those on ACR, and registering to the FHIR service.
FHIR STU3": STU3 Resource, for example Name, "Patient", "Observation", "Organization".
Notă
FHIR STU3 to R4 templates are "diff" Liquid templates that provide mappings of field differences only between STU3 resource and its equivalent resource in FHIR R4 standard. Some of the STU3 resources are renamed or removed from R4. Refer to Resource differences and constraints for STU3 to R4 conversion.
Notă
JSON templates are sample templates for use, not "default" templates that adhere to any pre-defined JSON message types. JSON doesn't have standardized message types, unlike HL7v2 messages or C-CDA documents. Instead of default templates, we provide you with some sample templates that you can use as a starting guide for your own customized templates.
Avertisment
Default templates are released under the MIT License and are not supported by Microsoft Support.
Default templates are only provided to help you get started. They may get updated when we update versions of the Azure API for FHIR. You must verify the conversion behavior and host your own copy of templates on an Azure Container Registry, register those to the Azure API for FHIR to use in your API calls. This is necessary for consistent data conversion behavior across different versions of Azure API for FHIR.
You can use the FHIR Converter extension for Visual Studio Code to customize the templates as per your needs. The extension provides an interactive editing experience, and makes it easy to download Microsoft-published templates and sample data. Refer to the documentation in the extension for more details.
Notă
The FHIR Converter extension for Visual Studio Code is available for HL7v2, C-CDA and JSON Liquid templates. FHIR STU3 to R4 Liquid templates are currently not supported.
Host and use templates
It's recommended that you host your own copy of templates on ACR. There are four steps involved in hosting your own copy of templates and using those in the $convert-data operation:
Push the templates to your Azure Container Registry.
Enable Managed Identity on your Azure API for FHIR instance.
Provide access of the ACR to the Azure API for FHIR Managed Identity.
Register the ACR servers in the Azure API for FHIR.
Optionally configure ACR firewall for secure access.
Push templates to Azure Container Registry
After creating an ACR instance, you can use the FHIR Converter: Push Templates command in the FHIR Converter extension to push the customized templates to the ACR. Alternatively, you can use the Template Management CLI tool.
Enable Managed Identity on Azure API for FHIR
Browse to your instance of Azure API for FHIR service in the Azure portal, and then select the Identity blade.
Change the status to On to enable managed identity in Azure API for FHIR.
Provide access of the ACR to Azure API for FHIR
Browse to the Access control (IAM) blade.
Select Add, and then select Add role assignment to open the Add role assignment page.
For more information about assigning roles in the Azure portal, see Azure built-in roles.
Register the ACR servers in Azure API for FHIR
You can register the ACR server using the Azure portal, or using CLI.
Registering the ACR server using Azure portal
Browse to the Artifacts blade under Data transformation in your Azure API for FHIR instance. You see the list of currently registered ACR servers. Select Add, and then select your registry server from the drop-down menu. You need to select Save for the registration to take effect. It may take a few minutes to apply the change and restart your instance.
Registering the ACR server using CLI
You can register up to 20 ACR servers in the Azure API for FHIR.
Install Azure Health Data Services CLI from Azure PowerShell if needed:
Azure CLI
az extension add -n healthcareapis
Register the acr servers to Azure API for FHIR by following these examples:
Register a single ACR server
Azure CLI
az healthcareapis acr add --login-servers"fhiracr2021.azurecr.io"--resource-group fhir-test--resource-name fhirtest2021
Register multiple ACR servers
Azure CLI
az healthcareapis acr add --login-servers"fhiracr2021.azurecr.io fhiracr2020.azurecr.io"--resource-group fhir-test--resource-name fhirtest2021
Configure ACR firewall
Select Networking for the Azure storage account from the portal.
Select Selected networks.
Under the Firewall section, specify the IP address in the Address range box. Add IP ranges to allow access from the internet or your on-premises networks.
In the following table, you'll find the IP address for the Azure region where the Azure API for FHIR service is provisioned.
Azure Region
Public IP Address
Australia East
20.53.47.210
Brazil South
191.238.72.227
Canada Central
20.48.197.161
Central India
20.192.47.66
East US
20.62.134.242, 20.62.134.244, 20.62.134.245
East US 2
20.62.60.115, 20.62.60.116, 20.62.60.117
France Central
51.138.211.19
Germany North
51.116.60.240
Germany West Central
20.52.88.224
Japan East
20.191.167.146
Japan West
20.189.228.225
Korea Central
20.194.75.193
North Central US
52.162.111.130, 20.51.0.209
North Europe
52.146.137.179
Qatar Central
20.21.36.225
South Africa North
102.133.220.199
South Central US
20.65.134.83
Southeast Asia
20.195.67.208
Sweden Central
51.12.28.100
Switzerland North
51.107.247.97
UK South
51.143.213.211
UK West
51.140.210.86
West Central US
13.71.199.119
West Europe
20.61.103.243, 20.61.103.244
West US 2
20.51.13.80, 20.51.13.84, 20.51.13.85
West US 3
20.150.245.165
Notă
The preceding steps are similar to the configuration steps described in the document How to export FHIR data. For more information, see Secure Export to Azure Storage
Verify
Make a call to the $convert-data API specifying your template reference in the templateCollectionReference parameter.
<RegistryServer>/<imageName>@<imageDigest>
Next steps
In this article, you learned about data conversion for Azure API for FHIR. For more information about related GitHub Projects for Azure API for FHIR, see
Demonstrează înțelegerea activităților comune de inginerie a datelor pentru a implementa și a gestiona sarcinile de lucru de inginerie de date în Microsoft Azure, utilizând mai multe servicii Azure.