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; } }
private async Task ProcessResult(PredictionResult result, RuleModel rule) { if (result.Status == "Passed") { string qcStr = manageIndexTable.GetQCFlag(result.IndexId); string failRule = rule.FailRule + ";"; string pCode = rule.RuleKey + ";"; if (result.SaveType == "Delete") { qcStr = pCode; } else { qcStr = qcStr.Replace(failRule, pCode); } manageIndexTable.SetQCFlag(result.IndexId, qcStr); await SavePrediction(result, qcStr); } else { //FailedPredictions++; } }