public BasicBiometric GetBasicTestResultBiometricDomain(KynHealthAssessmentEditModel model, BasicBiometric inpersistence, long uploadedby)
        {
            if (inpersistence == null)
            {
                inpersistence = new BasicBiometric
                {
                    SystolicPressure        = model.SystolicPressure,
                    DiastolicPressure       = model.DiastolicPressure,
                    PulseRate               = model.PulseRate,
                    CreatedByOrgRoleUserId  = uploadedby,
                    CreatedOn               = DateTime.Now,
                    IsBloodPressureElevated = (model.SystolicPressure.HasValue && model.SystolicPressure.Value >= SystolicAbnormalValue) ||
                                              (model.DiastolicPressure.HasValue && model.DiastolicPressure.Value >= DiastolicAbnormalValue)
                };
            }
            else
            {
                inpersistence.SystolicPressure        = model.SystolicPressure;
                inpersistence.DiastolicPressure       = model.DiastolicPressure;
                inpersistence.PulseRate               = model.PulseRate;
                inpersistence.CreatedByOrgRoleUserId  = uploadedby;
                inpersistence.CreatedOn               = DateTime.Now;
                inpersistence.IsBloodPressureElevated = (model.SystolicPressure.HasValue && model.SystolicPressure.Value >= SystolicAbnormalValue) ||
                                                        (model.DiastolicPressure.HasValue && model.DiastolicPressure.Value >= DiastolicAbnormalValue);
            }

            return(inpersistence);
        }
        private void SaveBasicBiometric(DataRow dr)
        {
            var systolicRight  = GetDataReading(ColumnForSystolicRight, dr);
            var systolicLeft   = GetDataReading(ColumnForSystolicLeft, dr);
            var diastolicRight = GetDataReading(ColumnForDiastolicRight, dr);
            var diastolicLeft  = GetDataReading(ColumnForDiastolicLeft, dr);

            if (systolicLeft == null && systolicRight == null && diastolicLeft == null && diastolicRight == null)
            {
                return;
            }

            var funcIscomplete = new Func <int?, int?, bool>((a, b) => a != null && b != null);
            var funcIsPartial  = new Func <int?, int?, bool>((a, b) => a != null || b != null);

            var isLeftComplete  = funcIscomplete(systolicLeft, diastolicLeft);
            var isRightComplete = funcIscomplete(systolicRight, diastolicRight);
            var isLeftPartial   = funcIsPartial(systolicLeft, diastolicLeft);
            var isRightPartial  = funcIsPartial(systolicRight, diastolicRight);

            if (!isLeftPartial && !isLeftComplete && !isRightPartial && !isRightComplete)
            {
                return;
            }

            var eventCustomer = _eventCustomerRepository.Get(_eventId, _customerId);
            var biometric     = new BasicBiometric
            {
                Id = eventCustomer.Id,
                SystolicPressure        = systolicRight,
                DiastolicPressure       = diastolicRight,
                IsRightArmBpMeasurement = true,
                CreatedByOrgRoleUserId  = _updatedBy,
                CreatedOn = DateTime.Now
            };

            if (!isRightComplete && isLeftComplete)
            {
                biometric.SystolicPressure  = systolicLeft;
                biometric.DiastolicPressure = diastolicLeft;
            }
            _basicBiometricRepository.Save(biometric);
        }
Esempio n. 3
0
        private void ParseDataForHypertension(long customerId, BasicBiometric basicBiometric)
        {
            var isTestPurchased = _testResultService.IsTestPurchasedByCustomer(_eventId, customerId, (long)TestType.Hypertension);

            try
            {
                if (isTestPurchased)
                {
                    var testResult = new HypertensionTestResult
                    {
                        Systolic = new ResultReading <int?> {
                            Reading = basicBiometric.SystolicPressure
                        },
                        Diastolic = new ResultReading <int?> {
                            Reading = basicBiometric.DiastolicPressure
                        },
                        RightArmBpMeasurement = new ResultReading <bool> {
                            Reading = basicBiometric.IsRightArmBpMeasurement
                        },
                        BloodPressureElevated = new ResultReading <bool> {
                            Reading = basicBiometric.SystolicPressure >= 140 || basicBiometric.DiastolicPressure >= 90
                        }
                    };

                    _resultParserHelper.AddTestResulttoEventCustomerAggregate(_eventCustomerScreeningAggregates, _eventId, customerId, testResult);
                    _resultParserHelper.AddResultArchiveLog(_kynAppLipidParser.ErrorSummary, TestType.Hypertension, customerId, MedicalEquipmentTag.Bloodworks, true);
                }
                else
                {
                    _logger.Info(string.Format("Hypertension is not availed by Customer : [{0}]", customerId));
                }
            }
            catch (Exception exception)
            {
                _logger.Error(string.Format("Some error occured while parsing data of Hypertension Test for customerId {0} and event Id {1} \nMessage:{2} \nStack Trace: {3}", customerId, _eventId, exception.Message, exception.StackTrace));
            }
        }
