use of com.cognizant.devops.platformreports.assessment.datamodel.InsightsContentDetail in project Insights by CognizantOneDevOps.
the class BaseContentCategoryImpl method setContentDetail.
/**
* Method is convert content model to entity model, further this entity model
* store in database
*
* @param inferenceResult
* @param resultValuesMap
* @param sentiment
* @param actualTrend
* @param inferenceText
* @return
*/
public InsightsContentDetail setContentDetail(InsightsKPIResultDetails inferenceResult, Map<String, Object> resultValuesMap, ReportEngineEnum.KPISentiment sentiment, String actualTrend, String inferenceText) {
InsightsContentDetail detail = new InsightsContentDetail();
detail.setCategory(contentConfigDefinition.getCategory());
detail.setActualTrend(actualTrend);
detail.setExpectedTrend(contentConfigDefinition.getExpectedTrend());
detail.setContentId(contentConfigDefinition.getContentId());
detail.setInferenceText(inferenceText);
detail.setKpiId(inferenceResult.getKpiId());
detail.setKpiName(inferenceResult.getKpiName());
detail.setNoOfResult(contentConfigDefinition.getNoOfResult());
// ranking
detail.setRanking(null);
detail.setResultField(contentConfigDefinition.getResultField());
detail.setResultTime(inferenceResult.getResultTime());
detail.setResultTimeX(inferenceResult.getResultTimeX());
detail.setResultValuesMap(resultValuesMap);
detail.setSchedule(inferenceResult.getSchedule());
detail.setSentiment(sentiment);
detail.setThreshold(contentConfigDefinition.getThreshold());
detail.setToolName(inferenceResult.getToolname());
// trendline
detail.setTrendline(null);
detail.setGroup(inferenceResult.getGroupName());
detail.setExecutionId(contentConfigDefinition.getExecutionId());
detail.setReportId(contentConfigDefinition.getReportId());
detail.setAssessmentId(contentConfigDefinition.getAssessmentId());
detail.setAssessmentReportName(contentConfigDefinition.getAssessmentReportName());
return detail;
}
use of com.cognizant.devops.platformreports.assessment.datamodel.InsightsContentDetail in project Insights by CognizantOneDevOps.
the class ComparisonContentCategoryImpl method generateContent.
/**
* Generate comparision content text using KPI result
*/
@Override
public void generateContent() {
long startTime = System.nanoTime();
List<InsightsKPIResultDetails> kpiResults = getKPIExecutionResult();
InsightsContentDetail contentResult = null;
if (!kpiResults.isEmpty()) {
contentResult = getContentFromResult(kpiResults);
} else {
contentResult = setNeutralContentDetail();
log.debug("Worlflow Detail ==== No kpi result found for kpi Id {} ContentId {} ", contentConfigDefinition.getKpiId(), contentConfigDefinition.getContentId());
}
if (contentResult != null) {
log.debug("Worlflow Detail ==== contentid {} kpi {} contentResultText + {} ", contentConfigDefinition.getCategory(), contentConfigDefinition.getKpiId(), contentResult.getInferenceText());
saveContentResult(contentResult);
long processingTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
log.debug("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", contentConfigDefinition.getExecutionId(), contentConfigDefinition.getWorkflowId(), contentConfigDefinition.getReportId(), "-", contentConfigDefinition.getKpiId(), contentConfigDefinition.getCategory(), processingTime, "ContentId :" + contentConfigDefinition.getContentId() + "ContentName :" + contentConfigDefinition.getContentName() + "action :" + contentConfigDefinition.getAction() + "ContentResult :" + contentConfigDefinition.getNoOfResult());
}
}
use of com.cognizant.devops.platformreports.assessment.datamodel.InsightsContentDetail in project Insights by CognizantOneDevOps.
the class ThresholdRangeCategoryImpl method countAndPercentageInferenceResult.
/**
* Process KPI result to create content text using count and precentage method
*
* @param inferenceResults
* @return
*/
private InsightsContentDetail countAndPercentageInferenceResult(List<InsightsKPIResultDetails> inferenceResults) {
InsightsContentDetail inferenceContentResult = null;
if (contentConfigDefinition.getThresholds() != null) {
try {
long startTime = System.nanoTime();
InsightsKPIResultDetails resultDetailObj = inferenceResults.get(0);
Map<String, Object> zoneWiseCountWithSentiment = getZoneWiseCountWithSentiment(inferenceResults);
Map<String, Object> resultValuesMap = new HashMap<>();
int redZone = (int) zoneWiseCountWithSentiment.get("redZone");
int amberZone = (int) zoneWiseCountWithSentiment.get("amberZone");
int greenZone = (int) zoneWiseCountWithSentiment.get("greenZone");
ReportEngineEnum.KPISentiment sentiment = (ReportEngineEnum.KPISentiment) zoneWiseCountWithSentiment.get("sentiment");
String zone = (String) zoneWiseCountWithSentiment.get("zone");
int result = (int) zoneWiseCountWithSentiment.get(AssessmentReportAndWorkflowConstants.RESULT);
if (getContentConfig().getAction() == ReportEngineEnum.ExecutionActions.PERCENTAGE) {
int totalSize = inferenceResults.size();
resultValuesMap.put("red", ((redZone * 100) / totalSize) + "%");
resultValuesMap.put(AssessmentReportAndWorkflowConstants.AMBER, ((amberZone * 100) / totalSize) + "%");
resultValuesMap.put(AssessmentReportAndWorkflowConstants.GREEN, ((greenZone * 100) / totalSize) + "%");
resultValuesMap.put("zone", zone);
resultValuesMap.put(AssessmentReportAndWorkflowConstants.RESULT, result);
addTimeValueinResult(resultValuesMap, contentConfigDefinition.getSchedule());
} else {
resultValuesMap.put("red", redZone);
resultValuesMap.put(AssessmentReportAndWorkflowConstants.AMBER, amberZone);
resultValuesMap.put(AssessmentReportAndWorkflowConstants.GREEN, greenZone);
resultValuesMap.put("zone", zone);
resultValuesMap.put(AssessmentReportAndWorkflowConstants.RESULT, result);
addTimeValueinResult(resultValuesMap, contentConfigDefinition.getSchedule());
}
String inferenceText = getContentText(ReportEngineUtils.STANDARD_MESSAGE_KEY, resultValuesMap);
if (inferenceText != null) {
inferenceContentResult = setContentDetail(resultDetailObj, resultValuesMap, sentiment, "", inferenceText);
} else {
log.debug(" inference text is null for count And Percentage threshold-range KPIId {} contentId {} result {} ", getContentConfig().getKpiId(), getContentConfig().getContentId(), resultDetailObj);
}
long processingTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
log.debug("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", contentConfigDefinition.getExecutionId(), contentConfigDefinition.getWorkflowId(), contentConfigDefinition.getReportId(), "-", contentConfigDefinition.getKpiId(), contentConfigDefinition.getCategory(), processingTime, "ContentId :" + contentConfigDefinition.getContentId() + "ContentName :" + contentConfigDefinition.getContentName() + "action :" + contentConfigDefinition.getAction() + "ContentResult :" + contentConfigDefinition.getNoOfResult());
} catch (Exception e) {
log.error(e);
log.error(" Error while content processing for threshold-range countAndPercentageInferenceResult KPIId {} contentId {}", getContentConfig().getKpiId(), getContentConfig().getContentId());
log.error("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", contentConfigDefinition.getExecutionId(), contentConfigDefinition.getWorkflowId(), contentConfigDefinition.getReportId(), "-", contentConfigDefinition.getKpiId(), contentConfigDefinition.getCategory(), 0, "ContentId :" + contentConfigDefinition.getContentId() + "ContentName :" + contentConfigDefinition.getContentName() + "action :" + contentConfigDefinition.getAction() + "ContentResult :" + contentConfigDefinition.getNoOfResult() + " Error while content processing for threshold-range" + e.getMessage());
throw new InsightsJobFailedException(" Error while content processing for threshold-range KPIId {} contentId {}");
}
} else {
log.error(" Errro while content processing for threshold-range KPIId {} contentId {}", getContentConfig().getKpiId(), getContentConfig().getContentId());
log.error("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", contentConfigDefinition.getExecutionId(), contentConfigDefinition.getWorkflowId(), contentConfigDefinition.getReportId(), "-", contentConfigDefinition.getKpiId(), contentConfigDefinition.getCategory(), 0, "ContentId :" + contentConfigDefinition.getContentId() + "ContentName :" + contentConfigDefinition.getContentName() + "action :" + contentConfigDefinition.getAction() + "ContentResult :" + contentConfigDefinition.getNoOfResult() + " Error while content processing for threshold-range");
}
return inferenceContentResult;
}
use of com.cognizant.devops.platformreports.assessment.datamodel.InsightsContentDetail in project Insights by CognizantOneDevOps.
the class TrendCategoryImpl method generateContent.
/**
* Generate Trend content text using KPI result
*/
@Override
public void generateContent() {
long startTime = System.nanoTime();
List<InsightsKPIResultDetails> inferenceResults = getKPIExecutionResult();
InsightsContentDetail contentResult = null;
if (!inferenceResults.isEmpty()) {
contentResult = getContentFromResult(inferenceResults);
} else {
contentResult = setNeutralContentDetail();
log.debug("Worlflow Detail ==== No kpi result found for kpi Id {} ContentId {} ", contentConfigDefinition.getKpiId(), contentConfigDefinition.getContentId());
}
if (contentResult != null) {
log.debug("Worlflow Detail ==== contentid {} kpi {} contentResultText + {} ", contentConfigDefinition.getCategory(), contentConfigDefinition.getKpiId(), contentResult.getInferenceText());
saveContentResult(contentResult);
long processingTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
log.debug("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", contentConfigDefinition.getExecutionId(), contentConfigDefinition.getWorkflowId(), contentConfigDefinition.getReportId(), "-", contentConfigDefinition.getKpiId(), contentConfigDefinition.getCategory(), processingTime, " ContentId :" + contentConfigDefinition.getContentId() + " ContentName :" + contentConfigDefinition.getContentName() + " action :" + contentConfigDefinition.getAction() + " ContentResult :" + contentConfigDefinition.getNoOfResult());
}
}
use of com.cognizant.devops.platformreports.assessment.datamodel.InsightsContentDetail in project Insights by CognizantOneDevOps.
the class TrendCategoryImpl method averageTrendResult.
/**
* Process KPI result to create content text using average method
*
* @param inferenceResults
* @return
*/
private InsightsContentDetail averageTrendResult(List<InsightsKPIResultDetails> inferenceResults) {
Map<String, Object> resultValuesMap = new HashMap<>();
InsightsContentDetail inferenceContentResult = null;
try {
long startTime = System.nanoTime();
String comparisonField = getResultFieldFromContentDefination();
InsightsKPIResultDetails resultDetailObj = inferenceResults.get(0);
ReportEngineEnum.KPISentiment sentiment = ReportEngineEnum.KPISentiment.NEUTRAL;
double resultValue = inferenceResults.stream().mapToDouble((result -> (Double) result.getResults().get(comparisonField))).average().getAsDouble();
resultValuesMap.put("result", resultValue);
addTimeValueinResult(resultValuesMap, contentConfigDefinition.getSchedule());
inferenceContentResult = prepareContentMessageAndResult(inferenceContentResult, resultValuesMap, resultValue, sentiment, resultDetailObj);
long processingTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
log.debug("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", contentConfigDefinition.getExecutionId(), contentConfigDefinition.getWorkflowId(), contentConfigDefinition.getReportId(), "-", contentConfigDefinition.getKpiId(), contentConfigDefinition.getCategory(), processingTime, "ContentId :" + contentConfigDefinition.getContentId() + "ContentName :" + contentConfigDefinition.getContentName() + "action :" + contentConfigDefinition.getAction() + "ContentResult :" + contentConfigDefinition.getNoOfResult());
} catch (Exception e) {
log.error(e);
log.error(" Errro while content processing for average trend KPIId {} contentId {} ", getContentConfig().getKpiId(), getContentConfig().getContentId());
log.error("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", contentConfigDefinition.getExecutionId(), contentConfigDefinition.getWorkflowId(), contentConfigDefinition.getReportId(), "-", contentConfigDefinition.getKpiId(), contentConfigDefinition.getCategory(), 0, "ContentId :" + contentConfigDefinition.getContentId() + "ContentName :" + contentConfigDefinition.getContentName() + "action :" + contentConfigDefinition.getAction() + "ContentResult :" + contentConfigDefinition.getNoOfResult() + "Exception while running neo4j operation" + e.getMessage());
throw new InsightsJobFailedException("Exception while running neo4j operation {} " + e.getMessage());
}
return inferenceContentResult;
}
Aggregations