Giter Club home page Giter Club logo

middleware's Introduction

middleware

For use with FreeAPS X.

You can copy and paste (replace) into FAX middleware function, but at your own risk, so please be careful! To access middleware on your phone, first enable debug settings.

Telegram group for interaction and sharing: https://t.me/middleware_freeaps_x


Chris_with_calculated_TDD.js

Calculates past 24 hours of total daily dose (TDD) of insulin from pumphistory-24h-zoned.json every loop for use with Chris Wilson's formula.

Autosens min/max settings are respected, for me 0.7 - 1.3 works well. This middleware by-passes the normal autosens, unless when using a high temp target while exercising, and the autosens limits are instead used for limiting the dynamic ISF.

When using a high temp target (>= 118 mg/dl) together with an exercise setting, Chris' formula is temporarily turned off (as well as AutoISF, if this is used).

adjustmentFactor is used for tuning of the constant 277700 in Chris Wilson's formula. More dramatic ISF change > 1 > less dramtaic ISF change. 1 is set as default.

In order to use this middleware you first need to make the pump history accessible to FreeAPS X. This requires commits from my branch: https://github.com/Jon-b-m/freeaps/tree/pumphistory_mw, based on Ivan's latest dev branch.

Please do not change TDD = 0, because that will result in doubling your TDD, since it counts from 0. This middleware requires 24 hours of pump history data for an accurate TDD count. Middleware will only run if >= 23 hours of pumphistory data. TDD calculation has only been tested with Omnipod.


Chris_formula_autosensRatio.js

Chris' formula for dynamic ISF=277700 / (TDD * BG) is currently a challange to implement it in FreeAPS X (FAX) via middlware file due to missing TDD info in FAX.

Thus, it has been created an experimental formula by replacing TDD with autosensRatio resulting in the following formula: dISF=277700 / (adjustableFactor * autosensRatio * BG). Autosens Ratio value is visible in FAX > Settings > Insulin Sensitivities.

As autosens' typical values are between 0.7 and 1.2 (the limits are adjusted with preference settings autosens MAX/MIN), it has been added an adjustableFactor for tuning the formula. It's recommended to start with adjustableFactor = 25. Lower number = milder dynamic ISF profile.

In order to identify the optimal value of adjustableFactor, it has been created a simulation file Variable ISF simulation.numbers to simulate the dynamic ISF curve vs static ISF. AutosensRatio should be equal to 1.

Please note that this is an experimental approach, so be careful and use it at your own risk!


c_formula_with_conditions.js

This is Chris' formula but without the TDD calculation. You need to enter your TDD manually in middlware.

Autosens min/max limits in FAX settings are used to limit the dynamic ISF. Normal autosens is by-passed.

adjustmentFactor to change Chris'constant. I higer value (>1) means more dramatic ISF changes, a lower (<1) means less aggresive changes.


preferences_and_pumphistory.js

Chris_with_calculated_TDD.js but with access to FAX preferences, which means the adjustment factor and a toggle to enable/disable Chris' formula can be set in FAX preferences.

This middleware only works when you have access to preferences.json and pumphistory-24h-zoned.json in middleware (use my/merge from branch mw_preferences).


middleware's People

Contributors

jon-b-m avatar florinbv avatar mountrcg avatar bjornoleh avatar clvsjr9 avatar

Stargazers

Michel avatar

Watchers

James Cloos avatar

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.