/scoutx

ScoutX: An SMS/Voice notifier for Nightscout, and now currently working on a Wisblock powered GPS tracker with Helium as well as an accessible DIY Libre CGM solution.

Primary LanguagePythonApache License 2.0Apache-2.0

ScoutX

Deploy

Short Description

ScoutX is an app to notify your preferred emergency contacts in case your blood glucose values from Nightscout are out of range. ScoutX uses the Vonage messages and voice APIs and is written in Flask.

If your blood sugar values are out of range (significantly low or high), you will get a phone call alerting you and reading your blood glucose over the phone. In the event of not answering the call your preferred emergency contact(s) will receive an SMS notifying them you are out of range.

Context

I have type 1 diabetes. With all the amazing open source initiatives, this is a good way to notify my contacts should I become unresponsive due to my blood sugar being too high or too low. All the data comes from my Nightscout dasbhoard. If you want to check my blood glucose values in real time go to https://dianux.superdi.dev

I have learned so much throughout this year and itโ€™s definitely a privilege to be able to help the DIY diabetes community. This is the community that saved me from having to wake up everyday at 2am, the people who helped me handle calculating ratios etc.

When a person is diagnosed, doctors just give you a sliding scale and you have to figure out your ratios through a trial and error basis. This can cause a lot of horrible lows, until you figure out the right amount of insulin to take. And even then, this constantly changes so we are never in full control. Now with all these monitoring tools we can prevent lows/highs which are dangerous (you can die) and stay within range for most of the time.

Nightscout Dashboard

Although the initial state of this app is very basic, it's work in progress and you're more than welcome to contribute. The idea is to add more configuration options and improve the UI.

Scout Dashboard

Roadmap

This project has evolved a lot since it was first developed. The current roadmap includes the following:

โœ… Available

๐Ÿšง Work in progress

  • โœ… ScoutX: A Python app that reads data from users CGM dashboard (an OSS solution called Nightscout receiving data from CGM sensors). In here you configure your own number, an emergency contact and up to 5 additional emergency contact numbers. If blood sugar levels are out of norm, it will call you first. Most people can get warning of a low like that โ€” and if you donโ€™t pick up, it will call your emergency contact. If the first one doesnโ€™t pick up, it goes through all of them. Should no one pick up, they will all get a text message alerting them about the situation.

  • โœ… ScoutX Mobile: Mobile version of ScoutX. Built on Ionic Angular. It gathers location data from your mobile device and sends alert messages with exact location in case of emergency.

  • ๐Ÿšง ScoutX Tracker: GPS LoRa tracker with a WisBlock. I can pair the data from my monitoring app and broadcast through LoRaWan. Removing the dependency on mobile internet. If Iโ€™m out of range or in a remote area I can keep broadcasting my blood glucose data, which works with the Python app but also adds GPS tracking. If levels are out of norm, the calls will happen but all contacts will get a message with precise location in case of emergency.

Send SMS to get BG Data

The endpoint defined to manage the SMS Webhook is: /webhooks/inbound-messages

To guarantee the functionality of the integration, users have to send the following message to the number associated with the application -> "Nightscout return the latest blood glucose level entry"

Deploying to Heroku

Before you start deploying your App using the Heroku Deploy Button, you need to get the following:

Two of these credentials could be filepaths, but this is not useful at the moment of deploying the application from a repository because of security reasons. That's why we are going to pass the nexmo application private key in a single line as a environment variable and the firebase database secrets also as a JSON string in a single line.

Download your private key file from the communications dashboard and run the following command in your terminal:

awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' ./private.key

This command is going to retrieve the private key in a single line.

For the firebase secrets json file just put the content in a single line. Copy and paste it in the FIREBASE_PRIVATE_KEY field. The content sould look like this:

{
  "type": "xxxxx",
  "project_id": "xxxxx",
  "private_key_id": "xxxxx",
  "private_key": "xxxxx",
  "client_email": "xxxxx",
  "client_id": "xxxxx",
  "auth_uri": "xxxxx",
  "token_uri": "xxxxx",
  "auth_provider_x509_cert_url": "xxxxx",
  "client_x509_cert_url": "xxxxx"
}

You may configure whether you want to use the Vonage API or the Twilio API using the USE_TWILIO field.

When clicking on the the deploy button:

Deploy

You will see something like this:

Heroku deploy

Giving Thanks

Thanks to @melveg for his continued support and contributions to this project ๐Ÿ’œ

Thanks to @mariacarlinahernandez for the SMS to get BG Data feature ๐Ÿ’œ

Thanks to @vmalepati1 for adding Twilio support and Whatsapp messages ๐Ÿ’œ

Thanks to @whitep4nth3r for the awesome website and all her support. Follow her on twitch and twitter ๐Ÿ’œ

I'm super honoured for all the support and help from The Nightscout Foundation, Parley Labs and Helium - Making it possible to get the necessary equipment to assemble more trackers and test connectivity with #ThePeoplesNetwork. From the bottom of my heart: thank you!

Contributing

All contributions are welcome. Make sure you follow the code of conduct in this repository.