FHIR Server Facade Example Profile Overview
This sample profile shows you how to implement the FHIR Facade pattern, which involves a pseudo-FHIR server on top of an existing SQL database. A "pseudo-FHIR" makes a server capable of communicating with external applications in the FHIR format. However, the server maps the actual FHIR data to store the data in a native SQL database. Using the FHIR Facade pattern might be helpful for organizations that do not plan to use fully-fledged FHIR servers, but still need to interact with external services using the FHIR data format.
The profile shows you how to perform the following operations:
- get inbound URL request,
- parse the request and perform a corresponding SQL query,
- send a response in the FHIR format.
The execution steps show you how to perform the basic operations on a Patient FHIR resource. The profile supports only GET, POST, and DELETE operations by FHIR ID, identifier, given name, family name, date of birth. The profile uses an H2 database as an example. The database contains a single table that stores information on patients. The table columns are:
- id BIGINT AUTO_INCREMENT,
- identifier VARCHAR(255),
- given VARCHAR(255),
- family VARCHAR(255),
- dob VARCHAR(255).
Profile Location
Edifecs Library / FHIR / FHIR Interactions / FHIR Server Facade Example
Requirements
- XEngine 9.2 or later
- EAM 9.2 or later
- XEServer 9.2 or later
- FHIR Standards 9.2.
Prerequisites
To test the profile, you have to deploy the H2 database with sample patient data.
- Go to ${XESProfileConfig}/
- Unzip db.zip to ${XESProfileConfig}/
Profile Execution
- Start the profile.
-
Make the following HTTP request using Postman or any other HTTP client tool:
GET http://localhost:9999/fhir/
This returns the error response This is the base URL of FHIR server. Unable to handle this request, as it does not contain a resource type or operation name.
-
Make the following request:
GET http://localhost:9999/fhir/Practitioner
This returns the error response Unknown resource type [Practitioner] - Server knows how to handle: [Patient].
-
Make the following request:
GET http://localhost:9999/fhir/Patient?first_name=Peter
This returns the error response Valid search parameters for this search are: [_id,identifier,given,family,dob].
-
Make the following request:
GET http://localhost:9999/fhir/Patient?given=Peter
The response contains an empty FHIR bundle.
-
POST the content of the file ${XESProfileConfig}/sample_data/Patient_bad.json to http://localhost:9999/fhir/Patient.
This returns the error response The property 'name_bad' is not valid since it is not defined in the object, and the object does not allow any additional properties. This error was detected at: object count: 1 property count: 3 Characters: XXX through YYY.
-
POST the content of the file ${XESProfileConfig}/sample_data/Patient.json to http://localhost:9999/fhir/Patient.
The profile returns a response 201 Created.
-
Make the following request:
GET http://localhost:9999/fhir/Patient?family=Chalmers
The response contains a FHIR bundle with the patient Peter Chalmers.
-
Make the following request:
DELETE http://localhost:9999/fhir/Patient?family=Chalmers
This returns the response Successfully deleted 1 resource(s).
-
Make the following request:
GET http://localhost:9999/fhir/Patient?family=Chalmers
The response contains an empty bundle.