AndroidAPS icon indicating copy to clipboard operation
AndroidAPS copied to clipboard

Add safety check to prevent unrealistic basal rates in Profile tab

Open DB-aide opened this issue 2 months ago • 0 comments

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.

DB-aide avatar Sep 09 '25 08:09 DB-aide