Пример #1
0
        public async Task ExecutePrediction(PredictionParameters parms)
        {
            string accessJson = await _fileStorage.ReadFile("connectdefinition", "PPDMDataAccess.json");

            _accessDefs = JsonConvert.DeserializeObject <List <DataAccessDef> >(accessJson);
            ConnectParameters connector = await GetConnector(parms.DataConnector);

            databaseConnectionString = connector.ConnectionString;

            _dbConn.OpenConnection(connector);

            string sourceConnector = GetSource();

            if (parms.DataConnector == sourceConnector)
            {
                syncPredictions = true;
            }
            else
            {
                syncPredictions = false;
            }

            RuleManagement rules = new RuleManagement(_azureConnectionString);
            RuleModel      rule  = await rules.GetRuleAndFunction(parms.DataConnector, parms.PredictionId);

            manageIndexTable = new ManageIndexTable(_accessDefs, connector.ConnectionString, rule.DataType, rule.FailRule);
            manageIndexTable.InitQCFlags(false);
            await MakePredictions(rule, connector);

            _dbConn.CloseConnection();
            manageIndexTable.SaveQCFlags();
        }
Пример #2
0
        public async Task <List <int> > ExecuteQcRule(DataQCParameters qcParms)
        {
            try
            {
                ConnectParameters connector = await GetConnector(qcParms.DataConnector);

                RuleModel rule = await GetRuleAndFunctionInfo(qcParms.DataConnector, qcParms.RuleId);

                string accessJson = await _fileStorage.ReadFile("connectdefinition", "PPDMDataAccess.json");

                _accessDefs = JsonConvert.DeserializeObject <List <DataAccessDef> >(accessJson);
                DbUtilities dbConn = new DbUtilities();
                dbConn.OpenConnection(connector);
                manageQCFlags = new ManageIndexTable(_accessDefs, connector.ConnectionString, rule.DataType);
                List <int> failedObjects = await QualityCheckDataType(dbConn, rule, connector);

                dbConn.CloseConnection();
                return(failedObjects);
            }
            catch (Exception ex)
            {
                Exception error = new Exception($"DataQc: Could process rule {qcParms.RuleId}, {ex}");
                throw error;
            }
        }
Пример #3
0
        public async Task CloseDataQC(string source, List <RuleFailures> ruleFailures)
        {
            try
            {
                ConnectParameters connector = await GetConnector(source);

                RuleManagement rm        = new RuleManagement(_azureConnectionString);
                string         jsonRules = await rm.GetRules(source);

                List <RuleModel> rules    = JsonConvert.DeserializeObject <List <RuleModel> >(jsonRules);
                ManageIndexTable idxTable = new ManageIndexTable(connector.ConnectionString);
                await idxTable.GetIndexQCFlagData();

                foreach (var ruleFailure in ruleFailures)
                {
                    RuleModel rule = rules.FirstOrDefault(o => o.Id == ruleFailure.RuleId);
                    foreach (var failure in ruleFailure.Failures)
                    {
                        string qcString = idxTable.GetQCFlag(failure);
                        qcString = qcString + rule.RuleKey + ";";
                        idxTable.SetQCFlag(failure, qcString);
                    }
                }
                idxTable.SaveQCFlagDapper();
            }
            catch (Exception ex)
            {
                Exception error = new Exception($"DataQc: Could not close and save qc flags, {ex}");
                throw error;
            }
        }
Пример #4
0
        public async Task <List <DmsIndex> > GetResult(string source, int id)
        {
            ConnectParameters connector = await GetConnector(source);

            RuleManagement rules    = new RuleManagement(_azureConnectionString);
            string         jsonRule = await rules.GetRule(source, id);

            RuleModel rule = JsonConvert.DeserializeObject <RuleModel>(jsonRule);

            ManageIndexTable mit    = new ManageIndexTable(connector.ConnectionString);
            List <DmsIndex>  result = await mit.GetQcOrPredictionsFromIndex(rule.RuleKey);

            return(result);
        }