Giter VIP home page Giter VIP logo

t1gym's Introduction

T1 Gym

Annotate your Nightscout charts and see your progress at a glance. A tool for T1 Diabetics that loop.

Requirements:

  • NightScout instance connected to a closed loop system (openaps, Loop, AndroidAPS).
  • Firebase database setup.

t1gym's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

bunsdev

t1gym's Issues

Bugs 1

  • timezone offset on Vercel
  • missing glucose data askew
  • fixed width annotations table
  • missing carbs data for bolus Loop doesn't tell us this info,
  • temp basal rendering #7
  • padding issue
  • max basal where there shouldn't be

Better temp basal view

  • Fix basal visualisation:

Screen Shot 2020-09-01 at 11 56 49 am

  • Show the "baseline" temp basal and incidentally, display 0 temps properly.

Better summary statistic

The PGS stat isn't as motivating as it should be.

  • A 20 minute low is much more psychologically draining than running a couple mmol above in-range. Let's consider psychological wellbeing as part of overall health.

Time format varies between Loop/OpenAPS

{
_id: "5f1904678b6aca48aaf7421e",
programmed: 2.2,
eventType: "Correction Bolus",
type: "normal",
duration: 119.58333333333333,
created_at: "2020-07-22T08:23:35.000Z",
unabsorbed: 0,
timestamp: "2020-07-22T08:23:35Z",
enteredBy: "loop://Liam Edwards-Playne’s iPhone",
insulin: 1.5,
utcOffset: 0
}

It's not finding the treatment
It's found the treatment for

    const range = [
        new Date("07-22-2020"),
        new Date("07-23-2020")
    ].map(d => DateTime.fromJSDate(d))

But the more recent ranges, not so?

H: a difference with openaps vs. loop?

31 July 2020

The two missing events:

{
_id: "5f2351bf8b6aca48aa7ae586",
enteredBy: "loop://Liam Edwards-Playne’s iPhone",
eventType: "Meal Bolus",
created_at: "2020-07-30T23:03:09.000Z",
absorptionTime: 180,
timestamp: "2020-07-30T23:03:09Z",
carbs: 60,
utcOffset: 0
},

{
_id: "5f23526d8b6aca48aa7af9a5",
type: "normal",
eventType: "Correction Bolus",
unabsorbed: 0,
timestamp: "2020-07-30T23:03:39Z",
created_at: "2020-07-30T23:03:39.000Z",
enteredBy: "loop://Liam Edwards-Playne’s iPhone",
programmed: 7.5,
duration: 5,
insulin: 7.5,
utcOffset: 0
},

The timestamp field entered by Loop is in the UTC timezone.

The timestamp entered by OpenAPS is in the user's local timezone.
The created_at entered by OpenAPS is in the UTC timezone.

 "timestamp": "2020-07-22T22:55:46+10:00",
 "created_at": "2020-07-22T12:55:46.000Z",

H: could use created_at instead?

vs.

{
 "_id": "5f1904678b6aca48aaf74228",
 "duration": 0,
 "bolus": {
  "timestamp": "2020-07-22T22:55:46+10:00",
  "_type": "Bolus",
  "id": "ARAQAG73VhYU",
  "amount": 1.6,
  "programmed": 1.6,
  "unabsorbed": 0,
  "duration": 0
 },
 "timestamp": "2020-07-22T22:55:46+10:00",
 "created_at": "2020-07-22T12:55:46.000Z",
 "ratio": "11",
 "wizard": {
  "timestamp": "2020-07-22T22:55:46+10:00",
  "_type": "BolusWizard",
  "id": "W4Fu9xYWFACQCxRBIAAAABAAEEE=",
  "carb_input": 0,
  "carb_ratio": 11,
  "correction_estimate": 0,
  "food_estimate": 0,
  "unabsorbed_insulin_total": 1.6,
  "bolus_estimate": 1.6,
  "bg": 0,
  "bg_target_low": 6.5,
  "bg_target_high": 6.5,
  "sensitivity": 2,
  "units": "mmol"
 },
 "eventType": "Correction Bolus",
 "insulin": 1.6,
 "notes": "Normal bolus with wizard. Calculated IOB: -0.203 Programmed bolus 1.6 Delivered bolus 1.6 Percent delivered: 100% Food estimate 0 Correction estimate 0 Bolus estimate 1.6 Target low 6.5 Target high 6.5 Hypothetical glucose delta -3.2",
 "medtronic": "mm://openaps/mm-format-ns-treatments/Correction Bolus",
 "enteredBy": "openaps://medtronic/722",
 "utcOffset": 600
}

