oref0 icon indicating copy to clipboard operation
oref0 copied to clipboard

Support NS profile.json in autotune

Open scottleibrand opened this issue 7 years ago • 12 comments

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.

scottleibrand avatar Dec 29 '16 17:12 scottleibrand

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.

PieterGit avatar Dec 29 '16 18:12 PieterGit

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.

sulkaharo avatar Dec 29 '16 18:12 sulkaharo

@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?

scottleibrand avatar Dec 29 '16 19:12 scottleibrand

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 )

PieterGit avatar Jan 03 '17 00:01 PieterGit

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.

ps2 avatar Feb 11 '17 20:02 ps2

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."

danamlewis avatar Feb 11 '17 20:02 danamlewis

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.

danamlewis avatar Apr 16 '18 21:04 danamlewis

There's a web app to do this, written by Mark Carrington: https://autotuneweb.azurewebsites.net

andywilson avatar Oct 03 '18 15:10 andywilson

@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 avatar Oct 03 '18 15:10 scottleibrand

@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.

andywilson avatar Oct 03 '18 16:10 andywilson

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 by python{,3}-requests) for talking to nightscout
    • texttable (satisfied by python{,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 defaultProfile in the returned blob - I'll see if the way AutotuneWeb deals with it is better
  • generated profile is accepted by both oref0-autotune and oref0-upload-profile
  • I'm not dealing with mmol in any way yet since I don't know what's done internally with that
  • generated profile works without endOffset in isfProfile:sensitivities, so I skipped trying to calculate it

Would an improved version of it be a satisfactory solution for this issue?

viq avatar Feb 24 '19 10:02 viq

@sulkaharo @PieterGit would this be worth revisiting after the in-progress Nightscout release?

scottleibrand avatar Oct 20 '19 23:10 scottleibrand