Testing FHIR Resources
Step 1 - Creating Patient Resources
Pre-requisite
Exercise
- Convert the below patient record (unstructured) to a FHIR patient resource
Name: Pablo Emilio Escobar Gaviria
Gender: Male
DOB: 1, December 1949
Phone: 2908409234
Email: pablo@narcos.mx
Address : 213, Rionegro, Medellín, Colombia
Setup VSCode to begin FHIR
- Go to the FHIR website. Everything you need to know about FHIR standard and also the source of truth
- Download the FHIR JSON Schema
- Add a File with fhir.schema.json to your project folder
- Congifgure the workspace settings by clicking ctr+shift+p or cmd+shit+p then type workspace settings, then add the following code
{
"json.schemas": [
{
"fileMatch": [
"*.fhir.json"
],
"url": "./fhir.schema.json"
}
]
}
Creating a patient resource
- In the project folder, create a resource (patient.fhir.json)
- Go to the patient resource to learn more about the patient resources
- Start by adding the braces
- Use autocomplete to fill in the resource (patient) attributes - Press ctrl+space and press enter once you get the key for the resource
- Manually add/type value for the key
- VSCode will let you know of any errors/validation/type for the key selected in the problems pane
Creating a patient resource extensions and profiles.
NB. The use of extensions should be controlled to avoid duplication or corruption of the file
Also check out Simplifier to do it online :)
Step 2 - Searching
Pre-requisite
- HL7 has publicly available servers
- We shall be using HAPI R4 for the API test
- You can use this GUI to do the same. Select the Health Intersection R4 server.
- We can use Insomnia to test our resources
Exercise
- In Insomnia/Postman you can create a FHIR project folder
- You can use the following operations on the base url : in this case using publicly available HAPI server url
- Resources to create
- Create a Patient
- Create a Patient with extension
- Get Patient
- Create Patient Observation
- Update Patient Observation
- Search Patient Observation
Search Exercise
NB. Add your patient_id where id is given or value for xxx
We can also perform search examples via URL as described in the search parameters doc.
- All patient whose name starts with X - http://hapi.fhir.org/baseR4/Patient?name=xxx
- All patient whose family name starts with X - http://hapi.fhir.org/baseR4/Patient?family=xxx
- All patient observations by patient name - http://hapi.fhir.org/baseR4/Observation?subject.name=xxx
- All patient observations by patient id - http://hapi.fhir.org/baseR4/Observation?patient=Patient/id
- All BP observations by code - http://hapi.fhir.org/baseR4/Observation?patient=Patient/id&code=http://lonic.org|15074-8
NB. the BP code used was http://lonic.org/?param=15074-8
Step 3 - Bundles
We are going to work on the Transaction Bundle with a conditional update.
This takes multiple resources to POST concurrently to the FHIR server. It's an all or nothing success scenario.
Example TBC