-
Notifications
You must be signed in to change notification settings - Fork 40
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
Platform/bill/16144 #16550
Platform/bill/16144 #16550
Changes from 5 commits
e077e8a
3322852
9606328
1102247
d0517ec
c860dd9
978c899
6cdc85c
260604b
e1c5a70
c2de374
74b67f7
9dc4049
8b29996
7ce035d
7f92ba3
97b21ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ import ca.uhn.hl7v2.model.Segment | |
import ca.uhn.hl7v2.util.Terser | ||
import fhirengine.engine.CustomFhirPathFunctions | ||
import fhirengine.engine.CustomTranslationFunctions | ||
import gov.cdc.prime.reportstream.shared.BlobUtils | ||
import gov.cdc.prime.reportstream.shared.BlobUtils.sha256Digest | ||
import gov.cdc.prime.reportstream.shared.QueueMessage | ||
import gov.cdc.prime.router.ActionLogger | ||
import gov.cdc.prime.router.CustomerStatus | ||
|
@@ -26,6 +28,8 @@ import gov.cdc.prime.router.azure.observability.context.withLoggingContext | |
import gov.cdc.prime.router.azure.observability.event.AzureEventService | ||
import gov.cdc.prime.router.azure.observability.event.AzureEventServiceImpl | ||
import gov.cdc.prime.router.azure.observability.event.IReportStreamEventService | ||
import gov.cdc.prime.router.azure.observability.event.ReportStreamEventName | ||
import gov.cdc.prime.router.azure.observability.event.ReportStreamItemEventBuilder | ||
import gov.cdc.prime.router.common.Environment | ||
import gov.cdc.prime.router.fhirengine.config.HL7TranslationConfig | ||
import gov.cdc.prime.router.fhirengine.translation.hl7.FhirToHl7Context | ||
|
@@ -114,6 +118,10 @@ class FHIRTranslator( | |
logger.trace("Preparing to send original message") | ||
val originalReport = reportService.getRootReport(message.reportId) | ||
val bodyBytes = BlobAccess.downloadBlobAsByteArray(originalReport.bodyUrl) | ||
val localDigest = BlobUtils.digestToString(sha256Digest(bodyBytes)) | ||
check(message.digest == localDigest) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems wrong to me. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, if I'm understanding correctly, we should be comparing message.digest with blobInfo.digest (after the file is uploaded)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Latest changes should address this. |
||
"Downloaded file does not match expected file\n${message.digest} | $localDigest" | ||
} | ||
|
||
// get a Report from the message | ||
val (report, event, blobInfo) = Report.generateReportAndUploadBlob( | ||
|
@@ -163,6 +171,18 @@ class FHIRTranslator( | |
topic = message.topic | ||
) | ||
|
||
val builder = ReportStreamItemEventBuilder( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should prefer the style that is shown in FHIRDestinationFilter where we pass in the builder directly to
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be in there now. |
||
reportEventService, | ||
azureEventService, | ||
ReportStreamEventName.ITEM_TRANSFORMED, | ||
report.id, | ||
report.bodyURL, | ||
message.topic, | ||
TaskAction.translate | ||
) | ||
builder.theParentReportId = message.reportId | ||
azureEventService.trackEvent(builder.buildEvent()) | ||
|
||
return FHIREngineRunResult( | ||
event, | ||
report, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Have we considered updating this to use
BlobAccess.downloadBlob(...)
which will do the digest check for us?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made the change.