Exemplo n.º 1
0
        //private void SetBloodPressureValues(AwvAbiTestResult testResult, DataRow dr)
        //{
        //    bool isRight = true;
        //    if (!IsDataRowItemEmpty(dr[ColumnArmPressure]))
        //    {
        //        if (dr[ColumnArmPressure].ToString().Trim().ToLower().Equals("left"))
        //            isRight = false;
        //    }

        //    if (!IsDataRowItemEmpty(dr[ColumnSystolic]) || !IsDataRowItemEmpty(dr[ColumnDiastolic]))
        //        testResult.PressureReadings = new CardiovisionPressureReadings();

        //    try
        //    {
        //        if (!IsDataRowItemEmpty(dr[ColumnSystolic]))
        //        {
        //            int s = 0;
        //            if (int.TryParse(dr[ColumnSystolic].ToString(), out s))
        //            {
        //                if (!isRight)
        //                {
        //                    testResult.PressureReadings.SystolicLeftArm = new ResultReading<int?>(ReadingLabels.SystolicLeft)
        //                    {
        //                        ReadingSource = ReadingSource.Automatic,
        //                        Reading = s
        //                    };
        //                }
        //                else
        //                {
        //                    testResult.PressureReadings.SystolicRightArm = new ResultReading<int?>(ReadingLabels.SystolicRight)
        //                    {
        //                        ReadingSource = ReadingSource.Automatic,
        //                        Reading = s
        //                    };
        //                }
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        _errorSummary += "Data extraction for BP Systolic failed. ";
        //        _logger.Error("\n Data extraction for BP Systolic failed! Error: " + ex.Message + "\n\t\t" + ex.StackTrace);
        //    }


        //    try
        //    {
        //        if (!IsDataRowItemEmpty(dr[ColumnDiastolic]))
        //        {
        //            int s = 0;
        //            if (int.TryParse(dr[ColumnDiastolic].ToString(), out s))
        //            {
        //                if (!isRight)
        //                {
        //                    testResult.PressureReadings.DiastolicLeftArm = new ResultReading<int?>(ReadingLabels.DiastolicLeft)
        //                    {
        //                        ReadingSource = ReadingSource.Automatic,
        //                        Reading = s
        //                    };
        //                }
        //                else
        //                {
        //                    testResult.PressureReadings.DiastolicRightArm = new ResultReading<int?>(ReadingLabels.DiastolicRight)
        //                    {
        //                        ReadingSource = ReadingSource.Automatic,
        //                        Reading = s
        //                    };
        //                }
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        _errorSummary += "Data extraction for BP Systolic failed. ";
        //        _logger.Error("\n Data extraction for BP Systolic failed! Error: " + ex.Message + "\n\t\t" + ex.StackTrace);
        //    }

        //}

        private StandardFinding <decimal> GetAwvAbiFindingToConsider(long leftFindingId, long rightFindingId)
        {
            if (leftFindingId == 0 && rightFindingId == 0)
            {
                return(null);
            }

            var allFindings = _testResultService.GetAllStandardFindings <decimal>((int)TestType.AwvABI);

            var leftFinding  = leftFindingId > 0 ? allFindings.Where(f => f.Id == leftFindingId).SingleOrDefault() : null;
            var rightFinding = rightFindingId > 0 ? allFindings.Where(f => f.Id == rightFindingId).SingleOrDefault() : null;

            if (leftFinding == null && rightFinding == null)
            {
                return(null);
            }

            if (leftFinding == null)
            {
                return(rightFinding);
            }
            if (rightFinding == null)
            {
                return(leftFinding);
            }

            return(leftFinding.WorstCaseOrder > rightFinding.WorstCaseOrder ? leftFinding : rightFinding);
        }
