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

Harmonize bg related objects of rT as numbers #1414

Merged
merged 2 commits into from
Jun 19, 2022

Conversation

mountrcg
Copy link
Contributor

shall fix #1413

@mountrcg mountrcg changed the base branch from master to dev November 30, 2021 23:15
@scottleibrand
Copy link
Contributor

Have you tested this on a production rig? If so, can you paste your test output? (We use mg/dL, so need someone using mmol/L to test).

@mountrcg
Copy link
Contributor Author

mountrcg commented Dec 11, 2021

I don't have a rig. But I can switch between mg/dl and mmol/l on FreeAPS-X and the rT.reason is shown directly from oref. And I can show the console output from Xcode:

2021-12-11 15:20:06.802571+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log: Autosens ratio: 0.78;
2021-12-11 15:20:06.803058+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log: Adjusting basal from 1 to 0.8;
2021-12-11 15:20:06.803448+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log: target_bg from 99 to 110;
2021-12-11 15:20:06.803878+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log: ISF from 3 to 3.8
2021-12-11 15:20:06.804370+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log: CR:10
2021-12-11 15:20:06.804772+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log: autoISF disabled in Preferences
2021-12-11 15:20:06.805166+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log: currenttemp:,[object Object],lastTempAge:,3,m,tempModulus:,29,m
2021-12-11 15:20:06.805558+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log: SMB disabled (no enableSMB preferences active or no condition satisfied)
2021-12-11 15:20:06.805942+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log: profile.sens:3, sens:3.8, CSF:6.9
2021-12-11 15:20:06.806335+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log: Carb Impact:,-0.6,mg/dL per 5m; CI Duration:,0,hours; remaining CI (,1.923076923076923,h peak):,0,mg/dL per 5m
2021-12-11 15:20:06.806875+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log: UAM Impact:,-0.6,mg/dL per 5m; UAM Duration:,0,hours
2021-12-11 15:20:06.807246+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log: minPredBG: 43 minIOBPredBG: 43 minZTGuardBG: 45
2021-12-11 15:20:06.807673+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log:  avgPredBG:,45,COB:,0,/,0
2021-12-11 15:20:06.808059+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log: BG projected to remain above,6.1,for,0,minutes
2021-12-11 15:20:06.808429+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log: BG projected to remain above,4.2,for,0,minutes
2021-12-11 15:20:06.808774+0100 FreeAPS[15214:21502002] [OpenAPS] JavaScriptWorker.swift - createContext() - 23 DEV: JavaScript log: naive_eventualBG:,48,bgUndershoot:,27,zeroTempDuration:,0,zeroTempEffect:,0,carbsReq:,4
2021-12-11 15:20:06.809206+0100 FreeAPS[15214:21502002] [OpenAPS] OpenAPS.swift - determineBasal(currentTemp:clock:) - 68 DEV: SUGGESTED: {
    "temp": "absolute",
    "bg": 45,
    "tick": "+0",
    "eventualBG": 32,
    "insulinReq": 0,
    "reservoir": 199.5,
    "deliverAt": "2021-12-11T14:20:06.801Z",
    "sensitivityRatio": 0.78,
    "predBGs": {
        "IOB": [
            45,
            44,
            44,
            44,
            43,
            43,
            43,
            43,
            42,
            42,
            42,
            42,
            43,
            43,
            43,
            43,
            43,
            43,
            43,
            43,
            43,
            43,
            44,
            44,
            44,
            44,
            44,
            44,
            44,
            44,
            44,
            44,
            44,
            44,
            45
        ],
        "ZT": [
            45,
            45,
            45,
            45,
            45,
            46,
            46,
            46,
            47,
            48,
            48,
            49,
            50,
            52,
            53,
            54,
            56,
            58,
            60,
            62,
            64,
            66,
            69,
            71,
            74,
            77,
            80,
            83,
            86,
            89,
            93,
            96,
            100,
            103,
            107
        ]
    },
    "COB": 0,
    "IOB": -0.05,
    "BGI": 0,
    "deviation": -0.9,
    "ISF": 3.8,
    "CR": 10,
    "target_bg": 6.1,
    "reason": "Autosense: Ratio 0.78, ISF 3 -> 3.8; minPredBG 2.4, minGuardBG 2.3, IOBpredBG 2.5; 4 add'l carbs req w/in 0m; minGuardBG 2.3<4.2 56m left and 0 ~ req 0U/hr: no temp required",
    "carbsReq": 4
}

Mind you there is some output in rT.reason for easier therapy controll from some experimental stuff. But the mmol/l values are not in "" anymore and can easily be used from the suggested object as can the mg/dl ones. I have it productive on iphone since doing the PR.
B6B9724A-A366-4895-9C0C-5B0FB4199823_1_105_c

@scottleibrand
Copy link
Contributor

Once we get someone with a pump set to mmol/L to test this successfully, it should be good to merge to dev.

@scottleibrand scottleibrand merged commit 7d53991 into openaps:dev Jun 19, 2022
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.

Harmonize mmol/l and mg/dl related outputs as number in rT (requested Temp)
2 participants