Introduction
With AIQNET, you can "subscribe" to a query using a FHIR Subscription Resource. This means that you can be notified for a creation or update event for any FHIR Resource that matches a FHIR query. You can make the FHIR query anything acceptable by FHIR APIs. Periodically (currently in 15 minute intervals), the FHIR server will check for any new or updated resources matching any FHIR Subscription for a user and post that data to a secure endpoint of your choice.
Here's how you create a FHIR Subscription
First launch an https://
endpoint on your own server at which you can receive POST requests from AIQNET servers.
This must be a publicly accessible server, so something with localhost will not work. Also, our server will only POST
to an endpoint with https for security. You can optionally add a Bearer token for user level authentication to secure
and indicate the request came from AIQNET servers.
After you have launched your own service to accept responses, you can create a FHIR Subscription. The main parameters are the endpoint and query. You would post to the subscription endpoint with a request like this
Example:
curl -XPOST 'https://api.raylytic.com/Subscription' \
-H 'Authorization: Bearer access_token'
An example subscription FHIR resource looks like this:
{
"resourceType": "Subscription",
"id": "findjohns",
"criteria": "Patient?name=john", // the FHIR query you want notifications on
"contact": [
{
"system": "phone",
"value": "ext 4123"
}
],
"reason": "Give me all the johns",
"status": "requested",
"channel": {
"type": "rest-hook",
"endpoint": "https://api.raylytic.com/subscription-test", // your server endpoint
"payload": "application/json",
"header": "Authorization: Bearer secret-token-abc-123" // any bearer token accepted for authentication
}
}
After that resource has been created, any subsequent FHIR resources that are posted or imported into your server will
generate a POST request to your endpoint
url. Again, we only send to https and any endpoint with localhost will not
be accepted. So you must test with a live url or service. We only support REST-hook subscriptions, so email or text
is not currently enabled.
You can test this new Subscription out by creating a new Patient resource with the name john and see that the resource you created is posted to your server within the next 5 minutes!
The use cases for FHIR Subscriptions are enormous. Entire health system workflows can be managed by this process. You can build an IFTT (If this then that) type of services all triggered by FHIR subscriptions for alerts you want to send to patients or doctors. We're excited to see how Subscriptions are used!
An working example can be found here.