Example #1
0
        void findWarnings()
        {
            warning.Clear();

            //Measurement Anonamlies
            DateTime maxDateofWeight = CurrentChild.Measurements.weightData.Keys.Count == 0 ? DateTime.MinValue : CurrentChild.Measurements.weightData.Keys.Max();
            DateTime maxDateofHeight = CurrentChild.Measurements.heightData.Keys.Count == 0 ? DateTime.MinValue : CurrentChild.Measurements.heightData.Keys.Max();
            DateTime maxDateofHead   = CurrentChild.Measurements.headCircumferenceData.Keys.Count == 0 ? DateTime.MinValue : CurrentChild.Measurements.headCircumferenceData.Keys.Max();

            // Update weights
            double  wt   = maxDateofWeight == DateTime.MinValue ? -1 : CurrentChild.GetMeasurementForDateAndType(maxDateofWeight, MeasurementType.WEIGHT).Value;
            double  ht   = maxDateofHeight == DateTime.MinValue ? -1 : CurrentChild.GetMeasurementForDateAndType(maxDateofHeight, MeasurementType.HEIGHT).Value;
            double  hd   = maxDateofHead == DateTime.MinValue ? -1 : CurrentChild.GetMeasurementForDateAndType(maxDateofHead, MeasurementType.HEAD_CIRCUMFERENCE).Value;
            WHOData data = new WHOData();

            if (wt != -1)
            {
                Tuple <double, double> acceptable = acceptableRange(data.weightPercentile);
                if (wt < acceptable.Item1)
                {
                    if (CurrentContext.CurrentLanguage == Language.ENGLISH)
                    {
                        warning.Add(new Warning {
                            WarningName = CurrentChild.Name + " " + "is under the 5th percentile in weight"
                        });
                    }
                    else
                    {
                        warning.Add(new Warning {
                            WarningName = CurrentChild.Name + " " + "está bajo el 5 por ciento en peso"
                        });
                    }
                }

                if (wt > acceptable.Item2)
                {
                    if (CurrentContext.CurrentLanguage == Language.ENGLISH)
                    {
                        warning.Add(new Warning {
                            WarningName = CurrentChild.Name + " " + "is over the 95th percentile in weight"
                        });
                    }
                    else
                    {
                        warning.Add(new Warning {
                            WarningName = CurrentChild.Name + " " + "está sobre el 95 por ciento en peso"
                        });
                    }
                }
            }


            if (ht != -1)
            {
                Tuple <double, double> acceptable = acceptableRange(data.heightPercentile);
                if (ht < acceptable.Item1)
                {
                    if (CurrentContext.CurrentLanguage == Language.ENGLISH)
                    {
                        warning.Add(new Warning {
                            WarningName = CurrentChild.Name + " " + "is under the 5th percentile in height"
                        });
                    }
                    else
                    {
                        warning.Add(new Warning {
                            WarningName = CurrentChild.Name + " " + "está bajo el 5 por ciento en estatura"
                        });
                    }
                }
            }

            if (hd != -1)
            {
                Tuple <double, double> acceptable = acceptableRange(data.headPercentile);
                if (hd < acceptable.Item1)
                {
                    if (CurrentContext.CurrentLanguage == Language.ENGLISH)
                    {
                        warning.Add(new Warning {
                            WarningName = CurrentChild.Name + " " + "is under the 5th percentile in head circumference"
                        });
                    }
                    else
                    {
                        warning.Add(new Warning {
                            WarningName = CurrentChild.Name + " " + "está bajo el 5 por ciento en circunferencia de cabeza"
                        });
                    }
                }

                if (hd > acceptable.Item2)
                {
                    if (CurrentContext.CurrentLanguage == Language.ENGLISH)
                    {
                        warning.Add(new Warning {
                            WarningName = CurrentChild.Name + " " + "is over the 95th percentile in head circumference"
                        });
                    }
                    else
                    {
                        warning.Add(new Warning {
                            WarningName = CurrentChild.Name + " " + "está sobre el 95 por ciento en circunferencia de cabeza"
                        });
                    }
                }
            }
        }