Exemplo n.º 2
0
        private void GetAaaSaggitalView(AAATestResult testResult, XDocument xDoc)
        {
            try
            {
                var aoProxSag = GetValuefromXmlDoc(xDoc, ViewLocProx, ViewtypeSag);
                var aoMidSag  = GetValuefromXmlDoc(xDoc, ViewLocMid, ViewtypeSag);
                var aoDistSag = GetValuefromXmlDoc(xDoc, ViewLocDist, ViewtypeSag);

                if (aoProxSag != null || aoMidSag != null || aoDistSag != null)
                {
                    IEnumerable <string> viewLocs;
                    var aortaValue = GetMaximumOfThree(aoProxSag ?? 0, aoMidSag ?? 0, aoDistSag ?? 0, out viewLocs);

                    if (aortaValue != null)
                    {
                        if (_aaaReadings.Where(r => r.Label == ReadingLabels.AortaSize).Count() > 0)
                        {
                            testResult.AortaSize = new ResultReading <decimal?>(ReadingLabels.AortaSize)
                            {
                                Reading       = Decimal.Round(aortaValue.Value, 2),
                                ReadingSource = ReadingSource.Automatic
                            };
                        }

                        if (viewLocs != null && viewLocs.Count() > 0 && _aaaReadings.Where(r => r.Label == ReadingLabels.AortaRangeSaggitalView).Count() > 0)
                        {
                            var sagViewFindings = _testResultService.GetAllStandardFindings <int>((int)TestType.AAA, (int)ReadingLabels.AortaRangeSaggitalView);

                            testResult.AortaRangeSaggitalView = new List <StandardFinding <int> >();
                            foreach (string viewLoc in viewLocs)
                            {
                                var finding = sagViewFindings.Where(s => s.Label.ToLower().Contains(viewLoc)).SingleOrDefault();
                                if (finding != null)
                                {
                                    testResult.AortaRangeSaggitalView.Add(finding);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _errorSummary += "Measurement for Saggital View could not be extracted. ";
                _logger.Error("\n Measurement for Saggital View could not be extracted. Error: " + ex.Message + "\n\t\t" + ex.StackTrace);
            }
        }
Exemplo n.º 3
0
        private void GetSaggitalView(AAATestResult testResult, DataTable dtSourceFromExcel)
        {
            try
            {
                decimal?aoDistal = GetAortaValueforSaggital(dtSourceFromExcel, ConstForDist);
                decimal?aoProx   = GetAortaValueforSaggital(dtSourceFromExcel, ConstForProx);
                decimal?aoMid    = GetAortaValueforSaggital(dtSourceFromExcel, ConstForMid);

                if (aoDistal == null && aoMid == null && aoProx == null)
                {
                    _logger.Info("\n\tData for Saggital view not found.");
                    return;
                }

                IEnumerable <string> viewLocs = null;
                var value = GetMaximumOfThree(aoProx ?? 0, aoMid ?? 0, aoDistal ?? 0, out viewLocs);

                if (value == null || viewLocs == null || viewLocs.Count() < 1)
                {
                    return;
                }

                testResult.AortaSize = new ResultReading <decimal?>(ReadingLabels.AortaSize)
                {
                    Reading       = Decimal.Round(value.Value, 2),
                    ReadingSource = ReadingSource.Automatic
                };

                var sagViewFindings = _testResultService.GetAllStandardFindings <int>((int)TestType.AAA, (int)ReadingLabels.AortaRangeSaggitalView);
                testResult.AortaRangeSaggitalView = new List <StandardFinding <int> >();
                foreach (string viewLoc in viewLocs)
                {
                    var finding =
                        sagViewFindings.Where(s => s.Label.ToLower().Contains(viewLoc)).SingleOrDefault();
                    if (finding != null)
                    {
                        testResult.AortaRangeSaggitalView.Add(finding);
                    }
                }
            }
            catch (Exception ex)
            {
                _errorSummary += "Measurement for Saggital View could not be extracted. ";
                _logger.Error("\n Measurement for Saggital View could not be extracted. Error: " + ex.Message + "\n\t\t" + ex.StackTrace);
            }
        }
Exemplo n.º 4
0
        private CompoundResultReading <string> GetResultReadingHdl(string reading, int?readingForFinding, long customerId, TestType type, ref string errorSummary)
        {
            try
            {
                var resultReading = new CompoundResultReading <string>
                {
                    Label         = ReadingLabels.HDL,
                    ReadingSource = ReadingSource.Automatic,
                    Reading       = reading
                };

                string gender   = string.Empty;
                var    customer = _customerRepository.GetCustomer(customerId);
                if (customer.Gender == Gender.Male)
                {
                    gender = Gender.Male.ToString();
                }
                else if (customer.Gender == Gender.Female)
                {
                    gender = Gender.Female.ToString();
                }

                if (readingForFinding != null && !string.IsNullOrEmpty(gender))
                {
                    var findings = _testResultService.GetAllStandardFindings <int?>((int)type, (int)ReadingLabels.HDL);

                    var specificFindings = findings.Where(x => x.Label.ToLower().StartsWith(gender.ToLower())).ToList();

                    resultReading.Finding = new StandardFinding <string>(_testResultService.GetCalculatedStandardFinding(readingForFinding, (int)type, (int)ReadingLabels.HDL, specificFindings));
                }

                return(resultReading);
            }
            catch (Exception ex)
            {
                string message = string.Format("Exception while extracting value for {0}. Message: {1} ", ReadingLabels.HDL, ex.Message);
                _logger.Error(message);
                errorSummary += message;
            }

            return(null);
        }
Exemplo n.º 5
0
        private void GetAwvAaaTransverseViewValues(AwvAaaTestResult testResult, XDocument xDoc)
        {
            try
            {
                var aoProxTran1 = GetValuefromXmlDoc(xDoc, ViewLocProx, ViewtypeTran, "1");
                var aoMidTran1  = GetValuefromXmlDoc(xDoc, ViewLocMid, ViewtypeTran, "1");
                var aoDistTran1 = GetValuefromXmlDoc(xDoc, ViewLocDist, ViewtypeTran, "1");

                var aoProxTran2 = GetValuefromXmlDoc(xDoc, ViewLocProx, ViewtypeTran, "2");
                var aoMidTran2  = GetValuefromXmlDoc(xDoc, ViewLocMid, ViewtypeTran, "2");
                var aoDistTran2 = GetValuefromXmlDoc(xDoc, ViewLocDist, ViewtypeTran, "2");

                IEnumerable <string> viewLocs2;
                decimal?aortaValue2;
                decimal?aortaValue1 = aortaValue2 = null;
                var     viewLocs1   = viewLocs2 = null;

                if (aoProxTran1 != null || aoMidTran1 != null || aoDistTran1 != null)
                {
                    aortaValue1 = GetMaximumOfThree(aoProxTran1 ?? 0, aoMidTran1 ?? 0, aoDistTran1 ?? 0, out viewLocs1);
                }

                if (aoProxTran2 != null || aoMidTran2 != null || aoDistTran2 != null)
                {
                    aortaValue2 = GetMaximumOfThree(aoProxTran2 ?? 0, aoMidTran2 ?? 0, aoDistTran2 ?? 0, out viewLocs2);
                }

                if (aortaValue1 != null || aortaValue2 != null)
                {
                    IEnumerable <string> viewLocs;
                    decimal?aortaValue;
                    if ((aortaValue1 ?? 0) > (aortaValue2 ?? 0))
                    {
                        aortaValue = aortaValue1;
                        viewLocs   = viewLocs1;
                    }
                    else
                    {
                        aortaValue = aortaValue2;
                        viewLocs   = viewLocs2;
                    }

                    if (aortaValue != null)
                    {
                        testResult.TransverseView = new OrderedPair <ResultReading <decimal?>, ResultReading <decimal?> >();

                        if (_awvAaaReadings.Any(r => r.Label == ReadingLabels.TransverseViewDataPointOne))
                        {
                            testResult.TransverseView.FirstValue =
                                new ResultReading <decimal?>(ReadingLabels.TransverseViewDataPointOne)
                            {
                                ReadingSource = ReadingSource.Automatic
                            };
                        }

                        if (_awvAaaReadings.Any(r => r.Label == ReadingLabels.TransverseViewDataPointTwo))
                        {
                            testResult.TransverseView.SecondValue =
                                new ResultReading <decimal?>(ReadingLabels.TransverseViewDataPointTwo)
                            {
                                ReadingSource = ReadingSource.Automatic
                            };
                        }
                    }

                    if (viewLocs != null && viewLocs.Any())
                    {
                        if (viewLocs.ElementAt(0) == ViewLocProx)
                        {
                            testResult.TransverseView.FirstValue.Reading  = aoProxTran1.HasValue ? (decimal?)decimal.Round(aoProxTran1.Value, 2) : null;
                            testResult.TransverseView.SecondValue.Reading = aoProxTran2.HasValue ? (decimal?)decimal.Round(aoProxTran2.Value, 2) : null;
                        }
                        else if (viewLocs.ElementAt(0) == ViewLocDist)
                        {
                            testResult.TransverseView.FirstValue.Reading  = aoDistTran1.HasValue ? (decimal?)decimal.Round(aoDistTran1.Value, 2) : null;
                            testResult.TransverseView.SecondValue.Reading = aoDistTran2.HasValue ? (decimal?)decimal.Round(aoDistTran2.Value, 2) : null;
                        }
                        else if (viewLocs.ElementAt(0) == ViewLocMid)
                        {
                            testResult.TransverseView.FirstValue.Reading  = aoMidTran1.HasValue ? (decimal?)decimal.Round(aoMidTran1.Value, 2) : null;
                            testResult.TransverseView.SecondValue.Reading = aoMidTran2.HasValue ? (decimal?)decimal.Round(aoMidTran2.Value, 2) : null;
                        }

                        if (_awvAaaReadings.Any(r => r.Label == ReadingLabels.AortaRangeTransverseView))
                        {
                            var transViewFindings = _testResultService.GetAllStandardFindings <int>((int)TestType.AwvAAA, (int)ReadingLabels.AortaRangeTransverseView);
                            testResult.AortaRangeTransverseView = new List <StandardFinding <int> >();

                            foreach (string viewLoc in viewLocs)
                            {
                                var finding = transViewFindings.SingleOrDefault(s => s.Label.ToLower().Contains(viewLoc));

                                if (finding != null)
                                {
                                    testResult.AortaRangeTransverseView.Add(finding);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _errorSummary += "Datapoints for Transverse View could not be extracted. ";
                _logger.Error("\n Datapoints for Transverse View could not be extracted." + ex.Message + "\n\t\t" + ex.StackTrace);
            }
        }