Pass root report id to Azure events when available
User Story
As a maintainer of the Universal Pipeline, I want to avoid making unnecessary calls to the DB, so that I can avoid related performance issues
Description/Use Case
Several UP steps need to call reportService.getRootReport(message.reportId) to perform their business logic. These same steps then end up calling reportEventService.sendItemEvent(...) which ends up calling getRootReports in ReportStreamEventService.getItemEventData. Instead of querying the DB twice in this flow, we should investigate to see if we can optionally pass in the root report so it does not need to be calculated again in ReportStreamEventService.getItemEventData.
There is a similar issue with ReportStreamEventService.getReportEventData as well that will need to be investigated in this ticket.
Once ReportStreamEventService.getReportEventData and reportEventService.sendItemEvent(...) have been updated to accept the optional root reports, go through all usages of Azure Events and pass in the root reports if it makes sense to do so for those particular usages.
Risks/Impacts/Considerations
Dev Notes
See FHIRTranslator.kt for an example:
- In
sendTranslated, we call:val originalReport = reportService.getRootReport(message.reportId) - Then later in the same method, we call
reportEventService.sendItemEvent(which will ultimately repeat the DB query to get the root reports
In this case, since we already get the root report, we should just pass that to the event logic so it doesn't have to calculate it again.
Acceptance Criteria
- [ ] Updated
sendItemEventto accept optionalrootReport(s) - [ ] Updated
sendReportEventto accept optionalrootReport(s) - [ ] Updated usages of the above to pass in the root report IDs or Report objects where appropriate
Hey team! Please add your planning poker estimate with Zenhub @adegolier @jack-h-wang @oluwie @JFisk42 @feralearthman
@adegolier @JFisk42 @feralearthman @jack-h-wang please point
Please add your planning poker estimate with Zenhub @oluwie
Previous attempt at solution here: https://github.com/CDCgov/prime-reportstream/pull/17854