Esempio n. 4
0
        private void SetLabValus(List <BioCheckResponseModel> bioCheckResponse, MyBioAssessmentTestResult testResult, KynLabValues kynLabValues, BasicBiometric basicBiometric, Customer customer)
        {
            if (testResult.TotalCholestrol != null)
            {
                if (testResult.TotalCholestrol.Reading != null)
                {
                    bioCheckResponse.Add(new BioCheckResponseModel("Q11", testResult.TotalCholestrol.Reading)); //;
                }
            }
            if (testResult.Hdl != null)
            {
                if (testResult.Hdl.Reading != null)
                {
                    bioCheckResponse.Add(new BioCheckResponseModel("Q12", testResult.Hdl.Reading));
                }
                // testResult.HDL.Reading;
            }

            if (testResult.Ldl != null)
            {
                if (testResult.Ldl.Reading != null)
                {
                    bioCheckResponse.Add(new BioCheckResponseModel("Q13", testResult.Ldl.Reading.Value.ToString()));
                }
                // testResult.LDL.Reading.ToString();
            }

            if (testResult.TcHdlRatio != null)
            {
                if (testResult.TcHdlRatio.Reading != null)
                {
                    bioCheckResponse.Add(new BioCheckResponseModel("Q14", testResult.TcHdlRatio.Reading.Value.ToString()));
                }
                // testResult.LDL.Reading.ToString();
            }

            if (testResult.Glucose != null)
            {
                if (testResult.Glucose.Reading != null)
                {
                    bioCheckResponse.Add(new BioCheckResponseModel("Q15", testResult.Glucose.Reading.Value.ToString()));
                }
                // testResult.LDL.Reading.ToString();
            }

            if (testResult.TriGlycerides != null)
            {
                if (testResult.TriGlycerides.Reading != null)
                {
                    bioCheckResponse.Add(new BioCheckResponseModel("Q16", testResult.TriGlycerides.Reading));
                }
                // testResult.TriGlycerides.Reading;
            }

            if (basicBiometric != null)
            {
                if (basicBiometric.SystolicPressure != null)
                {
                    bioCheckResponse.Add(new BioCheckResponseModel("Q17", basicBiometric.SystolicPressure.Value.ToString()));
                }

                if (basicBiometric.DiastolicPressure != null)
                {
                    bioCheckResponse.Add(new BioCheckResponseModel("Q18", basicBiometric.DiastolicPressure.Value.ToString()));
                }
            }
            bioCheckResponse.Add(new BioCheckResponseModel("Q19", string.Empty));

            if (kynLabValues != null && kynLabValues.FastingStatus != null && kynLabValues.FastingStatus.Value == (long)FastingStatus.Fasting)
            {
                bioCheckResponse.Add(new BioCheckResponseModel("Q20", "true"));
            }
            else
            {
                bioCheckResponse.Add(new BioCheckResponseModel("Q20", "false"));
            }

            decimal waist = customer.Waist != null ? customer.Waist.Value : 0;

            bioCheckResponse.Add(new BioCheckResponseModel {
                Question = "Q21", Value = waist.ToString()
            });
        }
