Add 'pregnant' age option to allow for higher insulin requirements during pregnancy

This commit is contained in:
Brian Quinion 2020-10-29 12:53:01 +00:00
parent fd18b4d55f
commit 21b1117655
6 changed files with 33 additions and 11 deletions

View file

@ -189,9 +189,9 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
}
if (!hardLimits.checkOnlyHardLimits(profile.getDia(), "dia", hardLimits.getMINDIA(), hardLimits.getMAXDIA()))
if (!hardLimits.checkOnlyHardLimits(profile.getDia(), "dia", hardLimits.minDia(), hardLimits.maxDia()))
return;
if (!hardLimits.checkOnlyHardLimits(profile.getIcTimeFromMidnight(Profile.secondsFromMidnight()), "carbratio", hardLimits.getMINIC(), hardLimits.getMAXIC()))
if (!hardLimits.checkOnlyHardLimits(profile.getIcTimeFromMidnight(Profile.secondsFromMidnight()), "carbratio", hardLimits.minIC(), hardLimits.maxIC()))
return;
if (!hardLimits.checkOnlyHardLimits(profile.getIsfMgdl(), "sens", hardLimits.getMINISF(), hardLimits.getMAXISF()))
return;

View file

@ -220,9 +220,9 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface, Constr
}
if (!hardLimits.checkOnlyHardLimits(profile.getDia(), "dia", hardLimits.getMINDIA(), hardLimits.getMAXDIA()))
if (!hardLimits.checkOnlyHardLimits(profile.getDia(), "dia", hardLimits.minDia(), hardLimits.maxDia()))
return;
if (!hardLimits.checkOnlyHardLimits(profile.getIcTimeFromMidnight(Profile.secondsFromMidnight()), "carbratio", hardLimits.getMINIC(), hardLimits.getMAXIC()))
if (!hardLimits.checkOnlyHardLimits(profile.getIcTimeFromMidnight(Profile.secondsFromMidnight()), "carbratio", hardLimits.minIC(), hardLimits.maxIC()))
return;
if (!hardLimits.checkOnlyHardLimits(profile.getIsfMgdl(), "sens", hardLimits.getMINISF(), hardLimits.getMAXISF()))
return;

View file

@ -106,9 +106,9 @@ class LocalProfileFragment : DaggerFragment() {
localprofile_name.removeTextChangedListener(textWatch)
localprofile_name.setText(currentProfile.name)
localprofile_name.addTextChangedListener(textWatch)
localprofile_dia.setParams(currentProfile.dia, hardLimits.MINDIA, hardLimits.MAXDIA, 0.1, DecimalFormat("0.0"), false, localprofile_save, textWatch)
localprofile_dia.setParams(currentProfile.dia, hardLimits.minDia(), hardLimits.maxDia(), 0.1, DecimalFormat("0.0"), false, localprofile_save, textWatch)
localprofile_dia.tag = "LP_DIA"
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.ic_label), currentProfile.ic, null, hardLimits.MINIC, hardLimits.MAXIC, 0.1, DecimalFormat("0.0"), save)
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.ic_label), currentProfile.ic, null, hardLimits.minIC(), hardLimits.maxIC(), 0.1, DecimalFormat("0.0"), save)
basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_basal, "BASAL", resourceHelper.gs(R.string.basal_label) + ": " + sumLabel(), currentProfile.basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save)
if (units == Constants.MGDL) {
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.isf_label), currentProfile.isf, null, hardLimits.MINISF, hardLimits.MAXISF, 1.0, DecimalFormat("0"), save)

View file

@ -24,6 +24,7 @@ class HardLimits @Inject constructor(
val TEENAGE = 1
val ADULT = 2
val RESISTANTADULT = 3
val PREGNANT = 3
val MAXBOLUS = doubleArrayOf(5.0, 10.0, 17.0, 25.0)
// Very Hard Limits Ranges
@ -36,10 +37,10 @@ class HardLimits @Inject constructor(
val VERY_HARD_LIMIT_TEMP_MIN_BG = intArrayOf(72, 180)
val VERY_HARD_LIMIT_TEMP_MAX_BG = intArrayOf(72, 270)
val VERY_HARD_LIMIT_TEMP_TARGET_BG = intArrayOf(72, 200)
val MINDIA = 5.0
val MAXDIA = 7.0
val MINIC = 2.0
val MAXIC = 100.0
val MINDIA = doubleArrayOf(5.0, 5.0, 5.0, 5.0)
val MAXDIA = doubleArrayOf(7.0, 7.0, 7.0, 10.0)
val MINIC = doubleArrayOf(2.0, 2.0, 2.0, 0.5)
val MAXIC = doubleArrayOf(100.0, 100.0, 100.0, 100.0)
val MINISF = 2.0 // mgdl
val MAXISF = 720.0 // mgdl
val MAXIOB_AMA = doubleArrayOf(3.0, 5.0, 7.0, 12.0)
@ -57,6 +58,7 @@ class HardLimits @Inject constructor(
else if (sp_age == resourceHelper.gs(R.string.key_teenage)) TEENAGE
else if (sp_age == resourceHelper.gs(R.string.key_adult)) ADULT
else if (sp_age == resourceHelper.gs(R.string.key_resistantadult)) RESISTANTADULT
else if (sp_age == resourceHelper.gs(R.string.key_resistantadult)) PREGNANT
else ADULT
return age
}
@ -77,6 +79,22 @@ class HardLimits @Inject constructor(
return MAXBASAL[loadAge()]
}
fun minDia(): Double {
return MINDIA[loadAge()]
}
fun maxDia(): Double {
return MAXDIA[loadAge()]
}
fun minIC(): Double {
return MINIC[loadAge()]
}
fun maxIC(): Double {
return MAXIC[loadAge()]
}
// safety checks
fun checkOnlyHardLimits(value: Double, valueName: String?, lowLimit: Double, highLimit: Double): Boolean {
return value == verifyHardLimits(value, valueName, lowLimit, highLimit)

View file

@ -77,12 +77,14 @@
<item>@string/teenage</item>
<item>@string/adult</item>
<item>@string/resistantadult</item>
<item>@string/pregnant</item>
</string-array>
<string-array name="ageValues" translatable="false">
<item>@string/key_child</item>
<item>@string/key_teenage</item>
<item>@string/key_adult</item>
<item>@string/key_resistantadult</item>
<item>@string/key_pregnant</item>
</string-array>
<string-array name="quickWizardYesNo">

View file

@ -469,11 +469,13 @@
<string name="teenage">Teenage</string>
<string name="adult">Adult</string>
<string name="resistantadult">Insulin resistant adult</string>
<string name="pregnant">Pregnancy</string>
<string name="key_age" translatable="false">age</string>
<string name="key_child" translatable="false">child</string>
<string name="key_teenage" translatable="false">teenage</string>
<string name="key_adult" translatable="false">adult</string>
<string name="key_resistantadult" translatable="false">resistantadult</string>
<string name="key_pregnant" translatable="false">pregnant</string>
<string name="patientage_summary">Please select patient age to setup safety limits</string>
<string name="patient_name">Patient name</string>
<string name="patient_name_summary">Please provide patient name or nickname to differentiate among multiple setups</string>