Performance

I'd like to improve the app's performance as an exercise. Some areas of investigation:

  • Logbook view gets very slow after 14 entries rendered.
  • Understanding React rendering best practices (eg. useCallback etc.)

Chart: carb amount may be duplicated across two boluses

In the case a user inputs a bolus for carbs, cancels it, and then inputs it again.

eg.

{
 "_id": "5f975eeec265befd1b01ac7a",
 "duration": 0,
 "bolus": {
  "timestamp": "2020-10-27T08:43:51+10:00",
  "_type": "Bolus",
  "id": "AUsCALOrSBsU",
  "amount": 0.2,
  "programmed": 7.5,
  "unabsorbed": 0,
  "duration": 0
 },
 "timestamp": "2020-10-27T08:43:51+10:00",
 "created_at": "2020-10-26T22:43:51.000Z",
 "carbs": 60,
 "ratio": "10",
 "wizard": {
  "timestamp": "2020-10-27T08:43:51+10:00",
  "_type": "BolusWizard",
  "id": "W2izqwgbFDyQChlBDzwAAAAAS0E=",
  "carb_input": 60,
  "carb_ratio": 10,
  "correction_estimate": 1.5,
  "food_estimate": 6,
  "unabsorbed_insulin_total": 0,
  "bolus_estimate": 7.5,
  "bg": 0,
  "bg_target_low": 6.5,
  "bg_target_high": 6.5,
  "sensitivity": 2.5,
  "units": "mmol"
 },
 "eventType": "Meal Bolus",
 "insulin": 0.2,
 "notes": "Normal bolus with wizard.\nCalculated IOB: 6.395\nProgrammed bolus 7.5\nDelivered bolus 0.2\nPercent delivered:  2.666666666666667%\nFood estimate 6\nCorrection estimate 1.5\nBolus estimate 7.5\nTarget low 6.5\nTarget high 6.5\nHypothetical glucose delta -0.5",
 "medtronic": "mm://openaps/mm-format-ns-treatments/Meal Bolus",
 "enteredBy": "openaps://medtronic/722",
 "utcOffset": 600
}

Screen Shot 2020-10-27 at 10 01 13 am

Feature planning.

  • Move back and forth by month in progress report.
  • Filter progress report by events, ie. days with "Drinking".
  • Links to individual days.
  • Creating reports - composing different views of data. ie. basal tests, sickness events.

Temp basal rendering is wack

Screen Shot 2020-08-07 at 4 30 20 pm

