-
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/angela/14116/read hl7 #16859
Changes from 22 commits
2dc6a1e
d91b689
de360f6
7edf98e
78807d0
27bc350
e074084
37b41b7
68640e8
67c8df4
cc2b64c
ad37042
0360fba
7bb94b1
955f3f8
97600ba
0e5b19d
fc64067
306d985
f36a90a
08357af
f64fe7e
44c93c8
7d6422f
f511958
e44d58d
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 |
---|---|---|
|
@@ -5,12 +5,12 @@ import com.google.common.net.HttpHeaders | |
import com.microsoft.azure.functions.HttpRequestMessage | ||
import com.microsoft.azure.functions.HttpResponseMessage | ||
import com.microsoft.azure.functions.HttpStatus | ||
import gov.cdc.prime.router.ActionLogger | ||
import gov.cdc.prime.router.Sender | ||
import gov.cdc.prime.router.azure.HttpUtilities | ||
import gov.cdc.prime.router.azure.HttpUtilities.Companion.isSuccessful | ||
import gov.cdc.prime.router.common.JacksonMapperUtilities | ||
import gov.cdc.prime.router.fhirengine.translation.hl7.utils.HL7ACKUtils | ||
import gov.cdc.prime.router.fhirengine.utils.HL7MessageHelpers | ||
import gov.cdc.prime.router.fhirengine.utils.HL7Reader | ||
import gov.cdc.prime.router.history.DetailedSubmissionHistory | ||
import org.apache.logging.log4j.kotlin.Logging | ||
|
@@ -106,12 +106,11 @@ class SubmissionResponseBuilder( | |
contentType == HttpUtilities.hl7V2MediaType && | ||
requestBody != null | ||
) { | ||
val hl7Reader = HL7Reader(ActionLogger()) | ||
val messages = hl7Reader.getMessages(requestBody) | ||
val isBatch = hl7Reader.isBatch(requestBody, messages.size) | ||
val messageCount = HL7MessageHelpers.messageCount(requestBody) | ||
val isBatch = HL7Reader.isBatch(requestBody, messageCount) | ||
|
||
if (!isBatch && messages.size == 1) { | ||
val message = messages.first() | ||
if (!isBatch && messageCount == 1) { | ||
val message = HL7Reader.parseHL7Message(requestBody) | ||
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. I think we need to be careful here. parseHL7Message can return exceptions, so what does that mean for the submission api in general? If there is a failure here, it will except out of the main I poked around a bit and I think this is fine. This submission method is slated to be deprecated and we should take this issue into consideration when implementing this HL7v2 ACK functionality into the submission microservice. 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. I updated the DevNotes section of this ticket linking to this comment: #15731 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 should be okay because we're checking the message count with the iterator and it would have gotten angry there and returned with 0 messages if it was bad HL7. |
||
val acceptAcknowledgementType = HL7Reader.getAcceptAcknowledgmentType(message) | ||
val ackResponseRequired = acceptAcknowledgmentTypeRespondValues.contains(acceptAcknowledgementType) | ||
if (ackResponseRequired) { | ||
|
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.
The changes in this file look good. However, Long-term, we don't want to be doing this type of validation in the receive step (the submission microservice doesn't, see submissions/src/main/kotlin/gov/cdc/prime/reportstream/submissions/controllers/SubmissionController.kt). I think its fine to leave this as is for now and if we find we are not as close to moving to the microservice as we think we are we can prioritize tickets to align this function with the microservice.