Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

The FHIR Profiling tool is a development utility that can be used to generate FHIR Resource JSON schemas according to any FHIR version specification. The FHIR Profiling tool performs two key activities:

  1. First creates a FHIR Profiling SQLite database (fhir_profiles.db) by parsing and storing JSON specification files uploaded to the project. By default, the tool generates resources according to FHIR v4.0.1, however this is configurable.

  2. Using this database, the FHIR Profiling tool generates and writes the desired FHIR Resource JSON schemas to a FHIRresources.lua file, which you can then use in other projects to create and map FHIR resources.

How to use it:

 STEP 1: Import the FHIR Profiling Tool and enter the Translator

Using +COMPONENT, import the FHIR Profiling Tool, and click Edit to open the Translator.

 STEP 2: Optionally, update the FHIR version specification you want to use to generate resources

The FHIR Profiling Tool already contains the necessary files to generate FHIR v4.0.1 resources. If needed, you can update the version specification used:

  1. Go to the official http://hl7.org/fhir/directory.html and download the FHIR specification for the version you need.

Screen Shot 2024-02-15 at 5.02.17 PM.png
  1. In the downloaded specification files, locate “profiles-resources.json” and “types-resources.json”. Upload and replace the current resource.json and types.json files in the fhirUtils/profiles folder.

Screen Shot 2024-02-15 at 4.51.44 PM.png

 STEP 3: Optionally, add any custom or extension profiles you wish to add onto the standard specification

Similarly to STEP 2, if any custom or extension profiles are needed you can add the <custom_profiles>.json files to the fhirUtils/profiles folder and use table.insert() on line 19 to specify the profile you want to add to the fhir_profiles.db

 STEP 4: Create or Update the fhir_profiles database

If this is the first time running the component, in the LoadDatabase function set:

  • clean to true to cleanup the resource.json and types.json files used to create the database

  • refresh to true to create or update the database

 STEP 5: Specify a list of resource schemas you wish to generate from your newly created profiles database

Modify the ResourceList to include all of the FHIR Resources you wish to generate.

local ResourceList = {
      'Patient',
      'Appointment'
   }
 STEP 6: Take a look at FHIRresoruces.lua - notice it contains all of the FHIR resource JSON schemas

Notice the FHIRresources.lua module contains JSON strings for each resource in your list. This file can now be used in other projects to create and map FHIR resources!

Screen Shot 2024-02-16 at 9.18.58 AM.png

The FHIR Profiling Tool also contains an example of how to use the FHIRresources.lua and the FHIR Library to create FHIR resources.

 Call FHIRcreate and specify the resource you wish to generate and map values into the FHIR JSON object
-- Create a Patient resource   
local patient = FHIRcreate{resource='Patient'}

-- Populate the resource
patient.resourceType = "Patient"    
patient.identifier[1].system = "https://radboud.nl/identifiers/PatientIdentifier"
patient.identifier[1].type.coding.system = "http://terminology.hl7.org/CodeSystem/v2-0203" 
patient.identifier[1].type.coding.code = "MR"
patient.identifier[1].type.coding.display = "Medical record number"
patient.identifier[1].value = "1234"
patient.name.family = "test_ln"
patient.name.given = "test_fn"
patient.gender = "male"
patient.birthDate = "2001-10-10"
patient.address.use = "home"
patient.address.line = "123 street"
patient.address.city = "Seattle" 
patient.address.state = "WA"
patient.address.postalCode = "98052"
patient.address.country = "USA"

Using the annotations, click on the patient table generated by FHIRcreate, ready to be populated.

Screen Shot 2024-02-16 at 9.20.21 AM.png
 Use FHIRclean to remove empty nodes and serialize the resource as a string
-- Clean and serialize the resource   
FHIRclean(patient)   
local NewPatientJson = json.serialize{data=patient}
  • No labels