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:
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.
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:
Go to the official http://hl7.org/fhir/directory.html and download the FHIR specification for the version you need.
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.
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:
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!
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.
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}