private double GetMeasurementAge(GrowthMeasurement measurement) { DateTime measurementDate = measurement.DateRecorded; TimeSpan diff = measurementDate - this.Birthday; double months = diff.TotalDays / approx_days_per_month; return(months); }
public List <GrowthMeasurement> GetFittedData(List <GrowthMeasurement> data) { Range xRange = new Range(GrowthRangeType.Time, data.Max(m => m.Time), data.Min(m => m.Time)); Range yRange = new Range(GrowthRangeType.OD, data.Max(m => m.OD), data.Min(m => m.OD));; SearchSolution(xRange, yRange, data); var temp = new List <GrowthMeasurement>(); for (int i = 0; i < _soultion.GetLength(0); i++) { var fittedMeasurement = new GrowthMeasurement((float)_soultion[i, 0], (float)_soultion[i, 1]); temp.Add(fittedMeasurement); } return(temp); }
/** * Add measurement corresponding to the input DateTime and MeasurementType. */ public void AddMeasurementForDateAndType(DateTime date, MeasurementType measurementType, Units currentUnits, double value) { //Dictionary<DateTime, GrowthMeasurement> measurementDictionary = measurementTypeMap[measurementType]; MeasurementFactory measurementFactory = new MeasurementFactory(); GrowthMeasurement measurement = measurementFactory.CreateMeasurement(date, measurementType, currentUnits, value); //measurementDictionary.Add(date, measurement); switch (measurementType) { case MeasurementType.HEIGHT: heightData[date] = (HeightMeasurement)measurement; break; case MeasurementType.WEIGHT: weightData[date] = (WeightMeasurement)measurement; break; case MeasurementType.HEAD_CIRCUMFERENCE: headCircumferenceData[date] = (HeadCircumferenceMeasurement)measurement; break; } }
public NutritionChartControl(DashboardHelper dashboardHelper, GrowthMeasurement measurement, GrowthReference reference) { InitializeComponent(); this.measurement = measurement; this.reference = reference; this.dashboardHelper = dashboardHelper; Construct(); }
/// <summary> /// Creates the charting gadget from an Xml element /// </summary> /// <param name="element">The element from which to create the gadget</param> public void CreateFromXml(XmlElement element) { this.loadingCombos = true; foreach (XmlElement child in element.ChildNodes) { switch (child.Name.ToLower()) { case "measurement": measurement = ((GrowthMeasurement)Int32.Parse(child.InnerText)); break; case "reference": reference = ((GrowthReference)Int32.Parse(child.InnerText)); break; case "patientidfield": cbxPatientIdField.Text = child.InnerText; break; case "patientidvalue": cbxPatientId.Text = child.InnerText; break; case "genderfield": cbxGenderField.Text = child.InnerText; break; case "heightfield": cbxHeightField.Text = child.InnerText; break; case "weightfield": cbxWeightField.Text = child.InnerText; break; case "agefield": cbxAgeField.Text = child.InnerText; break; case "measurementfield": cbxMeasurementField.Text = child.InnerText; break; case "showlegend": if (child.InnerText.ToLower().Equals("true")) { checkboxShowLegend.IsChecked = true; } else { checkboxShowLegend.IsChecked = false; } break; case "showtallchart": if (child.InnerText.ToLower().Equals("true")) { checkboxShowTallChart.IsChecked = true; } else { checkboxShowTallChart.IsChecked = false; } break; case "blackandwhitecurves": if (child.InnerText.ToLower().Equals("true")) { checkboxBlackAndWhite.IsChecked = true; } else { checkboxBlackAndWhite.IsChecked = false; } break; } } foreach (XmlAttribute attribute in element.Attributes) { switch (attribute.Name.ToLower()) { case "top": Canvas.SetTop(this, double.Parse(attribute.Value)); break; case "left": Canvas.SetLeft(this, double.Parse(attribute.Value)); break; } } this.loadingCombos = false; SetReference(); SetMeasurement(); RefreshResults(); CollapseExpandConfigPanel(); }
public static ExperimentalRun ImportBioscreenFile(string fileFullPath) { var reader = ReadAsLines(fileFullPath); var experimenRun = new ExperimentalRun(Path.GetFileName(fileFullPath)); if (reader == null) { throw new Exception("No Data"); } var fileType = GetFileType(reader, fileFullPath); experimenRun.FileType = fileType; if (fileType == BioscreenFileType.Other) { throw new Exception("Invalid file extension"); } experimenRun.Name = GetRunName(reader, fileType); experimenRun.CreationDate = File.GetCreationTime(fileFullPath); var headers = GetHeaders(reader, fileType); var records = GetRecords(reader, fileType); var wells = GetWellQueue(headers, fileType); int counter = 0; foreach (var record in records) { counter += 1; if (string.IsNullOrEmpty(record.Trim())) { continue; } var rowWellMeasurement = GetRowWellMeasurements(record, fileType); int time = GetTimeInSeconds(rowWellMeasurement[0], fileType); var rowToSkip = GetRowsToSkip(fileType); foreach (string item in rowWellMeasurement.Skip(rowToSkip)) { var well = wells.Dequeue(); if (item == string.Empty) { wells.Enqueue(well); continue; } float od = GetOD(item); if (od == 0) { wells.Enqueue(well); continue; } if (experimenRun.Run.ElementAtOrDefault(well.Index - 1) != null) { var measurement = new GrowthMeasurement { OD = od, Time = time }; experimenRun.Run[well.Index - 1].GrowthMeasurements.GetMeasurements(DataType.Raw).Add(measurement); } else { var measurements = new List <GrowthMeasurement>(); var measurement = new GrowthMeasurement { OD = od, Time = time }; measurements.Add(measurement); experimenRun.Run.Add(new Culture(well.Index, well.Name, measurements)); } wells.Enqueue(well); } } return(experimenRun); }