"[{"_id":"5f2c0fd07772356c20f7b8ee","amount":0,"absolute":0,"enteredBy":"loop://Liam Edwards-Playne’s iPhone","rate":0,"created_at":"2020-08-06T14:12:30.000Z","eventType":"Temp Basal","duration":30,"temp":"absolute","timestamp":"2020-08-06T14:12:30Z","utcOffset":0},{"_id":"5f2c16f37772356c20f817c7","absolute":0,"eventType":"Temp Basal","amount":0,"rate":0,"duration":24.175180367628734,"temp":"absolute","timestamp":"2020-08-06T14:42:59Z","enteredBy":"loop://Liam Edwards-Playne’s iPhone","created_at":"2020-08-06T14:42:59.000Z","utcOffset":0},{"_id":"5f2c19f57772356c20f83fda","enteredBy":"loop://Liam Edwards-Playne’s iPhone","carbs":5,"absorptionTime":180,"created_at":"2020-08-06T14:55:40.000Z","eventType":"Meal Bolus","timestamp":"2020-08-06T14:55:40Z","utcOffset":0},{"_id":"8071E674-E9FC-40AE-97B0-EB7CFE08CFCE","correctionRange":[108.09352800003246,126.10911600003787],"eventType":"Temporary Override","reason":"⚠️ Resistant","duration":42.521996233860655,"created_at":"2020-08-06T15:00:52.000Z","timestamp":"2020-08-06T15:00:52Z","enteredBy":"Loop","insulinNeedsScaleFactor":1.2,"utcOffset":0},{"_id":"5f2c1c9e7772356c20f86391","rate":0,"eventType":"Temp Basal","enteredBy":"loop://Liam Edwards-Playne’s iPhone","created_at":"2020-08-06T15:07:09.000Z","absolute":0,"timestamp":"2020-08-06T15:07:09Z","duration":30,"temp":"absolute","utcOffset":0},{"_id":"5f2ccba67772356c2001340f","enteredBy":"loop://Liam Edwards-Playne’s iPhone","timestamp":"2020-08-06T18:42:07Z","programmed":3,"created_at":"2020-08-06T18:42:07.000Z","insulin":3,"unabsorbed":0,"eventType":"Correction Bolus","type":"normal","duration":2,"utcOffset":0},{"_id":"5f2ccba67772356c20013411","insulin":6,"unabsorbed":0,"timestamp":"2020-08-06T18:49:29Z","type":"normal","enteredBy":"loop://Liam Edwards-Playne’s iPhone","created_at":"2020-08-06T18:49:29.000Z","duration":4,"programmed":6,"eventType":"Correction Bolus","utcOffset":0},{"_id":"5f2ccba67772356c20013413","unabsorbed":0,"timestamp":"2020-08-06T18:55:16Z","created_at":"2020-08-06T18:55:16.000Z","eventType":"Correction Bolus","insulin":4,"enteredBy":"loop://Liam Edwards-Playne’s iPhone","duration":60,"type":"normal","programmed":4,"utcOffset":0},{"_id":"5f2ccba67772356c20013415","created_at":"2020-08-06T22:34:06.000Z","type":"normal","duration":6.866666666666666,"insulin":10.3,"programmed":10.3,"timestamp":"2020-08-06T22:34:06Z","eventType":"Correction Bolus","unabsorbed":0,"enteredBy":"loop://Liam Edwards-Playne’s iPhone","utcOffset":0},{"_id":"5f2ccba67772356c20013417","eventType":"Correction Bolus","programmed":3,"type":"normal","timestamp":"2020-08-07T03:13:46Z","insulin":0.1,"unabsorbed":0,"duration":0.03333333333333333,"enteredBy":"loop://Liam Edwards-Playne’s iPhone","created_at":"2020-08-07T03:13:46.000Z","utcOffset":0},{"_id":"5f2ccba67772356c20013419","created_at":"2020-08-07T03:13:48.000Z","eventType":"Suspend Pump","timestamp":"2020-08-07T03:13:48Z","enteredBy":"loop://Liam Edwards-Playne’s iPhone","utcOffset":0},{"_id":"5f2ccba67772356c2001341b","eventType":"Resume Pump","enteredBy":"loop://Liam Edwards-Playne’s iPhone","created_at":"2020-08-07T03:13:49.000Z","timestamp":"2020-08-07T03:13:49Z","utcOffset":0},{"_id":"5f2ccba67772356c2001341d","unabsorbed":0,"insulin":1.5,"created_at":"2020-08-07T03:14:09.000Z","type":"normal","duration":1,"enteredBy":"loop://Liam Edwards-Playne’s iPhone","timestamp":"2020-08-07T03:14:09Z","programmed":1.5,"eventType":"Correction Bolus","utcOffset":0},{"_id":"5f2cdc507772356c2002175f","eventType":"Correction Bolus","enteredBy":"loop://Liam Edwards-Playne’s iPhone","type":"normal","unabsorbed":0,"timestamp":"2020-08-07T03:15:09Z","duration":90,"insulin":1.5,"programmed":1.5,"created_at":"2020-08-07T03:15:09.000Z","utcOffset":0},{"_id":"5f2cdeb97772356c200237f8","enteredBy":"loop://Liam Edwards-Playne’s iPhone","temp":"absolute","eventType":"Temp Basal","timestamp":"2020-08-07T04:55:20Z","created_at":"2020-08-07T04:55:20.000Z","duration":30,"absolute":4.8,"rate":4.8,"amount":2.4,"utcOffset":0},{"_id":"5f2ce0207772356c20024abe","type":"normal","created_at":"2020-08-07T04:55:44.000Z","timestamp":"2020-08-07T04:55:44Z","insulin":2,"unabsorbed":0,"eventType":"Correction Bolus","duration":1.3333333333333333,"enteredBy":"loop://Liam Edwards-Playne’s iPhone","programmed":2,"utcOffset":0},{"_id":"5f2cec827772356c2002f420","created_at":"2020-08-07T05:54:09.000Z","absolute":0,"rate":0,"duration":30,"timestamp":"2020-08-07T05:54:09Z","temp":"absolute","enteredBy":"loop://Liam Edwards-Playne’s iPhone","eventType":"Temp Basal","utcOffset":0}]"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.