Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jalbinson committed Nov 15, 2024
1 parent eab9461 commit 5deaf7c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions prime-router/src/main/kotlin/azure/ReportFunction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,12 @@ class ReportFunction(
val requestBody = request.body
return if (contentType == "application/hl7-v2" && requestBody != null) {
try {
// Parse HL7 message
val maybeMessage = HL7Reader(ActionLogger())
.getMessages(requestBody)
.firstOrNull()

// Is the message an ACK?
if (maybeMessage != null && HL7Reader.isAckMessage(maybeMessage)) {
logger.info("Creating HL7 ACK response")
request.createResponseBuilder(HttpStatus.OK)
Expand Down
1 change: 1 addition & 0 deletions prime-router/src/main/kotlin/fhirengine/utils/HL7Reader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ class HL7Reader(private val actionLogger: ActionLogger) : Logging {
else -> null
}
}

fun getMessageControlId(message: Message): String? {
return when (val structure = message[MSH_SEGMENT_NAME]) {
is NIST_MSH -> structure.msh10_MessageControlID.encode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,5 +488,8 @@ OBX|1|test|94558-4^SARS-CoV-2 (COVID-19) Ag [Presence] in Respiratory specimen b
assertThat(
HL7Reader.getMessageControlId(message)
).isEqualTo("4AFA57FE-D41D-4631-9500-286AAAF797E4")
assertThat(
HL7Reader.isAckMessage(message)
).isTrue()
}
}

0 comments on commit 5deaf7c

Please sign in to comment.