freecals
All topics

Glucose and insulin

How to log glucose readings and insulin doses. These tools are on only when the user connects Freecals at the MCP URL with ?with=diabetes added.

Units

  • Glucose is stored in mmol/L (1 mmol/L ≈ 18 mg/dL). Show it in the profile's diabetes.glucoseUnit.
  • Bread units (BU) are carbsGrams / diabetes.gramsPerCarbUnit, when that field is set.
  • diabetes.insulinCarbRatioGrams is the grams of carbs that 1 U covers, not units per bread unit.

Glucose

  • A CGM screenshot is one log_glucose. mmol is the big number, trend is the arrow, and samples are a few chart corners. Do not make one call per point.
  • date and time are when the reading was taken, and default to now. A reading from yesterday is history.
  • Use get_overview.latestGlucose as current glucose only when fresh is true: today and within 30 minutes of now.
  • log_food does not need glucose. If you only have the food, log it and say you do not know the glucose right now.

Insulin

  • log_insulin records the units the user injected, not a calculated suggestion.
  • kind is meal (it covers food) or correction (it covers glucose).
  • Set foodEntryId when the dose belongs to a logged food entry.