Skip to content

Commit

Permalink
Better docs and labels text
Browse files Browse the repository at this point in the history
  • Loading branch information
radioxoma committed Feb 17, 2020
1 parent bd9e023 commit 43791b7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
18 changes: 9 additions & 9 deletions heval/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def __init__(self, parent, human_model):
format='%1.0f', increment=1, command=self.set_model_fluid_multipler)
self.ctl_sbx_fluid_mul.bind("<Return>", self.set_model_fluid_multipler)
self.ctl_sbx_fluid_mul.grid(row=1, column=1)
CreateToolTip(self.ctl_sbx_fluid_mul, "24 hours fluid intake requirement.\nTypical 30-35 ml/kg")
CreateToolTip(self.ctl_sbx_fluid_mul, "24 hours fluid demand.\nTypical 30-35 ml/kg.")

Label(fr_fluid_entry, text="ml/24h").grid(row=2, column=0)
self.lbl_fluid_24h = Label(fr_fluid_entry)
Expand All @@ -473,7 +473,7 @@ def __init__(self, parent, human_model):
# Label(fr_fluid_entry).grid(row=3, column=1) # Placeholder

# Kcal input
self.fr_kcal_entry = LabelFrame(fr_entry, text="By caloric demand")
self.fr_kcal_entry = LabelFrame(fr_entry, text="By calorie demand")
self.fr_kcal_entry.pack(side=LEFT, anchor=N, expand=True, fill=BOTH)

ctl_btn_kcal = Button(self.fr_kcal_entry, text="Reset", command=self.set_input_kcal_defaults)
Expand All @@ -484,15 +484,15 @@ def __init__(self, parent, human_model):
self.fr_kcal_entry, text=None, variable=self.var_rbtm_calc_method,
value=0, command=self.set_nutr_gui_state)
ctl_rbtn0_method.grid(row=0, column=1)
CreateToolTip(ctl_rbtn0_method, "Calculate daily nutrition dose by caloric (not protein) requirement")
CreateToolTip(ctl_rbtn0_method, "Calculate daily nutrition dose by calorie (not protein) requirement")

Label(self.fr_kcal_entry, text="kcal/kg/24h").grid(row=1, column=0)
self.ctl_sbx_kcal_mul = Spinbox(
self.fr_kcal_entry, width=2, from_=0.0, to=99.0,
format='%1.0f', increment=1, command=self.set_model_kcal_multipler)
self.ctl_sbx_kcal_mul.bind("<Return>", self.set_model_kcal_multipler)
self.ctl_sbx_kcal_mul.grid(row=1, column=1)
CreateToolTip(self.ctl_sbx_kcal_mul, "24 hours energy intake requirement.\nTypical 25-30 kcal/kg")
CreateToolTip(self.ctl_sbx_kcal_mul, "24 hours energy demand.\nTypical 25-30 kcal/kg.")

Label(self.fr_kcal_entry, text="kcal/24h").grid(row=2, column=0)
self.lbl_kcal_24h = Label(self.fr_kcal_entry)
Expand All @@ -515,15 +515,15 @@ def __init__(self, parent, human_model):
self.fr_nitrogen_entry, text=None, variable=self.var_rbtm_calc_method,
value=1, command=self.set_nutr_gui_state)
ctl_rbtn1_method.grid(row=0, column=1)
CreateToolTip(ctl_rbtn1_method, "Calculate daily nutrition dose by measured protein (not caloric) requirement")
CreateToolTip(ctl_rbtn1_method, "Calculate daily nutrition dose by measured protein (not calorie) requirement")

Label(self.fr_nitrogen_entry, text="Urine urea, mmol/24h").grid(row=1, column=0)
self.ctl_sbx_uurea = Spinbox(
self.fr_nitrogen_entry, width=4, from_=0.0, to=9999.0,
format='%.0f', increment=10, command=self.set_model_uurea)
self.ctl_sbx_uurea.bind("<Return>", self.set_model_uurea)
self.ctl_sbx_uurea.grid(row=1, column=1)
CreateToolTip(self.ctl_sbx_uurea, "Total urea in whole 24h urine")
CreateToolTip(self.ctl_sbx_uurea, "Urine urea excreted during 24h (equals to total urea nitrogen, when measured in mmol/24h)")

