Virtual pump: TBR and extended bolus rates on the pump tab are multiplied by the concentration

Open
#5,488 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
kotlin
Domain
mobile-dev

Research direction

Read VirtualPumpViewModel.kt around lines 113–128 and trace how PumpRate and ch.basalTbrString handle concentration, checking PumpSyncImplementation.kt around line 391. Also inspect VirtualPumpPlugin.kt around lines 224–225 and the related issue #5486. Verify both reported behaviors independently; done when the displayed TBR and extended bolus rates are correct and the virtual pump basal rate stays consistent during concentration changes.

Written by the indexing model from the issue text.

Description

Found via AI-assisted code review (Claude) of upstream code, while checking the logs of my personal build of dev (current dev plus my own local changes). Each point below was checked against nightscout/dev 11681e46fe by reading the code. It was not reproduced on a pump or a phone, and no test was written or run for it. Please verify independently before acting on it.

  • VirtualPumpViewModel.kt:113-117 (TBR) and :125-128 (extended bolus) wrap the database rate as
    PumpRate (pump units) and pass it to ch.basalTbrString. That rate is already in IU, because PumpSync
    stores it converted (PumpSyncImplementation.kt:391). So the concentration is applied a second time. At
    U200 a 1.00 U/h TBR shows as "2.00 U/h (1.00 cU/h)" instead of "1.00 U/h (0.50 cU/h)". Percent TBRs are
    fine.
  • Also: VirtualPumpPlugin.baseBasalRate (:224-225) follows the requested PS through
    expectedPumpState(), before the EPS exists. Between the PS insert and the mirror refresh,
    current_basal is half (U100 to U200) or double (U200 to U100). This is on the Virtual pump only, and no
    insulin moves.

Related: #5486 (same insulin concentration change).

Dominant language
Kotlin
Stars
1.2k
Forks
7.4k
Avg merge
1d 8h
Merged PRs (30d)
86

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nightscout/AndroidAPS

All issues in nightscout/AndroidAPS

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.