Esempio n. 1
0
        private void CreateCorrectionBolus(double insulin, double carbs, string reference, string dateTime, string key)
        {
            Treatment treatment = new Treatment();

            treatment.Insulin = insulin;// message.BolusEstimate;
            treatment.Carbs   = carbs;
            if (treatment.Carbs.HasValue && treatment.Carbs.Value != 0)
            {
                treatment.EventType = "Meal Bolus";
            }
            else
            {
                treatment.EventType = "Correction Bolus";
            }
            treatment.Key = key;
            //treatment.EnteredBy = $"Ref:{reference}";// $"Ref:{message.LastBolusReference}";
            treatment.Created_at = dateTime;// message.LastBolusDateTime.ToString(dateformat);
            Treatments.Add(treatment);

            //var last = await _client.TreatmentsAsync($"find[eventType]={treatment.EventType.Replace(" ", "+")}&find[enteredBy]={treatment.EnteredBy}", 1);
            //if (last.Count == 0)
            //{

            //}
        }
Esempio n. 2
0
        private Treatment CreateBgReading(BG_READING_Event bgEvent, string key)
        {
            Treatment treatment = new Treatment();

            treatment.EventType   = "BG Check";
            treatment.GlucoseType = "Finger";
            treatment.Key         = key;
            //if (bgEvent.BgUnits==BgUnitEnum.MMOL_L)
            //{
            //    treatment.Glucose = bgEvent.BgValueInMmol.ToString();
            //    treatment.Units = "mmol";
            //}
            //else
            //{
            treatment.Glucose = bgEvent.BgValueInMg.ToString();
            treatment.Units   = "mg/dl";
            //}


            treatment.Created_at = bgEvent.Timestamp.Value.ToString(Constants.Dateformat);
            //treatment.EnteredBy = $"ref:${treatment.EventType} - {treatment.Created_at}";
            Treatments.Add(treatment);

            return(treatment);
        }
Esempio n. 3
0
        private void CreateNote(string note, DateTime createdAt, string key)
        {
            Treatment treatment = new Treatment();

            treatment.EventType  = "Note";
            treatment.Created_at = createdAt.ToString(Constants.Dateformat);;
            treatment.Notes      = note;
            treatment.Key        = key;
            Treatments.Add(treatment);
        }
Esempio n. 4
0
        private void CreateDailyTotal(DAILY_TOTALS_Event dtEvent, DateTime createdAt, string key)
        {
            Treatment treatment = new Treatment();

            treatment.EventType  = "Note";
            treatment.Created_at = createdAt.ToString(Constants.Dateformat);;
            treatment.Notes      = "Daily Totals<br>" + GetHtmlTable(dtEvent);
            treatment.Key        = key;
            treatment.Insulin    = 22.3; //place on the top of the graph
            Treatments.Add(treatment);
        }
Esempio n. 5
0
        private Treatment CreateCannulaChanged(DateTime createdAt, string key)
        {
            Treatment treatment = new Treatment();

            treatment.EventType  = "Site Change";
            treatment.Created_at = createdAt.ToString(Constants.Dateformat);
            //treatment.EnteredBy = $"ref:${treatment.EventType}";
            treatment.Key = key;
            Treatments.Add(treatment);

            return(treatment);
        }
Esempio n. 6
0
        private Treatment CreateAnnouncement(string note, DateTime createdAt, string reference, string key)
        {
            Treatment treatment = new Treatment();

            treatment.EventType  = "Announcement";
            treatment.Created_at = createdAt.ToString(Constants.Dateformat);
            treatment.Notes      = note;
            treatment.Key        = key;
            //treatment.EnteredBy = $"ref:${reference}";
            Treatments.Add(treatment);
            return(treatment);
        }
Esempio n. 7
0
        private Treatment CreateTempBasalProgrammed(DateTime createdAt, string key)
        {
            Treatment treatment = new Treatment();

            treatment.EventType  = "Temp Basal";
            treatment.Created_at = createdAt.ToString(Constants.Dateformat);
            ////treatment.EnteredBy = $"ref:${treatment.EventType}";
            treatment.Key = key;
            Treatments.Add(treatment);

            return(treatment);
        }
Esempio n. 8
0
        private void CreateExercise(string note, DateTime createdAt, string key, Int16 duration)
        {
            Treatment treatment = new Treatment();

            treatment.EventType  = "Exercise";
            treatment.Created_at = createdAt.ToString(Constants.Dateformat);
            treatment.Duration   = duration.ToString();
            treatment.Notes      = note;
            treatment.Key        = key;

            Treatments.Add(treatment);
        }
Esempio n. 9
0
 public void AddTreatment(Treatment treatment)
 {
     Treatments.Add(treatment);
 }