📄Prescriptions
Last updated
Last updated
Like medication prescriptions at a pharmacy, users on the FibriCheck platform require an active prescription to analyse their measurements.
An active prescription links a user, a group, and a package.
The relevant properties of a prescription are:
hash
The hash
is a random string and uniquely identifies the prescription
userId
The FibriCheck user to which the prescription is linked
groupId
The group to which the user should be added. This is typically a single group per integration partner.
You will receive a dedicated groupId
for your integration from FibriCheck.
packageId
The chosen package determines the duration of the prescription, which is always limited in time.
You will receive a list of possible packageId
values for your integration from FibriCheck.
isTemplate
Obtaining an active prescription involves three simple steps:
Create a prescription hash: typically done in the (partner's) backend or provided by FibriCheck.
Scan the prescription hash: links the prescription to the user. This can be done in the front or backend.
Activate the prescription hash: from this moment, measurements will be analyzed. This is also the start of the prescription duration.
A group can be configured with a number of activation credits. When configured, every activated prescription will consume a credit. When the credits run out, activating new prescriptions will not be possible anymore until new credits are added to the group.
There are multiple ways to obtain a prescription hash. For integration partners, typically the partner instead of the end-user pays for using FibriCheck. In this scenario there are 2 options:
Use a template hash A template hash is linked to a package and a group and can be re-used by different users. Every user can use this template hash code at most once. This method is typically used in screening campaigns where users will only use FibriCheck for a single screening period.
Generate prescriptions through the API As a partner, you also have the ability to create prescription hashes yourself. This gives you more flexibility in how your customers can use FibriCheck.
Prescriptions can only be created by specific users with elevated rights. Typically only a few integration partner user accounts obtain those rights. Reach out via integrations@fibricheck.com to know more.
Execute an API call with the following payload to create a new prescription:
In case you want to create a template hash, you can add the isTemplate: true
property to the data object.
POST
https://api.fibricheck.com/tasks/v1/functions/integration/execute
data*
object
payload
You can query the status of a prescription to know if a prescription has been used. Execute an API call with the following payload to the endpoint below:
If the response has result.prescription.status
set to ACTIVATED
, the prescription has been activated by the respective user. In that case, result.prescription.user_id
will contain the reference to the user that activated the prescription.
POST
https://api.fibricheck.com/tasks/v1/functions/integration/execute
The integration REST API is implemented in a serverless computing environment. This causes some additional information to be present in the API endpoints.
Only the information in the result
property of the API response should be considered.
If no prescription is present in the result
, it indicates that no prescription is found.
You can activate a prescription for other users than the authenticated users. The typical use case is when the partner backend activates prescriptions for a user.
Activate an existing prescription by executing an API call with the following payload:
POST
https://api.fibricheck.com/tasks/v1/functions/integration/execute
data*
String
payload
For ease of use, we can also combine both into one call with the following payload:
POST
https://api.fibricheck.com/tasks/v1/functions/integration/execute
data*
String
payload
If the user receives a prescription hash, they can activate the prescription themselves. In this case, the prescription is linked to the authenticated user.
The activatePrescription
method in the SDK scans the prescription, links it to the authenticated user, and activates it. This method takes the prescription hash as a parameter.
This function can throw 2 errors:
NotPaidError
: A paying prescription has not yet been paid.
AlreadyActivatedError
: The prescription has already been used.
Activating a prescription through the REST API is a two-step process. First, you have to scan the prescription, then you have to activate the prescription. You can only scan a prescription once.
The following API call will scan the prescription and link the prescription to the user that executes the API call.
GET
https://api.fibricheck.com/prescriptions/v1/{prescriptionHash}/scan
Check the status
of the prescription after executing the API call. If the status is ACTIVATED
or NOT_PAID
, the prescription cannot be activated.
Next, activate the prescription.
GET
https://api.fibricheck.com/prescriptions/v1/{prescriptionHash}/activate
prescriptionHash
String
To know the remaining duration of the active prescription, you can request this per group. Execute an API call with the following payload to the endpoint below:
POST
https://api.fibricheck.com/tasks/v1/functions/integration/execute
data*
String
payload
The result.endTimestamp
in the response will include the prescription's ending time in ISO format.
A prescription can always be canceled by executing the following API call:
POST
https://api.fibricheck.com/tasks/v1/functions/integration/execute
data*
String
payload
Indicates if this prescription is a .