Using the HealthLake Outbound Adapter
Within a production, you can access FHIR® resources in Amazon HealthLakeOpens in a new tab. If the pre-built business operation does not meet your needs, you can create a custom business operation that directly uses the HealthLake outbound adapter. After creating the business operation, add it to your production and configure it.
Creating a Business Operation to Use the Adapter
The following list describes the basic requirements of the business operation class:
-
Your business operation class should extend Ens.BusinessOperationOpens in a new tab.
-
In your class, the ADAPTER parameter should equal EnsLib.AmazonHealthLake.OutboundAdapterOpens in a new tab.
-
In your class, the INVOCATION parameter should specify the invocation style you want to use, which must be one of the following.
-
Queue means the message is created within one background job and placed on a queue, at which time the original job is released. Later, when the message is processed, a different background job is allocated for the task. This is the most common setting.
-
InProc means the message will be formulated, sent, and delivered in the same job in which it was created. The job will not be released to the sender’s pool until the message is delivered to the target. This is only suitable for special cases.
-
-
Your class should define a message map that includes at least one entry. A message map is an XData block entry that has the following structure:
XData MessageMap { <MapItems> <MapItem MessageType="messageclass"> <Method>methodname</Method> </MapItem> ... </MapItems> }
-
Your class should define all the methods named in the message map. These methods are known as message handlers. Each message handler should have the following signature:
Method Sample(pReq As RequestClass, Output pResp As ResponseClass) As %Status { }
Here Sample is the name of the method, RequestClass is the name of a request message class, and ResponseClass is the name of a response message class.
Depending on your use case, you may be able to use the specialized HealthLake message classes. If not, see Defining Messages.
To use the adapter, the method code must call methods of the Adapter property of your business operation.
-
For other options and general information, see Defining a Business Operation Class.
The following example shows the general structure that you need:
Class EHLAKE.NewOperation1 Extends Ens.BusinessOperation
{
Parameter ADAPTER = "EnsLib.AmazonHealthLake.OutboundAdapter";
Parameter INVOCATION = "Queue";
Method Sample(pReq As RequestClass, Output pResp As ResponseClass) As %Status
{
Quit $$$ERROR($$$NotImplemented)
}
XData MessageMap
{
<MapItems>
<MapItem MessageType="RequestClass">
<Method>Sample</Method>
</MapItem>
</MapItems>
}
}
Methods of the Adapter
EnsLib.AmazonHealthLake.OutboundAdapterOpens in a new tab provides the following instance methods:
method MakePOSTRequest(datastoreId As %String,
resourceType As %String,
content As %String,
Output response As %Net.HttpResponse) as %Status {
}
This method creates an instance of a resource. The arguments are as follows:
-
datastoreId is the ID of the Amazon HealthLake data store.
-
resourceType is the type of resource to create.
-
content is the FHIR data in JSON form. This method can handle content as a string or a stream.
-
response, which is returned as output, is the response from HealthLake.
method MakeGETRequest(datastoreId As %String,
resourceType As %String,
resourceId As %String,
Output response As %Net.HttpResponse) as %Status {
}
This method obtains an instance of a resource. The arguments are as follows:
-
datastoreId is the ID of the Amazon HealthLake data store.
-
resourceType is the type of resource to obtain.
-
resourceId is the ID of the resource.
-
response, which is returned as output, is the response from HealthLake.
method MakePUTRequest(datastoreId As %String,
resourceType As %String,
resourceId As %String,
content As %String,
Output response As %Net.HttpResponse) as %Status {
}
This method updates an instance of a resource. The arguments are as follows:
-
datastoreId is the ID of the Amazon HealthLake data store.
-
resourceType is the type of resource to obtain.
-
resourceId is the ID of the resource.
-
content is the FHIR data in JSON form. This method can handle content as a string or a stream.
-
response, which is returned as output, is the response from HealthLake.
method MakeDELETERequest(datastoreId As %String,
resourceType As %String,
resourceId As %String,
Output response As %Net.HttpResponse) as %Status {
}
This method deletes an instance of a resource. The arguments are as follows:
-
datastoreId is the ID of the Amazon HealthLake data store.
-
resourceType is the type of resource to delete.
-
resourceId is the ID of the resource.
-
response, which is returned as output, is the response from HealthLake.
method MakeQueryRequest(datastoreId As %String,
searchType As %String,
searchParameters As %String,
Output response As %Net.HttpResponse) as %Status {
}
This method executes a query and obtains matching resources. The arguments are as follows:
-
datastoreId is the ID of the Amazon HealthLake data store.
-
searchType is the type of resource to query.
-
searchParameters is a comma-separated list of valid HealthLake search parametersOpens in a new tab. For a list of search parameters supported by HealthLake, see the HealthLake DocumentationOpens in a new tab.
-
response, which is returned as output, is the response from HealthLake.