Using the HealthLake Inbound Adapters
Within a production, you can include custom business services that retrieve FHIR® resources from Amazon HealthLakeOpens in a new tab. To do so, create one or more business service classes as described here. Then add them to your production and configure them.
Introduction to the Adapters
InterSystems IRIS® data platform provides two inbound adapters that can be used to retrieve FHIR® resources from HealthLake:
-
EnsLib.AmazonHealthLake.InboundAdapterOpens in a new tab performs a FHIR® Read interactionOpens in a new tab, which retrieves a single resource based on its ID.
-
EnsLib.AmazonHealthLake.InboundAdapterQueryOpens in a new tab performs a FHIR® Search interactionOpens in a new tab, with a context limited to the specified resource type. With this adapter, you receive a bundle that contains the resource, not just the resource by itself.
Overall Behavior of the Adapters
Each of the HealthLake inbound adapters provides settings that you can use to specify the location of the FHIR® resources to check for, as well as settings to authenticate to AWS. When included in a business service, each of these adapters periodically polls for available resources. Then at each polling interval:
-
If the adapter finds input from its configured data source, it constructs an input object to hold the data, and it calls the internal ProcessInput() method of the business service, passing the object to it. The input object depends upon the adapter.
-
The internal ProcessInput() method of the business service receives the input object. It then performs basic production tasks such as maintaining internal information as needed by all business services. You do not customize or override this method, which your business service class inherits.
-
The ProcessInput() method then calls your custom OnProcessInput() method, passing the input object. The requirements for this method are described in Implementing the OnProcessInput() Method.
-
Your custom OnProcessInput() method examines the input object and sends it to other hosts in the production (or creates and sends new messages based on the input object).
Creating a Business Service
The following list describes the basic requirements of the business service class:
-
Your business service class should extend Ens.BusinessServiceOpens in a new tab.
-
In your class, the ADAPTER parameter should equal one of the HealthLake inbound adapters:
-
Use EnsLib.AmazonHealthLake.InboundAdapterOpens in a new tab for a FHIR® Read interactionOpens in a new tab, where you can refer to the exact resource needed.
-
Use EnsLib.AmazonHealthLake.InboundAdapterQueryOpens in a new tab for a FHIR® Search interactionOpens in a new tab, where you need to query for the resource.
-
-
Your class should implement the OnProcessInput() method, as described in Implementing the OnProcessInput() Method.
-
For other options and general information, see Defining a Business Service Class.
Implementing the OnProcessInput() Method
Within your business service class, your OnProcessInput() method should have one of the following signatures, depending on the inbound adapter class:
-
If you use EnsLib.AmazonHealthLake.InboundAdapterOpens in a new tab:
Method OnProcessInput(pInput As EnsLib.AmazonHealthLake.InboundInput, Output pOutput As %RegisteredObject) As %Status { }
-
If you use EnsLib.AmazonHealthLake.InboundAdapterQueryOpens in a new tab:
Method OnProcessInput(pInput As EnsLib.AmazonHealthLake.InboundInputQuery, Output pOutput As %RegisteredObject) As %Status { }
Where:
-
pInput is the input object created by the adapter, using data retrieved from HealthLake.
-
pOutput is the generic output argument required in the method signature. You can use a more specific message class in the method signature.
The OnProcessInput() method should do the following:
-
Examine the input object (pInput) and decide how to use it.
The PayLoad property of this object is an instance of %GlobalBinarySteam containing the JSON representation of the FHIR resource. Use methods and properties of %GlobalBinarySteam to work with this data. See Properties of the Input Object for information on other properties, which depend on the adapter you are using.
-
Create an instance of the request message, which will be the message that your business service sends.
For information on creating message classes, see Defining Messages.
-
For the request message, set its properties as appropriate, using values in the input.
-
Call a suitable method of the business service to send the request to some destination within the production. Specifically, call SendRequestSync(), SendRequestAsync(), or (less common) SendDeferredResponse(). For details, see Sending Request Messages.
Each of these methods returns a status (specifically, an instance of %StatusOpens in a new tab).
-
Make sure that you set the output argument (pOutput). Typically you set this equal to the response message that you have received. This step is required.
-
Return an appropriate status. This step is required.
Properties of the Input Object
When you use EnsLib.AmazonHealthLake.InboundAdapterOpens in a new tab, the input object is an instance of EnsLib.AmazonHealthLake.InboundInputOpens in a new tab, which has the following properties:
-
PayLoad is an instance of %GlobalBinarySteam containing the JSON representation of the FHIR resource. Use methods and properties of %GlobalBinarySteam to work with this data.
-
DatastoreId, ResourceId, ResourceType are the ID of the data store, the ID of the resource, and the type of resource from which the data was obtained. These properties are all strings.
When you use EnsLib.AmazonHealthLake.InboundAdapterQueryOpens in a new tab, the input object is an instance of EnsLib.AmazonHealthLake.InboundInputQueryOpens in a new tab, which has the following properties:
-
PayLoad is an instance of %GlobalBinarySteam containing the JSON representation of the FHIR resource. Use methods and properties of %GlobalBinarySteam to work with this data.
-
DatastoreId is the ID of the data store from which the data was obtained. This property is a string.
-
SearchType is the type of search that was performed. This property is a string.
-
SearchParameters is the search parameters used to obtain the data. This property is a string.
Your OnProcessInput() method should examine these properties and use them as needed for your business case.