Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #13

Merged
merged 57 commits into from
Sep 22, 2021
Merged

Dev #13

merged 57 commits into from
Sep 22, 2021

Conversation

Foxy7
Copy link
Owner

@Foxy7 Foxy7 commented Sep 22, 2021

No description provided.

danamlewis and others added 30 commits November 9, 2019 20:37
* Add ability to calculate glucose noise

* don not use ** operator

* log messages for iob error

* remove test debug

* log message for calculating glucose noise

* fix preference check for calc_glucose_noise

* add calculate-glucose-noise to package.json

* default calc_glucose_noise preference to false

* fix error in comments

* use max noise value of CGM or oref0 computed noise

* update log messages for glucose noise; add noise test
… used anymore. (#1319)

Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
* first round of new comments and reorg notes; remove old comments

* more comments

* remove unused aci variable

* comment as to why we don't use setTempBasal()
* new script to install mraa+ccprog on oref0 dev

* comment space

* typofix

* git pull to update ccprog if it already exists

* cd to absolute path for ccprog

* install ccprog along with mraa

* Delete bin/mraa-ccprog-install.sh in favor of oref0-mraa-install from #1302
* flat CGM data isn't really an error, just a reason to dose neutrally

* add actual delta and avgdelta values to unchanged reason

* include current BG too
* Add test for meter bg values when getting last glucose

* skip meter bg when getting last glucose
…GET-LAST

Conflicts:
	lib/determine-basal/determine-basal.js
	tests/get-last-glucose.test.js
* Add a shutdown function for pi based rigs

Added code to shutdown a pi based rig when battery level is low. I tested this code on my pi rig with explorer HAT several times using my lab bench power supply and one time with a standard 18650 cell.

* Changed shutdown from +5 to now
…alive. (#1339)

This helps to distinguish between the case that pi does not have connection to the phone,
and the case that connection to the phone exists but phone has no external IP connection.

Also in the case that both WiFi and BT tethering is enabled one can see which of them is used (the one with the lower metric).

Here is an example to the output (when both WiFi and BT are enabled.):

At Mon 23 Dec 2019 04:50:08 PM IST my local Bluetooth IP is: 192.168.44.226
At Mon 23 Dec 2019 04:50:10 PM IST ping to default gateway 192.168.44.1 (bnep0 metric = 0) passed
At Mon 23 Dec 2019 04:50:10 PM IST ping to default gateway 192.168.44.1 (bnep0 metric = 214) passed
At Mon 23 Dec 2019 04:50:11 PM IST ping to default gateway 192.168.3.1 (wlan0 metric = 302) passed
At Mon 23 Dec 2019 04:50:11 PM IST my public IP is: 37.26.149.235

Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
* there is no inputs.retrospective, so always default to 24h before last glucose

* move variables up from rT.reason to rT

* simple oref0-simulator

* apply deviations to glucose.json if suggested.json invalid

* write to log.json; only keep/process ~400 glucose and pumphistory records

* only add UAM to ISF if ISFLength < 10

* print 5m non-average deviation and BG

* chmod +x

* make functions

* unchanging BG of 39 is legit (LOW)

* add support for carb entries

* Get profile from NS in format OpenAPS understands

Still WIP

* Deal with `sens` not having `timeAsSeconds`

* Remove debug print

* Deal with carbration not having timeAsSeconds

* More defence against lack of timeAsSeconds

* Refactor to add normalize_entry function

For now it just makes certain timeAsSeconds is present.
Move all such normalization to use this function.

* Move more common operations to normalize_entry

* Reformat by Black, no code changes

* Add timezone information to generated profile

* Add autosens limits to generated profile

Without it strange things can happen, like autotune trying to change ISF
from 56 to 700

* Deal better with Profile Switch not having valid profile

* Provide hint on how to specify profile name

* Add ability to write profile files directly

* Deal with profile files not existing yet

* Don't use very new python features

* Deal with entries not having 'time' field

* Normalize all timed entries

* Try to support AAPS with local profile

* whitespace

* define delta before use

* update determine-basal arguments

* advance clock when suggested.json is invalid

* don't advance clock twice

* use consistent timezone format

* calculate glucose stats

* rm *.json on init; default dev, noise, and carbs to zero

* default noise to 10 to make something interesting happen

* add oref0-simulator and oref0-backtest

* copy all examples recursively

* pumpprofile.json for running autotune

* wrapper script for backtesting with oref0-simulator

* another TODO

* TODO

* download preferences.json from Nightscout devicestatus.json endpoint

* comment out Texttable dependency stuff for now and output valid json to stdout

* download profile.json from Nightscout profile.json endpoint

* support real entries not on 5m boundaries

* download historical glucose data from Nightscout entries.json for the day prior

* default bolusIncrement to 0.1 is profile.bolus_increment isn't defined (for simulator)

* only use simulated results for interim stats

* download actual glucose data & compare stats; fix sens/profile

* print stats for actuals while running

* more compact stats

* output cleanup

* allow oref0-simulator to run retrospective autosens

* download ns-treatments.json for initial autosens

* comment out more Texttable() dependencies

* use python-2.7 compatible IOError instead of FileNotFoundError

* keep and use all-glucose.json values for easy stats

* ignore CGM error readings

* pass device for fakecgm simulator detection

* bypass CGM data is unchanged (tooflat) detection when in simulator mode

* don't run stats twice at end

* support specifying DIR, and default to datestamped /tmp/oref0-simulator dir

* TODO

* read a --preferences override file for testing different preferences

* remove debugging

* log backtest and autotune commands

* tee -a to append

* basic file mode support

* use mydate for OSX compatibiilty

* use mydate for OSX compatibiilty

* use reduce to merge, for jq 1.5 compatibility

* escape % for OSX printf compatibility

* escape % for OSX printf compatibility

* preferences isn't nested, so a simple add will suffice

* support autosens-override.json

* support --autosens-override

* support --profile and --preferences in autotunelog file mode

Co-authored-by: viq <vicviq@gmail.com>
* Add public ip information to status file

I want to show the public ip in my system menu on the disply and don't want to do an extra ping :)
This code is tested on my pi rig with explorer-HAT (for around two weeks).

* update hasPublicIp to publicIP

This file now contains the actual IP, so updating its name to better reflect that.

Co-authored-by: Scott Leibrand <scottleibrand@gmail.com>
* find and delete the oldest log file every minute to avoid full diskdelete the oldest log file

* start deleting at 10MB free
scottleibrand and others added 27 commits December 31, 2019 14:38
…h oref 0.7.x (regression) (#1341)

* re-enable cgm inflow of share2 with token based authentication nightscout

* syntax

Co-authored-by: Scott Leibrand <scottleibrand@gmail.com>
* replace openaps first-upload (mentioned in docs)

* syntax

* restore all but the mdt-cgm.json changes

* try to reset clocks on enlite cgm failure
Tested by running for 24 hours with and without SMB.

Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
Fixes an issue with new installs where log shortcuts are not added to .bash_profile, because the `oref0-log-shortcuts.sh` script only works on existing files.
* rudimentary support for BG target schedules

* also override .max_bg
* print pretty stats on one line, and csv stats on another

* check if temp_basal.json is empty, and write a valid one if so

* more accurate logging
* Upload NS status when possible.

Before this checkin, ns-loop created the status data, and uploaded it to nightscout (if possible).
But in case of failure, the file will get overwritten.
This means that in the case of no internet, OAPS decisions get lost.
This checkin fixes it by adding timestamps to the files.
When internet is available, the files will be uploaded according to the correct order.
Files older than a day will be deleted.

Testing:
I have prevented uploading of files for a few hours, and when it was enabled again, data was shown correctly in nightscout site.
Decreased timeout, and saw the files being deleted.

Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>

* In the case that a status file does not contain iob delete it instead of uploading it.

Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
* deprecate/remove support for max_bg and wide_bg_target_range

* support target_bg in preferences.json

* populate target_bg from preferences.json to profile.json

* allow target_bg to override profile schedule in simulator
* don't loop on CGM data changing less than 1 mg/dL/5m for 45m

* typofix

* fix merge conflict error

* update tests to not be too flat

* continue to low-temp normally on too-flat readings <= 60 mg/dL

* only install/setup hostapd/dnsmasq if desired (to avoid breaking wifi)

* typofix

* treat hotspot_option as a string that must be "true"

* set up xdrip-js with DEXCOM_CGM_TX_ID

* whitespace
* Bugfixes for 0.7.1

- Rework nodejs/npm install
- Install openaps toolkit from github
- Ask user to upgrade their Debian Jessie install...

* Update openaps-install.sh

* Update openaps-install.sh

* Store MEDTRONIC_PUMP_ID and MEDTRONIC_FREQUENCY

This stores MEDTRONIC_PUMP_ID and MEDTRONIC_FREQUENCY in the user's ~/.bash_profile, so they can run commands without having to manually set them at login time.
* Upload NS status when possible.

Before this checkin, ns-loop created the status data, and uploaded it to nightscout (if possible).
But in case of failure, the file will get overwritten.
This means that in the case of no internet, OAPS decisions get lost.
This checkin fixes it by adding timestamps to the files.
When internet is available, the files will be uploaded according to the correct order.
Files older than a day will be deleted.

Testing:
I have prevented uploading of files for a few hours, and when it was enabled again, data was shown correctly in nightscout site.
Decreased timeout, and saw the files being deleted.

Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>

* In the case that a status file does not contain iob delete it instead of uploading it.

Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>

* Add code to run js code on a shared server.

This saves initilaztion time.

Worked for a day, which means testing only started.

* Fix a typo.

* Code to start shared node.

* Add code that verifies that shared node is answering to requests and
starting it if needed.

* Add code to store program input in order to test it.

* fix dashes to be underscores

* Add json file to shared code.

* Add code to capture data of json commands.

* New json funciontality, and changes from tests.

* Trival changes to white spaces handeling.

* Minor refactoring to the code.

Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>

* install socat on all platforms for shared-node

* remove non-json debug output breaking json parsing

* Merge branch 'tzachi-share-node-ns-status' of https://github.com/tzachi-dar/oref0 into tzachi-dar-tzachi-share-node-ns-status

Conflicts:
	bin/oref0-ns-loop.sh

* install socat on all platforms for shared-node

* remove non-json debug output breaking json parsing

* Remove temp files from the shared node.

Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>

* Stop copying data to test_data.

Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>

* Ad an update script and call it every 15 minutes.

Co-authored-by: Tzachi Dar <tzachi.dar@gmail.com>
* Update index.js

* Update determine-basal.js

* Added 0.2 as default and 0.3 as safety limit

* fixed code spacing

* removed %
Recently I re-ran the setup script on DEV and ran into the parsedatetime error. I narrowed it down to what I think is a typo, there is a `===` when I believe `==` is what was meant. I modified this file locally and ran with no issues.
As per @renegadeandy pull request renegadeandy#1

just tested it and it works nicely, so making PR for Dev.
Co-authored-by: Jeremy Cunningham <jpcunningh@gmail.com>
* Better error handling for Autotune without BG-data

Prevents technical error on the logging which users of Autotune(Web) see.

* Improve error message on Autotune without BG-data

Informs users on where to start investigation.
@Foxy7 Foxy7 merged commit 5fbb9d4 into Foxy7:dev Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.