Example #2
0
        private void updateFields()
        {
            if (CurrentChild == null)
            {
                childBirthday.Text                = "NaN";
                heightMeasurement.Text            = "NaN";
                weightMeasurement.Text            = "NaN";
                headCircumferenceMeasurement.Text = "NaN";
                MeasurementsAlert.Text            = "N/A";
                milestonesAlert.Text              = "N/A";
                vaccinationsAlert.Text            = "N/A";
                emotionalAndSocial.Text           = "0%";
                physicalGrowth.Text               = "0%";
                LanguageDevelopment.Text          = "0%";
                ThinkingAndReasoning.Text         = "0%";

                progressBar1.Progress = 0;
                warning.Clear();
            }
            else
            {
                // Get last input dates

                DateTime maxDateofWeight = CurrentChild.Measurements.weightData.Keys.Count == 0 ? DateTime.MinValue : CurrentChild.Measurements.weightData.Keys.Max();
                DateTime maxDateofHeight = CurrentChild.Measurements.heightData.Keys.Count == 0 ? DateTime.MinValue : CurrentChild.Measurements.heightData.Keys.Max();
                DateTime maxDateofHead   = CurrentChild.Measurements.headCircumferenceData.Keys.Count == 0 ? DateTime.MinValue : CurrentChild.Measurements.headCircumferenceData.Keys.Max();

                // Check if these dates matches today
                if (maxDateofHead.Date == DateTime.Today.Date &&
                    maxDateofHeight.Date == DateTime.Today.Date &&
                    maxDateofWeight.Date == DateTime.Today.Date)
                {
                    measurementsImage.Source = "check_1";
                    if (CurrentContext.CurrentLanguage == Language.ENGLISH)
                    {
                        MeasurementsAlert.Text = "All Measurements Completed For Today";
                    }
                    else
                    {
                        MeasurementsAlert.Text = "Todas las medidas estan al día";
                    }
                }

                // Check if Milestones Completed
                List <Milestone> milestoneList = CurrentChild.GetListOfDueMilestones();
                if (milestoneList == null || milestoneList.Count == 1)
                {
                    milestonesImage.Source = "check_1";
                    if (CurrentContext.CurrentLanguage == Language.ENGLISH)
                    {
                        milestonesAlert.Text = "All Milestones Completed For Today";
                    }
                    else
                    {
                        milestonesAlert.Text = "Todos los Alcances estan al día";
                    }
                }
                else
                {
                    int count = milestoneList.Count - 1;
                    if (CurrentContext.CurrentLanguage == Language.ENGLISH)
                    {
                        milestonesAlert.Text = count.ToString() + " milestones unanswered";
                    }
                    else
                    {
                        milestonesAlert.Text = count.ToString() + " Alcances sin responder";
                    }
                }

                //Check if Vaccination Completed
                List <Vaccine> vaccineList = CurrentChild.GetListOfDueVaccines();
                if (vaccineList == null || vaccineList.Count == 0)
                {
                    vaccinationsImage.Source = "check_1";
                    if (CurrentContext.CurrentLanguage == Language.ENGLISH)
                    {
                        vaccinationsAlert.Text = "All Vaccinations Completed For Today";
                    }
                    else
                    {
                        vaccinationsAlert.Text = "Todas las vacunas estan al día";
                    }
                }
                else
                {
                    if (CurrentContext.CurrentLanguage == Language.ENGLISH)
                    {
                        vaccinationsAlert.Text = vaccineList.Count.ToString() + " vaccinations pending";
                    }
                    else
                    {
                        vaccinationsAlert.Text = vaccineList.Count.ToString() + " vacunas pendientes";
                    }
                }
                childBirthday.Text = CurrentChild.Birthday.ToString();

                /*
                 * if (CurrentContext.CurrentUnits.DistanceUnits == DistanceUnits.CM)
                 * {
                 *  weightMeasurement.Text = maxDateofWeight == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofWeight, MeasurementType.WEIGHT).Value.ToString() + " oz";
                 *  heightMeasurement.Text = maxDateofHeight == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofHeight, MeasurementType.HEIGHT).Value.ToString() + " cm";
                 *  headCircumferenceMeasurement.Text = maxDateofHead == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofHead, MeasurementType.HEAD_CIRCUMFERENCE).Value.ToString() + " cm";
                 * }
                 * else
                 * {
                 */
                weightMeasurement.Text            = maxDateofWeight == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofWeight, MeasurementType.WEIGHT).Value.ToString() + " lbs";
                heightMeasurement.Text            = maxDateofHeight == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofHeight, MeasurementType.HEIGHT).Value.ToString() + " in";
                headCircumferenceMeasurement.Text = maxDateofHead == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofHead, MeasurementType.HEAD_CIRCUMFERENCE).Value.ToString() + " in";

                childBirthday.Text = CurrentChild.Birthday.ToString();

                // Update weights
                weightMeasurement.Text            = maxDateofWeight == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofWeight, MeasurementType.WEIGHT).Value.ToString() + " oz";
                heightMeasurement.Text            = maxDateofHeight == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofHeight, MeasurementType.HEIGHT).Value.ToString() + " cm";
                headCircumferenceMeasurement.Text = maxDateofHead == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofHead, MeasurementType.HEAD_CIRCUMFERENCE).Value.ToString() + " cm";

                Dictionary <Models.MilestoneCategory, List <MilestoneWithResponse> > milestonesPercDict = CurrentChild.GetMilestoneHistory();

                List <MilestoneWithResponse> socialMilestones;
                List <MilestoneWithResponse> cognitiveMilestones;
                List <MilestoneWithResponse> commMilestones;
                List <MilestoneWithResponse> movementMilestones;

                milestonesPercDict.TryGetValue(Models.MilestoneCategory.SOCIAL_AND_EMOTIONAL, out socialMilestones);
                milestonesPercDict.TryGetValue(Models.MilestoneCategory.COGNITIVE, out cognitiveMilestones);
                milestonesPercDict.TryGetValue(Models.MilestoneCategory.COMMUNICATION, out commMilestones);
                milestonesPercDict.TryGetValue(Models.MilestoneCategory.MOVEMENT, out movementMilestones);

                emotionalAndSocial.Text   = returnMilestonesPerc(socialMilestones).ToString() + "%";
                physicalGrowth.Text       = returnMilestonesPerc(movementMilestones).ToString() + "%";
                LanguageDevelopment.Text  = returnMilestonesPerc(commMilestones).ToString() + "%";
                ThinkingAndReasoning.Text = returnMilestonesPerc(cognitiveMilestones).ToString() + "%";

                progressBar1.Progress = CurrentChild.GetVaccinationCompletionPercentage();

                listView1.ItemsSource = warning;
                TimeSpan diff = DateTime.Today.Date - CurrentChild.Birthday.Date;
                if (diff.Days < 365 * 3 && diff.Days > 0)
                {
                    warning.Clear();
                    findWarnings();
                }

                if (warning.Count == 0)
                {
                    warning.Add(new Warning {
                        WarningName = "No Warnings to show"
                    });
                }
            }
        }