FHIR Library
- Aryn Wiebe
Owned by Aryn Wiebe
The FHIR Library is an importable library which contains two functions used to generate FHIR resources. It uses the schemas in the FHIRresources.lua file created using the FHIR Profiling Tool.
-- 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, you can view the resource table generated by FHIRcreate, ready to be populated.
-- Clean and serialize the resource
FHIRclean(patient)
local NewPatientJson = json.serialize{data=patient}
Your mapped FHIR Resource serialized as a string:
{
"address": {
"city": "Seattle",
"country": "USA",
"line": "123 street",
"postalCode": "98052",
"state": "WA",
"use": "home"
},
"birthDate": "2001-10-10",
"gender": "male",
"identifier": [
{
"system": "https://radboud.nl/identifiers/PatientIdentifier",
"type": {
"coding": {
"code": "MR",
"display": "Medical record number",
"system": "http://terminology.hl7.org/CodeSystem/v2-0203"
}
},
"value": "1234"
}
],
"name": {
"family": "test_ln",
"given": "test_fn"
},
"resourceType": "Patient"
}
The Epic FHIR Adapter uses the FHIR Library and FHIRresources.lua to build FHIR Resources.
Â