determine-basal.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //для enact/smb-suggested.json параметры: monitor/iob.json monitor/temp_basal.json monitor/glucose.json settings/profile.json settings/autosens.json --meal monitor/meal.json --microbolus --reservoir monitor/reservoir.json
  2. function generate(iob, currenttemp, glucose, profile, autosens = null, meal = null, microbolusAllowed = false, reservoir = null, clock = new Date(), pump_history, preferences, basalProfile, trio_custom_oref_variables) {
  3. var clock = new Date();
  4. var middleware_was_used = "";
  5. try {
  6. var middlewareReason = middleware(iob, currenttemp, glucose, profile, autosens, meal, reservoir, clock, pump_history, preferences, basalProfile, trio_custom_oref_variables);
  7. middleware_was_used = (middlewareReason || "Nothing changed");
  8. console.log("Middleware reason: " + middleware_was_used);
  9. } catch (error) {
  10. console.log("Invalid middleware: " + error);
  11. };
  12. var glucose_status = trio_glucoseGetLast(glucose);
  13. var autosens_data = null;
  14. if (autosens) {
  15. autosens_data = autosens;
  16. }
  17. var reservoir_data = null;
  18. if (reservoir) {
  19. reservoir_data = reservoir;
  20. }
  21. var meal_data = {};
  22. if (meal) {
  23. meal_data = meal;
  24. }
  25. var pumphistory = {};
  26. if (pump_history) {
  27. pumphistory = pump_history;
  28. }
  29. var basalprofile = {};
  30. if (basalProfile) {
  31. basalprofile = basalProfile;
  32. }
  33. var trio_custom_oref_variables_temp = {};
  34. if (trio_custom_oref_variables) {
  35. trio_custom_oref_variables_temp = trio_custom_oref_variables;
  36. }
  37. return trio_determineBasal(glucose_status, currenttemp, iob, profile, autosens_data, meal_data, trio_basalSetTemp, microbolusAllowed, reservoir_data, clock, pumphistory, preferences, basalprofile, trio_custom_oref_variables_temp, middleware_was_used);
  38. }