CERNERFHIR Library
The CERNERFHIR Library is an importable library containing functions to connect, authenticate, and interact with the Oracle's FHIR API. This library is used in the Cerner FHIR Adapter.
When imported into projects, typically only the CERNERFHIRclient module needs to be required in order to create the client and access the API methods.
require "CERNERFHIR.CERNERFHIRclient"
How it works:
Use the Translator's built in help to review how to use each function:
CERNERFHIRclient - sets up the adapter framework
Sets up the CERNER FHIR adapter framework, adding the various method modules to a metatable and storing the configurations added to the custom fields.
CERNERFHIRcustom - makes API requests and returns the response
CERNERFHIRcustom takes in any API requests and parameters to make the API call and return the response.
-
First, the function checks if the token key exists or is still valid (based on the key_expiry). If not, it calls CERNERFHIRauth to perform the OAuth2.0 authentication workflow to obtain the token to be used in subsequent requests.
-
Uses the passed configurations API request parameters - the method (ex. post), API (ex. Patient) and parameters for the call (ex. the patient resource to be created) - to build and carry out the appropriate HTTP request.
auth/CERNERFHIRauth - authenticates with the Cerner FHIR Server
The CERNERFHIRauth function builds and makes the HTTP POST token request to obtain the access token required for any resource requests against the FHIR Server.
A separate CERNERFHIRcreateJWT function creates the JSON Header and Payload components of the JWT and calls CERNERFHIRjwt to sign and return the JWT required for the token request.
If the token request is successful (HTTP 200 response), the token and token expiry returned are stored in the adapter object ( key and key_expiry) and saved in an encrypted file via CERNERFHIRencrypt.
methods/CERNERFHIRsearch - prepares the parameters and calls CERNERFHIRcustom for an FHIR Resource Search request
CERNERFHIRsearch prepares the parameters and calls CERNERFHIRcustom for an FHIR Resource Search HTTP GET request.
methods/CERNERFHIRreadResource - prepares the parameters and calls CERNERFHIRcustom for an FHIR Resource Read request
CERNERFHIRreadResource prepares the API endpoint and parameters to call CERNERFHIRcustom for an FHIR Resource Read HTTP GET request.