Send data from medicine dispenser or other device. Example sends the most common datapoint types which are used with medicine dispenser.
Example applies also for other device types - only sended measurement is different. For example medicine dispenser sends medicine_taken and medicine_not_taken measurements - heart rate sends heart_rate, a scale sends weight and possibly bmi and so on.
Things to consider
- Api key - Every Gillie’s organization has it’s own api keys. You have to have some kind of mechamisn to assign/configure api keys in your portal.
- Customer identification - does your portal/device has customer’s person id available? If it sends data with some device id or is an oauth device, then the device has to be paired in Gillie’s side. Please contact us for that case.
- Do you need to prevent resends. Check transaction_id in datapoint API.
- device_type field - use your brand name (lower case, no blanks) for that. This automatically creates a device for this type for the customer, and shows the measurements send from your device.
Sample
const GillieApi = require('gillie-api').GillieApi;
const api = new GillieApi(
{publicKey: "...public key here...",
privateKey: "...private key here..."
});
example();
async function example() {
// Send "medicine not taken". This is usually shown as an alarm to nurses and triggers some kind of process
// in caretaker organization (usually first make a phone call to patient, if that doesn't succeed - then somebody
// makes a house visit to patient etc.)
await api.post("/api/datapoints",
{measurement: "medicine_not_taken",
person_id: "12378907778",
device_type: "...device brand..."}
);
// Medicine taken. this is used for AI & is shown on statistics. If this comes within defined interval
// after medicine_not_taken, the medicine_not_taken alarm's status is changed to accepted/handled
await api.post("/api/datapoints",
{measurement: "medicine_taken",
person_id: "12378907778",
device_type: "...device brand..."}
);
// Example of sending some error or malfunction with device
// string_value is optional for more specific reasons
await api.post("/api/datapoints",
{measurement: "device_error",
string_value: "Motherboard failed",
person_id: "12378907778",
device_type: "...device brand..."}
);
// Some kind of connection error. string_value can be used for more specific reason
await api.post("/api/datapoints",
{measurement: "connection_error",
string_value: "Hub can't connect to dispenser",
person_id: "12378907778",
device_type: "...device brand..."}
);
// Battery low
await api.post("/api/datapoints",
{measurement: "battery",
person_id: "12378907778",
device_type: "...device brand..."}
);
// Send medicine stock low message
await api.post("/api/datapoints",
{measurement: "medicine_stock_low",
person_id: "12378907778",
device_type: "...device brand..."}
);
// Mains power lost (if connected to mains power and has emergency battery power)
await api.post("/api/datapoints",
{measurement: "mains_not_ok",
person_id: "12378907778",
device_type: "...device brand..."}
);
// Mains power ok. If device can send maind_not_ok then it should also send mains_ok when
// device is back to mains power
await api.post("/api/datapoints",
{measurement: "mains_ok",
person_id: "12378907778",
device_type: "...device brand..."}
);
}