Support NS profile.json in autotune
To allow running autotune independent of an openaps instance, we should support the format of Nightscout's /api/v1/profile.json, in addition to the (slightly different) oref0 profile.json format.
Is it possible to merge the two profile formats in future? e.g. nightscout/api/v2/profile.json has same format as oref0 profile.json. that would be easier for endusers I guess.
I actually just implemented a way for OpenAPS to push a new profile into Nightscout and had to thus write an oref0->NS converter. The formats are similar but none of the fields are the same name. Options to get this working is to either implement a new API that does two-way conversion in NS, or refactor one of the codebases to use the other's format, which is a lot of work.
@PieterGit so you're suggesting the same thing as @sulkaharo: making a new /api/v2/profile.json endpoint that does the conversion on that end?
Well I suggested the way to make the profiles of Nightscout and OpenAps/oref0 the same, but I didn't realize that was a lot of work and would require a major rewrite of one of the codebases. I think if multiple profiles are used, the distinction should be made very clear and consistent (so no profile.json in oref0, but call it profile.nightscout.json (or something similar). Otherwise it will confuse users I'm afraid.
I was hoping it would be possible to use a generic profile, similar to the generic monitoring functions feature (see https://github.com/nightscout/cgm-remote-monitor/issues/1355 )
This would be very helpful for Loop users. Can someone attach a version of what format oref0 expects? I can see the NS format easily.
Bare minimum that autotune needs is the example in step 3c here: http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-4/autotune.html#phase-c-wip-running-autotune-more-easily-as-an-average-user
On Saturday, February 11, 2017, Pete Schwamb [email protected] wrote:
This would be very helpful for Loop users. Can someone attach a version of what format oref0 expects? I can see the NS format easily.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openaps/oref0/issues/300#issuecomment-279173745, or mute the thread https://github.com/notifications/unsubscribe-auth/AHH0hfhf2yNSHp1-E0wzqaIu_GavWx7rks5rbhs8gaJpZM4LXvr1 .
-- Dana Lewis | http://OpenAPS.org | http://DIYPS.org http://diyps.org | @DanaMLewis http://www.twitter.com/danamlewis | http://www.linkedin.com/in/danalewis "Doing something for someone else is more important than anything you would do for yourself."
Someone wrote a method to do this - I saw it in passing on Facebook. If anyone can find that link/details, please add it here for context.
There's a web app to do this, written by Mark Carrington: https://autotuneweb.azurewebsites.net
@andywilson That site attempts to run all of autotune as a service, but does so using a (currently) closed-source app. It does not do what this issue is asking for, which is allow someone to run a stand-alone (open-source) implementation of autotune and automatically import the NS profile so they don't have to generate it first.
@scottleibrand - ok, understood. It does show an autotune-compatible json before using it the closed app, but obviously requires a manual step to drop that onto a command line run.
Still WIP, but I'm working on a script to do exactly that. You can see the version I have right now at https://gist.github.com/viq/e62de450a793bf6d925fa8f408869637 Some notes about it:
- written in python, works with both python 2 and 3
- currently depends on two external libraries:
-
requests(satisfied bypython{,3}-requests) for talking to nightscout -
texttable(satisfied bypython{,3}-texttable) for displaying profile in text format - can be easily removed or moved to another script if we'd want to avoid that dependency
-
- grabs profile named in flags, or the one marked as
defaultProfilein the returned blob - I'll see if the way AutotuneWeb deals with it is better - generated profile is accepted by both
oref0-autotuneandoref0-upload-profile - I'm not dealing with
mmolin any way yet since I don't know what's done internally with that - generated profile works without
endOffsetinisfProfile:sensitivities, so I skipped trying to calculate it
Would an improved version of it be a satisfactory solution for this issue?
@sulkaharo @PieterGit would this be worth revisiting after the in-progress Nightscout release?