nightscout / nightscout/AndroidAPS

Add safety check to prevent unrealistic basal rates in Profile tab

Open
#4,136 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Kotlin
Stars
1.2k
Forks
6.4k
Avg merge
2d 7h
Merged PRs (30d)
19

Description

Hello,

I am not a native English speaker, but I can read English. Writing is more difficult for me, so please excuse any mistakes. I use AndroidAPS myself and I want to suggest a small safety improvement.

Currently, in the Profile tab it is possible for a user to enter very high basal rates per 24h without any validation. This can lead to unsafe profiles if a mistake is made when entering values.

Proposal:
Introduce an additional safety mechanism:

Add a new settings tab where the user must first provide some personal parameters:

Weight (kg)

Total daily insulin (TDD)

Average blood glucose

Target blood glucose

Use these parameters in the BAS tab to validate basal entries.

Example: Basal per hour should not exceed either an absolute threshold (e.g. 3 IU/h) or a relative threshold (e.g. 200% of average basal = TDD/24).

If a user tries to enter a higher value, a warning should be shown and the value should be rejected.

Reasoning:
This would prevent accidental input of unsafe basal rates and increase patient safety. It also makes the profile setup more consistent with common safety rules in diabetes care.

Example (pseudo-code):

fun validateBasaalInput(basalPerHour: Double, totalDaily: Double): Boolean {
val maxAbsolute = 3.0
val avgBasal = totalDaily / 24.0
val maxRelative = avgBasal * 2.0
val allowed = minOf(maxAbsolute, maxRelative)
return basalPerHour <= allowed
}

Discuss if this should be implemented as part of ProfileStore or as a validation step in the Profile UI.
Confirm acceptable safety thresholds with the community.
If agreed, I am willing to work on an implementation with guidance from the developers.

Contributor guide

Open the contributing guide

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.

Research direction

Start by comparing the Profile UI/BAS tab with the proposed ProfileStore validation point, then review how basal entries and profile settings are currently accepted. The work is done when the community has agreed on the safety thresholds and excessive values produce a warning and are rejected without creating an unsafe profile.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.