Пример #1
0
        public override QueryComposerResponseDTO Execute(QueryComposerRequestDTO request, bool viewSQL)
        {
            SummarySqlQueryAdapter sql = new SummarySqlQueryAdapter();
            var result = sql.Execute(request, _settings, viewSQL);

            return(result);
        }
        public override IEnumerable <QueryComposerResponseQueryResultDTO> Execute(QueryComposerQueryDTO query, bool viewSQL)
        {
            SummarySqlQueryAdapter sql = new SummarySqlQueryAdapter();
            var result = sql.Execute(query, _settings, viewSQL);

            return(new[] { result });
        }
        public override DTO.QueryComposer.QueryComposerResponseDTO Execute(DTO.QueryComposer.QueryComposerRequestDTO request, bool viewSQL)
        {
            IQueryAdapter queryAdapter = null;

            if (request.Where.Criteria.First().Terms.Any(t => t.Type == Lpp.QueryComposer.ModelTermsFactory.SqlDistributionID))
            {
                logger.Debug("Sql Distribution term found, creating SummarySqlQueryAdapter.");
                SummarySqlQueryAdapter sql = new SummarySqlQueryAdapter();
                var result = sql.Execute(request, _settings, viewSQL);
                _currentResponse = result;

                return(result);
            }

            if (request.Select.Fields.Any(t => t.Type == ModelTermsFactory.ICD9DiagnosisCodes3digitID))
            {
                logger.Debug("ICD-9 Diagnoses Codes term found, creating IncidenceICD9DiagnosisQueryAdapter.");

                queryAdapter = new IncidenceICD9DiagnosisQueryAdapter(_settings);
            }
            else if (request.Select.Fields.Any(t => t.Type == ModelTermsFactory.DrugNameID) || request.Select.Fields.Any(t => t.Type == ModelTermsFactory.DrugClassID))
            {
                if (request.Select.Fields.Any(t => t.Type == ModelTermsFactory.DrugNameID))
                {
                    logger.Debug("Pharmacy dispensing generic drug name term found, creating IncidencePharmaDispensingQueryAdapter.");
                }
                else
                {
                    logger.Debug("Pharmacy dispensing drug class term found, creating IncidencePharmaDispensingQueryAdapter.");
                }

                queryAdapter = new IncidencePharmaDispensingQueryAdapter(_settings);
            }

            if (queryAdapter == null)
            {
                throw new InvalidOperationException("Unable to determine the query adapter to use based on the primary criteria terms.");
            }

            using (queryAdapter)
            {
                var qcResponseDTO = queryAdapter.Execute(request, viewSQL);
                qcResponseDTO.LowCellThrehold = _lowThresholdValue;

                _currentResponse = qcResponseDTO;

                return(qcResponseDTO);
            }
        }
        public override DTO.QueryComposer.QueryComposerResponseDTO Execute(DTO.QueryComposer.QueryComposerRequestDTO request, bool viewSQL)
        {
            IQueryAdapter queryAdapter = null;

            if (request.Where.Criteria.First().Terms.Any(t => t.Type == Lpp.QueryComposer.ModelTermsFactory.SqlDistributionID))
            {
                logger.Debug("Sql Distribution term found, creating SummarySqlQueryAdapter.");
                SummarySqlQueryAdapter sql = new SummarySqlQueryAdapter();
                var result = sql.Execute(request, _settings, viewSQL);

                _currentResponse = result;

                return(result);
            }

            if (request.Select.Fields.Any(t => t.Type == ModelTermsFactory.DrugNameID) || request.Select.Fields.Any(t => t.Type == ModelTermsFactory.DrugClassID))
            {
                if (request.Select.Fields.Any(t => t.Type == ModelTermsFactory.DrugNameID))
                {
                    logger.Debug("Pharmacy dispensing generic drug name term found, creating PrevalencePharmaDispensingQueryAdapter.");
                }
                else
                {
                    logger.Debug("Pharmacy dispensing drug class term found, creating PrevalencePharmaDispensingQueryAdapter.");
                }

                queryAdapter = new PrevalencePharmaDispensingQueryAdapter(_settings);
            }
            else if (request.Select.Fields.Any(t => t.Type == ModelTermsFactory.CoverageID))
            {
                logger.Debug("Coverage term found, creating PrevalenceEnrollmentQueryAdapter.");

                queryAdapter = new PrevalenceEnrollmentQueryAdapter(_settings);
            }
            else if (request.Select.Fields.Any(t => t.Type == ModelTermsFactory.HCPCSProcedureCodesID))
            {
                logger.Debug("HCPCS procedure codes term found, creating PrevalenceHCPCSProceduresQueryAdapter.");

                queryAdapter = new PrevalenceHCPCSProceduresQueryAdapter(_settings);
            }
            else if (request.Select.Fields.Any(f => CodeQueryTermIDs.Contains(f.Type)))
            {
                Guid termID = Guid.Empty;
                if (request.Select.Fields.Any(t => t.Type == ModelTermsFactory.ICD9ProcedureCodes3digitID))
                {
                    termID = ModelTermsFactory.ICD9ProcedureCodes3digitID;
                    logger.Debug("ICD9 Procedure Codes (3 digit) term found, creating PrevalenceICD9QueryAdapter.");
                }
                else if (request.Select.Fields.Any(t => t.Type == ModelTermsFactory.ICD9ProcedureCodes4digitID))
                {
                    termID = ModelTermsFactory.ICD9ProcedureCodes4digitID;
                    logger.Debug("ICD9 Procedure Codes (4 digit) term found, creating PrevalenceICD9QueryAdapter.");
                }
                else if (request.Select.Fields.Any(t => t.Type == ModelTermsFactory.ICD9DiagnosisCodes3digitID))
                {
                    termID = ModelTermsFactory.ICD9DiagnosisCodes3digitID;
                    logger.Debug("ICD9 Diagnosis Codes (3 digit) term found, creating PrevalenceICD9QueryAdapter.");
                }
                else if (request.Select.Fields.Any(t => t.Type == ModelTermsFactory.ICD9DiagnosisCodes4digitID))
                {
                    termID = ModelTermsFactory.ICD9DiagnosisCodes4digitID;
                    logger.Debug("ICD9 Diagnosis Codes (4 digit) term found, creating PrevalenceICD9QueryAdapter.");
                }
                else if (request.Select.Fields.Any(t => t.Type == ModelTermsFactory.ICD9DiagnosisCodes5digitID))
                {
                    termID = ModelTermsFactory.ICD9DiagnosisCodes5digitID;
                    logger.Debug("ICD9 Diagnosis Codes (5 digit) term found, creating PrevalenceICD9QueryAdapter.");
                }

                queryAdapter = new PrevalenceICD9QueryAdapter(_settings, termID);
            }

            if (queryAdapter == null)
            {
                throw new InvalidOperationException("Unable to determine the query adapter to use based on the primary criteria terms.");
            }

            using (queryAdapter)
            {
                var qcResponseDTO = queryAdapter.Execute(request, viewSQL);
                qcResponseDTO.LowCellThrehold = _lowThresholdValue;

                _currentResponse = qcResponseDTO;

                return(qcResponseDTO);
            }
        }