Label(self.fr_nitrogen_entry, text="Protein g/24h").grid(row=2, column=0)
self.lbl_prot_24h = Label(self.fr_nitrogen_entry)
Expand All @@ -550,10 +550,10 @@ def __init__(self, parent, human_model):
Just set sex and height.
Nutrition mixtures dosage can be estimated in two ways:
* As daily caloric goal by weight (kcal/kg/24h)
* As daily protein goal by urine nitrogen loss (mmol/24h) or expected protein demand (g/kg/24h)
* As daily calorie goal by weight (kcal/kg/24h)
* As daily protein goal by nitrogen balance (urea nitrogen loss mmol/24h) or expected protein demand (g/kg/24h) which are dependent on each other
Heval will suggest additional fluid if nutrition mixture doesn't contain full 24h volume.
Heval will suggest additional fluid if nutrition mixture doesn't contain full 24h volume. Negative value means fluid excess.
"""))

def set_input_fluid_defaults(self, event=None):
Expand Down
23 changes: 13 additions & 10 deletions heval/nutrition.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ def describe_nutrition(self, by_protein=False):
info += "{}\n".format(self.describe_nitrogen_balance())

# Total enteral nutrition
info += "Enteral nutrition\n-----------------\n"
info += "Enteral nutrition\n"
info += "-----------------\n"
if self.human_model.debug:
info += "Always prefer enteral nutrition. Enteral mixtures contains proteins, fat, glucose. Plus vitamins and electrolytes - all that human craves. For an adult give 1500-2000 kcal, add water to meet daily requirements and call it a day.\n"
NForm = NutritionFormula(enteral_nutricomp_standard, self.human_model)
Expand All @@ -246,14 +247,15 @@ def describe_nutrition(self, by_protein=False):
full_enteral_fluid = self.fluid_24h - full_enteral_nutrition
info += "Give {:.0f} ml + water {:.0f} ml. ".format(full_enteral_nutrition, full_enteral_fluid)
# full_enteral_nutrition and self.fluid_24h in ml, so they reduce each other
info += "Resulting osmolality is {:.1f} mOsm/kg\n".format(
info += "Mixture osmolality is {:.0f} mOsm/kg\n".format(
(full_enteral_nutrition * NForm.osmolality) / self.fluid_24h)
info += "{}\n".format(NForm.describe_dose(full_enteral_nutrition))

# Total parenteral nutrition
info += "Total parenteral nutrition\n--------------------------\n"
info += "Total parenteral nutrition\n"
info += "--------------------------\n"
if self.human_model.debug:
info += "Parenteral mixtures contains proteins, fat, glucose and minimal electrolytes to not strain the vein. Add vitamins, fluid, electrolytes to meet daily requirement (total parenteral nutrition criteria).\n"
info += "Parenteral mixtures contains proteins, fat, glucose and minimal electrolytes to not strain the vein. Add vitamins, fluid, electrolytes to meet daily requirements (total parenteral nutrition criteria).\n"
NForm = NutritionFormula(parenteral_nutriflex_48_150, self.human_model)
info += "{}\n".format(str(NForm))
if by_protein:
Expand All @@ -263,14 +265,15 @@ def describe_nutrition(self, by_protein=False):
full_parenteral_fluid = self.fluid_24h - full_parenteral_nutrition
info += "Give {:.0f} ml + isotonic fluid {:.0f} ml\n".format(full_parenteral_nutrition, full_parenteral_fluid)
info += "{}\n".format(NForm.describe_dose(full_parenteral_nutrition))
if self.kcal_24h > NForm.dose_max_kcal():
info += "REACHED MAXIMAL RECOMMENDED DOSE. DAILY NUTRITION REQUIREMENT NOT SATISFIED.\n"
if full_parenteral_nutrition > NForm.dose_max_ml():
info += "REACHED MAXIMAL RECOMMENDED DOSE, BUT DAILY NUTRITION REQUIREMENTS NOT SATISFIED. Consider enteral nutrition, whenever possible.\n"
info += "Maximal {}\n".format(NForm.describe_dose(NForm.dose_max_ml()))

# Mixed parenteral with enteral
info += "Partial peripheral + enteral nutrition\n-------------------------------------\n"
info += "Total parenteral peripheral nutrition\n"
info += "-------------------------------------\n"
if self.human_model.debug:
info += "Using peripheral vein is possible for <900 mOsm/kg mixtures, but needs simultaneous enteral feeding to meet daily requirement. Peripheral nutrition diluted, so additional fluid not required.\n"
info += "Using peripheral vein is possible for <900 mOsm/kg mixtures, but needs simultaneous enteral feeding to meet daily requirements. Peripheral nutrition diluted, so additional fluid not required.\n"
NForm = NutritionFormula(parenteral_kabiven_perif, self.human_model)
info += "{}\n".format(str(NForm))
if by_protein:
Expand All @@ -280,8 +283,8 @@ def describe_nutrition(self, by_protein=False):
full_parenteral_fluid = self.fluid_24h - full_parenteral_nutrition
info += "Give {:.0f} ml + isotonic fluid {:.0f} ml.\n".format(full_parenteral_nutrition, full_parenteral_fluid)
info += "{}\n".format(NForm.describe_dose(full_parenteral_nutrition))
if self.kcal_24h > NForm.dose_max_kcal():
info += "REACHED MAXIMAL RECOMMENDED DOSE. DAILY NUTRITION REQUIREMENT NOT SATISFIED.\n"
if full_parenteral_nutrition > NForm.dose_max_ml():
info += "REACHED MAXIMAL RECOMMENDED DOSE, BUT DAILY NUTRITION REQUIREMENTS NOT SATISFIED. Consider enteral nutrition, whenever possible.\n"
info += "Maximal {}\n".format(NForm.describe_dose(NForm.dose_max_ml()))
return info

Expand Down

0 comments on commit 43791b7

Please sign in to comment.