Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CNDE-1951: Re-order Hepatitis datamart post-processing #104

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ protected void processCachedIds() {
List<Entry<String, List<Long>>> sortedEntries = idCacheSnapshot.entrySet().stream()
.sorted(Comparator.comparingInt(entry -> getEntityByTopic(entry.getKey()).getPriority())).toList();

List<InvestigationResult> dmData = new ArrayList<>();

for (Entry<String, List<Long>> entry : sortedEntries) {
String keyTopic = entry.getKey();
List<Long> ids = entry.getValue();
Expand All @@ -225,7 +227,7 @@ protected void processCachedIds() {
processTopic(keyTopic, entity, ids, postProcRepository::executeStoredProcForPatientIds);
break;
case INVESTIGATION:
List<InvestigationResult> invData = processTopic(keyTopic, entity, ids,
dmData = processTopic(keyTopic, entity, ids,
investigationRepository::executeStoredProcForPublicHealthCaseIds);

ids.stream().filter(idValsSnapshot::containsKey).forEach(id ->
Expand All @@ -237,8 +239,6 @@ protected void processCachedIds() {

processTopic(keyTopic, Entity.CASE_COUNT, ids,
investigationRepository::executeStoredProcForCaseCount);

datamartProcessor.process(invData);
break;
case NOTIFICATION:
processTopic(keyTopic, entity, ids,
Expand Down Expand Up @@ -290,9 +290,12 @@ protected void processCachedIds() {
break;
}
}
datamartProcessor.process(dmData);
sveselev marked this conversation as resolved.
Show resolved Hide resolved
} else {
logger.info("No ids to process from the topics.");
}


}

@Scheduled(fixedDelayString = "${service.fixed-delay.datamart}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void process(List<InvestigationResult> data) {
String jsonMessage = jsonGenerator.generateStringJson(dmart);

kafkaTemplate.send(datamartTopic, jsonKey, jsonMessage);
logger.info("Datamart data: PHC uid={}, condition_cd={} sent to {} topic", dmart.getPublicHealthCaseUid(), dmart.getConditionCd(), datamartTopic);
}
} catch (Exception e) {
logger.error("Error processing Datamart JSON array from investigation result data: {}", e.getMessage());
Expand Down
Loading