Пример #5
0
        public override IEnumerable <DTO.QueryComposer.QueryComposerResponseQueryResultDTO> Execute(DTO.QueryComposer.QueryComposerQueryDTO query, bool viewSQL)
        {
            Guid          termID       = Guid.Empty;
            IQueryAdapter queryAdapter = null;

            if (query.Where.Criteria.First().Terms.Any(t => t.Type == Lpp.QueryComposer.ModelTermsFactory.SqlDistributionID))
            {
                logger.Debug("Sql Distribution term found, creating SummarySqlQueryAdapter.");
                SummarySqlQueryAdapter sql = new SummarySqlQueryAdapter();
                var result = sql.Execute(query, _settings, viewSQL);
                return(new[] { result });
            }

            if (query.Select.Fields.Any(f => CodeQueryTermIDs.Contains(f.Type)))
            {
                if (query.Select.Fields.Any(f => f.Type == ModelTermsFactory.HCPCSProcedureCodesID))
                {
                    termID = ModelTermsFactory.HCPCSProcedureCodesID;
                    logger.Debug("HCPCS Procedure Codes selector found, creating MFUCodesQueryAdapter.");
                }
                else if (query.Select.Fields.Any(f => f.Type == ModelTermsFactory.ICD9DiagnosisCodes3digitID))
                {
                    termID = ModelTermsFactory.ICD9DiagnosisCodes3digitID;
                    logger.Debug("ICD9 Diagnosis Codes (3 digit) selector found, creating MFUCodesQueryAdapter.");
                }
                else if (query.Select.Fields.Any(f => f.Type == ModelTermsFactory.ICD9DiagnosisCodes4digitID))
                {
                    termID = ModelTermsFactory.ICD9DiagnosisCodes4digitID;
                    logger.Debug("ICD9 Diagnosis Codes (4 digit) term found, creating MFUCodesQueryAdapter.");
                }
                else if (query.Select.Fields.Any(f => f.Type == ModelTermsFactory.ICD9DiagnosisCodes5digitID))
                {
                    termID = ModelTermsFactory.ICD9DiagnosisCodes5digitID;
                    logger.Debug("ICD9 Diagnosis Codes (5 digit) selector found, creating MFUCodesQueryAdapter.");
                }
                else if (query.Select.Fields.Any(f => f.Type == ModelTermsFactory.ICD9ProcedureCodes3digitID))
                {
                    termID = ModelTermsFactory.ICD9ProcedureCodes3digitID;
                    logger.Debug("ICD9 Procedure Codes (3 digit) selector found, creating MFUCodesQueryAdapter.");
                }
                else if (query.Select.Fields.Any(f => f.Type == ModelTermsFactory.ICD9ProcedureCodes4digitID))
                {
                    termID = ModelTermsFactory.ICD9ProcedureCodes4digitID;
                    logger.Debug("ICD9 Procedure Codes (4 digit) selector found, creating MFUCodesQueryAdapter.");
                }

                queryAdapter = new MostFrequentlyUsedCodesQueryAdapter(_settings, termID);
            }
            else if (query.Select.Fields.Any(f => f.Type == ModelTermsFactory.DrugClassID || f.Type == ModelTermsFactory.DrugNameID))
            {
                if (query.Select.Fields.Any(f => f.Type == ModelTermsFactory.DrugClassID))
                {
                    termID = ModelTermsFactory.DrugClassID;
                    logger.Debug("Pharamcy dispensing drug class selector found, creating MFUPharmaQueryAdapter.");
                }
                else if (query.Select.Fields.Any(f => f.Type == ModelTermsFactory.DrugNameID))
                {
                    termID = ModelTermsFactory.DrugNameID;
                    logger.Debug("Pharamcy dispensing generic drug selector found, creating MFUPharmaQueryAdapter.");
                }

                queryAdapter = new MostFrequentlyUsedPharmaDispensingQueryAdapter(_settings, termID);
            }

            if (queryAdapter == null)
            {
                throw new InvalidOperationException("Unable to determine the query adapter to use based on the primary criteria terms.");
            }

            using (queryAdapter)
            {
                var qcResponseDTO = queryAdapter.Execute(query, viewSQL);
                foreach (var r in qcResponseDTO)
                {
                    r.LowCellThrehold = _lowThresholdValue;
                }

                return(qcResponseDTO);
            }
        }