ReMedical - Руководитель организации
May 21, 2021

ReMedical Webhook

Intro

Webhook is a very effective way to pass data across multiple services. We are glad to announce support for this feature by the ReMedical system.

Captain Hook is glad too

Connecting to Webhook

In order to bind your url with the ReMedical Webhook you have to:

1. Navigate to the settings menu

2. Click "Webhook" option

3. Fill in your preferred url for receiving checkup data (don't forget to activate "New key" if needed)

4. Click "SAVE" button

Webhook settings

In case if the "New key" checkbox is active you will see dialog box with 2048 bit RSA private key. You can store it either as a .PEM file or as a config variable.

Private key

Decrypting data

The data you will receive is posted in JSON format with two parameters:

  1. Key
  2. Payload
{ "key" : string; "payload" : string }

Key represents encrypted symmetric key for decrypting payload. In order to decrypt this symmetric key you need to use previously acquired private key.

Decrypting checkup data

Here is an example of python script used for decryption

import rsa
import base64
from cryptography.fernet import Fernet

key_decode = base64.b64decode(key)
payload_decode = base64.b64decode(payload)

privateKey = rsa.PrivateKey.load_pkcs1(private_key_string.encode('utf8'))
symmetricKey = rsa.decrypt(key_decode, privateKey)

f = Fernet(symmetricKey)
payload_decrypted = f.decrypt(payload_decode).decode('utf-8')

Data format

Data payload you'll get after decryption

{
	"id": 27376,
	"datetime": "2021-05-21T12:08:35+0000",
	"result_datetime": "2021-05-21T12:12:58+0000",
	"sys": 120,
	"dia": 80,
	"pulse": 60,
	"alco": 0,
	"spo2": null,
	"temperature": 366,
	"video_alco": "https://...",
	"video_nibp": "https://...",
	"video_temperature": "https://...",
	"video_spo2": null,
	"photo": "https://...",
	"checkup_type": "3",
	"complaints": "",
	"device": "Strazch STZ1001",
	"result": "1",
	"note": "",
	"document": "https://...",
	"sign": null,
	"pat_fname": "Ivanov",
	"pat_sname": "Ivan",
	"pat_lname": "Ivanovich",
	"pat_tabnum": "001",
	"doc_fname": "Petrov",
	"doc_sname": "Petr",
	"doc_lname": "Petrovich"
}

Keys and value types

| Key               | Value type  | Description                      |
| ----------------- | ----------- | -------------------------------- |
| id                | int         |                                  |
| datetime          | string      | Format YYYY-MM-DDThh:mm:ss±hh:mm |
| result_datetime   | string      | Format YYYY-MM-DDThh:mm:ss±hh:mm |
| sys               | int?        |                                  |
| dia               | int?        |                                  |
| pulse             | int?        |                                  |
| alco              | int?        |                                  |
| spo2              | int?        |                                  |
| temperature       | int?        |                                  |
| video_alco        | url string? | Url with 10 minutes expiry time  |
| video_nibp        | url string? | Url with 10 minutes expiry time  |
| video_temperature | url string? | Url with 10 minutes expiry time  |
| video_spo2        | url string? | Url with 10 minutes expiry time  |
| photo             | url string? | Url with 10 minutes expiry time  |
| checkup_type      | string      |                                  |
| complaints        | string      |                                  |
| device            | string      |                                  |
| result            | string      |                                  |
| note              | string?     |                                  |
| document          | url string? | Url with 10 minutes expiry time  |
| sign              | url string? | Url with 10 minutes expiry time  |
| pat_fname         | string      |                                  |
| pat_sname         | string      |                                  |
| pat_lname         | string?     |                                  |
| pat_tabnum        | string      |                                  |
| doc_fname         | string      |                                  |
| doc_sname         | string      |                                  |
| doc_lname         | string?     |                                  |
  • id — unique checkup identifier;
  • datetime — checkup date and time;
  • result_datetime — checkup result date and time;
  • sys — patient's systolic pressure, [mm Hg];
  • dia — patient's diastolic pressure, [mm Hg];
  • pulse — patient's pulse, [BPM];
  • aclo — patient's breath alcohol concentration, [mg/l] x1000;
  • spo2 — patient's oxygen saturation, [%];
  • temperature — patient's body temperature, [°C];
  • video_alco, video_nibp, video_temperature and video_spo2 — urls of checkup videos (available only for 10 minutes!);
  • photo — url of checkup photo (available only for 10 minutes!);
  • checkup_type — checkup type;
| Value | Checkup Type |
| ----- | ------------ |
| 1     | Pre-Trip     |
| 2     | In-Trip      |
| 3     | Post-Trip    |
| 4     | Pre-Shift    |
| 5     | In-Shift     |
| 6     | Post-Shift   |
| 7     | Custom       |
  • complaints — patient's complaints, i.e. "1 3 4" – means that patient has headache, backache and toothache simultaneously;
| Value | Complaint Type |
| ----- | -------------- |
| 1     | Headache       |
| 2     | Stomach-ache   |
| 3     | Backache       |
| 4     | Toothache      |
| 5     | Other          |
  • device — device type and serial number;
  • result — checkup result (0 – passed, 1 – failed);
  • note — medical report based on the following checkup;
  • document — url of checkup protocol (available only for 10 minutes!);
  • sign — url of checkup protocol sign (available only for 10 minutes!);
  • pat_fname — patient's family name;
  • pat_sname — patient's first name;
  • pat_lname — patient's patronymic;
  • pat_tabnum — patient's unique identifier (personal number);
  • doc_fname — doctor's family name;
  • doc_sname — doctor's first name;
  • doc_lname — doctor's patronymic.
Good luck and stay tuned!

Kind regards,

BIOSOFT-M software development team