Esempio n. 5
0
        private void UpdateBloodPressure(string filePath, long customerId)
        {
            const string bpDiastolicAttrNameString  = "BLOOD_PRESSURE_DIASTOLIC";
            const string bpSystolicNameString       = "BLOOD_PRESSURE_SYSTOLIC";
            const string bpCaptureArmAttrNameString = "BLOODPRESSURE_CAPTURE_ARM";

            var xDoc = new XmlDocument();

            xDoc.Load(filePath);
            _logger.Info(string.Format("Values from XML for BP for Customer [{0}] ------------------------------------------", customerId));

            var elements = xDoc.GetElementsByTagName(BiomarkerTagName);

            int? diastolic = null;
            int? systolic  = null;
            bool isRightArmBpMeasurement = false;

            foreach (XmlNode element in elements)
            {
                if (element.Attributes == null || element.Attributes[NameAttrString] == null || element.Attributes[ValueAttrString] == null || string.IsNullOrEmpty(element.Attributes[NameAttrString].Value) ||
                    string.IsNullOrEmpty(element.Attributes[ValueAttrString].Value))
                {
                    continue;
                }

                var valueAttr = element.Attributes[NameAttrString].Value.ToLower();
                if (valueAttr == bpDiastolicAttrNameString.ToLower())
                {
                    int s;
                    int.TryParse(element.Attributes[ValueAttrString].Value, out s);

                    if (s > 0)
                    {
                        diastolic = s;
                    }
                }

                if (valueAttr == bpSystolicNameString.ToLower())
                {
                    int s;
                    int.TryParse(element.Attributes[ValueAttrString].Value, out s);

                    if (s > 0)
                    {
                        systolic = s;
                    }
                }

                if (valueAttr == bpCaptureArmAttrNameString.ToLower())
                {
                    if (element.Attributes[ValueAttrString].Value.ToLower() == "right")
                    {
                        isRightArmBpMeasurement = true;
                    }
                }
            }

            if (systolic.HasValue && diastolic.HasValue)
            {
                var eventCustomer = _eventCustomerRepository.Get(_eventId, customerId);

                var biometric = new BasicBiometric
                {
                    Id = eventCustomer.Id,
                    SystolicPressure        = systolic,
                    DiastolicPressure       = diastolic,
                    IsRightArmBpMeasurement = isRightArmBpMeasurement,
                    CreatedByOrgRoleUserId  = _uploadedBy,
                    CreatedOn = DateTime.Now,
                    IsBloodPressureElevated = (systolic.Value >= 140 || diastolic.Value >= 90)
                };

                _basicBiometricRepository.Save(biometric);
                ParseDataForHypertension(customerId, biometric);
            }
        }
        private void UpdateBloodPressure(string filePath, long customerId)
        {
            const string bpDiastolicTagNameString  = "diastolic_bloodpressure";
            const string bpSystolicTagNameString   = "systolic_bloodpressure";
            const string bpCaptureArmTagNameString = "arm_bloodpressure";

            var xDoc = new XmlDocument();

            xDoc.Load(filePath);
            _logger.Info(string.Format("Values from XML for BP for Customer [{0}] ------------------------------------------", customerId));



            int? diastolic = null;
            int? systolic  = null;
            bool isRightArmBpMeasurement = false;

            var element = xDoc.GetElementsByTagName(bpDiastolicTagNameString);

            if (element.Count > 0)
            {
                int s;
                int.TryParse(element[0].InnerXml, out s);

                if (s > 0)
                {
                    diastolic = s;
                }
            }

            element = xDoc.GetElementsByTagName(bpSystolicTagNameString);
            if (element.Count > 0)
            {
                int s;
                int.TryParse(element[0].InnerXml, out s);

                if (s > 0)
                {
                    systolic = s;
                }
            }

            element = xDoc.GetElementsByTagName(bpCaptureArmTagNameString);
            if (element.Count > 0)
            {
                if (element[0].InnerXml.ToLower() == "right")
                {
                    isRightArmBpMeasurement = true;
                }
            }

            if (systolic.HasValue && diastolic.HasValue)
            {
                var eventCustomer = _eventCustomerRepository.Get(_eventId, customerId);

                var biometric = new BasicBiometric
                {
                    Id = eventCustomer.Id,
                    SystolicPressure        = systolic,
                    DiastolicPressure       = diastolic,
                    IsRightArmBpMeasurement = isRightArmBpMeasurement,
                    CreatedByOrgRoleUserId  = _uploadedBy,
                    CreatedOn = DateTime.Now,
                    IsBloodPressureElevated = (systolic.Value >= 140 || diastolic.Value >= 90)
                };

                _basicBiometricRepository.Save(biometric);

                ParseDataForHypertension(customerId, biometric);
            }
        }