internal static void ParseAndMapLaboratoryNumber(IsolateCommon source, IsolateCommon destination) { var decadeAndNumber = source.LaboratoryNumber.Split('/'); int.TryParse(decadeAndNumber[0], out var yearlySequentialIsolateNumber); int.TryParse(decadeAndNumber[1], out var decade); destination.Year = DateTime.Now.Year / 100 * 100 + decade; destination.YearlySequentialIsolateNumber = yearlySequentialIsolateNumber; }
private static void FillAntibiotic(IsolateCommon isolate, double?legacyMeasurement, DateTime receivingDate, Antibiotic antibiotic) { var db = Program.Context; if (!legacyMeasurement.HasValue) { return; } var measurement = (float)legacyMeasurement.Value; var minDate = db.EucastClinicalBreakpoints.OrderByDescending(e => e.ValidFrom).Where(e => e.Antibiotic == antibiotic && e.ValidFor == DatabaseType.Meningococci) .Min(e => e.ValidFrom); var eTestBreakPoint = db.EucastClinicalBreakpoints.OrderByDescending(e => e.ValidFrom) .First(e => (e.ValidFrom <= receivingDate || e.ValidFrom == minDate) && e.Antibiotic == antibiotic && e.ValidFor == DatabaseType.Meningococci); EpsilometerTestResult result; if (measurement > eTestBreakPoint.MicBreakpointResistent) { result = EpsilometerTestResult.Resistant; } else if (measurement <= eTestBreakPoint.MicBreakpointSusceptible) { result = EpsilometerTestResult.Susceptible; } else { result = EpsilometerTestResult.Intermediate; } var eTest = new EpsilometerTest { EucastClinicalBreakpoint = eTestBreakPoint, Measurement = measurement, Result = result }; isolate.EpsilometerTests.Add(eTest); }