Exemple #1
0
        public void GetHrvConclusion(TestRawData hrvData, Guid testId, out PreShiftHrvConclusion conclusion)
        {
            _log.Info("Getting HRV conclusion");

            double statM     = 0;
            double statSigma = 0;
            double IN        = 0;

            conclusion = null;

            try
            {
                ProcessHrvData(hrvData, out var hrvOutData);

                Upft130HrvClassifier classifier = new Upft130HrvClassifier();
                conclusion = classifier.MakePreshiftConclusion(hrvOutData);

                var LSR = conclusion.LSR_Text;
                if (string.IsNullOrEmpty(LSR))
                {
                    throw new Exception("LSR_Text must be non-empty.");
                }

                statM     = hrvOutData.CRV_STAT.m;
                statSigma = hrvOutData.CRV_STAT.sigma;
                IN        = hrvOutData.Indicators.IN;
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                if (null == conclusion)
                {
                    conclusion = new PreShiftHrvConclusion();
                }
                conclusion.Status         = PsaStatus.Fail;
                conclusion.LSR_Text       = strings.UnknownError;
                conclusion.VSR            = -1;
                conclusion.StateMatrixRow = -1;
                conclusion.StateMatrixCol = -1;
                conclusion.LSR            = LSR_HrvFunctionalState.Critical_0;
            }

            conclusion.TestId = testId;
            conclusion.Text   = PsaStatusTextProvider.StatusText(conclusion.Status);
            //      conclusion.Color = PsaStatusColorProvider.StatusColor(conclusion.Status);
            conclusion.MeanHR  = 60000.0 / statM;
            conclusion.IN      = IN;
            conclusion.Comment =
                $"LSR={conclusion.LSR_Text}, VSR={conclusion.VSR:0.000}, MRR={statM:#}, " +
                $"SRR={statSigma:#}, SMLoc=({conclusion.StateMatrixRow};{conclusion.StateMatrixCol})";
        }
Exemple #2
0
        public void GetSvmrConclusion(TestRawData svmrData, Guid testId, out PreShiftSvmrConclusion svmrConclusion)
        {
            _log.Info("Getting SVMR conclusion");

            double statM     = 0;
            double statSigma = 0;
            double IPN1      = 0;

            svmrConclusion = null;
            var errorMessage = string.Empty;

            try
            {
                ProcessSvmrData(svmrData, out var svmrOutData);

                IPN1           = svmrOutData.IPN1;
                statM          = svmrOutData.SvmrStatistics.m;
                statSigma      = svmrOutData.SvmrStatistics.sigma;
                svmrConclusion = new PreShiftSvmrConclusion();
                if (svmrOutData.IPN1 >= 85)
                {
                    svmrConclusion.Status = PsaStatus.Pass;
                }
                else if (svmrOutData.IPN1 >= 60)
                {
                    svmrConclusion.Status = PsaStatus.Conditional_Pass;
                }
                else
                {
                    svmrConclusion.Status = PsaStatus.Fail;
                }
            }
            catch (DataProcessingException ex)
            {
                _log.Error(ex);
                if (null == svmrConclusion)
                {
                    svmrConclusion = new PreShiftSvmrConclusion();
                }
                svmrConclusion.Status = PsaStatus.Fail;
                IPN1         = 0;
                errorMessage = strings.SvmrTooManyErrors;
            }

            svmrConclusion.Text   = PsaStatusTextProvider.StatusText(svmrConclusion.Status);
            svmrConclusion.TestId = testId;
            svmrConclusion.IPN1   = IPN1;
            svmrConclusion.MeanResponseTimeMSec = statM;
            svmrConclusion.Comment = $"ИПН1={IPN1:0.0}% MeanR={statM:#} SigmaR={statSigma:#} {errorMessage}";
            _log.Info($"SVMR conclusion IPN1 => {IPN1:F3}");
        }