Merge pull request #55 from twain47/pregnancy_age
Add 'pregnant' age option to allow for higher insulin requirements during pregnancy
This commit is contained in:
commit
e9d0cb3d5c
6 changed files with 37 additions and 15 deletions
|
@ -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;
|
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;
|
return;
|
||||||
if (!hardLimits.checkOnlyHardLimits(profile.getIsfMgdl(), "sens", hardLimits.getMINISF(), hardLimits.getMAXISF()))
|
if (!hardLimits.checkOnlyHardLimits(profile.getIsfMgdl(), "sens", hardLimits.getMINISF(), hardLimits.getMAXISF()))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -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;
|
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;
|
return;
|
||||||
if (!hardLimits.checkOnlyHardLimits(profile.getIsfMgdl(), "sens", hardLimits.getMINISF(), hardLimits.getMAXISF()))
|
if (!hardLimits.checkOnlyHardLimits(profile.getIsfMgdl(), "sens", hardLimits.getMINISF(), hardLimits.getMAXISF()))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -106,9 +106,9 @@ class LocalProfileFragment : DaggerFragment() {
|
||||||
localprofile_name.removeTextChangedListener(textWatch)
|
localprofile_name.removeTextChangedListener(textWatch)
|
||||||
localprofile_name.setText(currentProfile.name)
|
localprofile_name.setText(currentProfile.name)
|
||||||
localprofile_name.addTextChangedListener(textWatch)
|
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"
|
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)
|
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) {
|
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)
|
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)
|
||||||
|
|
|
@ -24,7 +24,8 @@ class HardLimits @Inject constructor(
|
||||||
val TEENAGE = 1
|
val TEENAGE = 1
|
||||||
val ADULT = 2
|
val ADULT = 2
|
||||||
val RESISTANTADULT = 3
|
val RESISTANTADULT = 3
|
||||||
val MAXBOLUS = doubleArrayOf(5.0, 10.0, 17.0, 25.0)
|
val PREGNANT = 4
|
||||||
|
val MAXBOLUS = doubleArrayOf(5.0, 10.0, 17.0, 25.0, 60.0)
|
||||||
|
|
||||||
// Very Hard Limits Ranges
|
// Very Hard Limits Ranges
|
||||||
// First value is the Lowest and second value is the Highest a Limit can define
|
// First value is the Lowest and second value is the Highest a Limit can define
|
||||||
|
@ -36,15 +37,15 @@ class HardLimits @Inject constructor(
|
||||||
val VERY_HARD_LIMIT_TEMP_MIN_BG = intArrayOf(72, 180)
|
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_MAX_BG = intArrayOf(72, 270)
|
||||||
val VERY_HARD_LIMIT_TEMP_TARGET_BG = intArrayOf(72, 200)
|
val VERY_HARD_LIMIT_TEMP_TARGET_BG = intArrayOf(72, 200)
|
||||||
val MINDIA = 5.0
|
val MINDIA = doubleArrayOf(5.0, 5.0, 5.0, 5.0, 5.0)
|
||||||
val MAXDIA = 7.0
|
val MAXDIA = doubleArrayOf(7.0, 7.0, 7.0, 7.0, 10.0)
|
||||||
val MINIC = 2.0
|
val MINIC = doubleArrayOf(2.0, 2.0, 2.0, 2.0, 0.3)
|
||||||
val MAXIC = 100.0
|
val MAXIC = doubleArrayOf(100.0, 100.0, 100.0, 100.0, 100.0)
|
||||||
val MINISF = 2.0 // mgdl
|
val MINISF = 2.0 // mgdl
|
||||||
val MAXISF = 720.0 // mgdl
|
val MAXISF = 720.0 // mgdl
|
||||||
val MAXIOB_AMA = doubleArrayOf(3.0, 5.0, 7.0, 12.0)
|
val MAXIOB_AMA = doubleArrayOf(3.0, 5.0, 7.0, 12.0, 25.0)
|
||||||
val MAXIOB_SMB = doubleArrayOf(3.0, 7.0, 12.0, 25.0)
|
val MAXIOB_SMB = doubleArrayOf(3.0, 7.0, 12.0, 25.0, 40.0)
|
||||||
val MAXBASAL = doubleArrayOf(2.0, 5.0, 10.0, 12.0)
|
val MAXBASAL = doubleArrayOf(2.0, 5.0, 10.0, 12.0, 25.0)
|
||||||
|
|
||||||
//LGS Hard limits
|
//LGS Hard limits
|
||||||
//No IOB at all
|
//No IOB at all
|
||||||
|
@ -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_teenage)) TEENAGE
|
||||||
else if (sp_age == resourceHelper.gs(R.string.key_adult)) ADULT
|
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)) RESISTANTADULT
|
||||||
|
else if (sp_age == resourceHelper.gs(R.string.key_pregnant)) PREGNANT
|
||||||
else ADULT
|
else ADULT
|
||||||
return age
|
return age
|
||||||
}
|
}
|
||||||
|
@ -77,6 +79,22 @@ class HardLimits @Inject constructor(
|
||||||
return MAXBASAL[loadAge()]
|
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
|
// safety checks
|
||||||
fun checkOnlyHardLimits(value: Double, valueName: String?, lowLimit: Double, highLimit: Double): Boolean {
|
fun checkOnlyHardLimits(value: Double, valueName: String?, lowLimit: Double, highLimit: Double): Boolean {
|
||||||
return value == verifyHardLimits(value, valueName, lowLimit, highLimit)
|
return value == verifyHardLimits(value, valueName, lowLimit, highLimit)
|
||||||
|
|
|
@ -77,12 +77,14 @@
|
||||||
<item>@string/teenage</item>
|
<item>@string/teenage</item>
|
||||||
<item>@string/adult</item>
|
<item>@string/adult</item>
|
||||||
<item>@string/resistantadult</item>
|
<item>@string/resistantadult</item>
|
||||||
|
<item>@string/pregnant</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="ageValues" translatable="false">
|
<string-array name="ageValues" translatable="false">
|
||||||
<item>@string/key_child</item>
|
<item>@string/key_child</item>
|
||||||
<item>@string/key_teenage</item>
|
<item>@string/key_teenage</item>
|
||||||
<item>@string/key_adult</item>
|
<item>@string/key_adult</item>
|
||||||
<item>@string/key_resistantadult</item>
|
<item>@string/key_resistantadult</item>
|
||||||
|
<item>@string/key_pregnant</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="quickWizardYesNo">
|
<string-array name="quickWizardYesNo">
|
||||||
|
|
|
@ -469,11 +469,13 @@
|
||||||
<string name="teenage">Teenage</string>
|
<string name="teenage">Teenage</string>
|
||||||
<string name="adult">Adult</string>
|
<string name="adult">Adult</string>
|
||||||
<string name="resistantadult">Insulin resistant 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_age" translatable="false">age</string>
|
||||||
<string name="key_child" translatable="false">child</string>
|
<string name="key_child" translatable="false">child</string>
|
||||||
<string name="key_teenage" translatable="false">teenage</string>
|
<string name="key_teenage" translatable="false">teenage</string>
|
||||||
<string name="key_adult" translatable="false">adult</string>
|
<string name="key_adult" translatable="false">adult</string>
|
||||||
<string name="key_resistantadult" translatable="false">resistantadult</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="patientage_summary">Please select patient age to setup safety limits</string>
|
||||||
<string name="patient_name">Patient name</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>
|
<string name="patient_name_summary">Please provide patient name or nickname to differentiate among multiple setups</string>
|
||||||
|
|
Loading…
Reference in a new issue