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

Platform/angela/14116/read hl7 #16859

Merged
merged 26 commits into from
Jan 8, 2025
Merged

Platform/angela/14116/read hl7 #16859

merged 26 commits into from
Jan 8, 2025

Conversation

adegolier
Copy link
Collaborator

@adegolier adegolier commented Dec 20, 2024

This PR ...

Removes HL7Reader.getMessages() in favor of HL7Reader.parseHL7Message()

Test Steps:

  1. Run tests

Changes

  • Removed getMessages() from HL7Reader and changed references to it to use HL7Reader.parseHL7Message()
  • Removed getMessageModelClasses() from HL7Reader because it was only used by getMessages
  • Moved additional functions from HL7Reader into the companion object since there is no need to have multiple instances of HL7Reader
  • Removed HL7Reader.messageToConfigMap because it was no longer being used
  • Marked profileDirectoryMap and getMessageProfile() in HL7Reader as deprecated as they are only used in the CLI tool (which was outside the scope of the ticket) and added corresponding suppression of deprecated warnings for their usage to ProcessFhirCommands.convertHl7ToFhir()

Checklist

Testing

  • Tested locally?
  • Ran ./prime test or ./gradlew testSmoke against local Docker ReportStream container?
  • (For Changes to /frontend-react/...) Ran npm run lint:write?
  • Added tests?

Linked Issues

…erter.getBundles which calls HL7Reader.parseHL7Message but still sorting through the tests
…adding a check for the messages being empty and logging an error, and added a test to the FHIRConverterIntegrationTests to ensure that it handles a message that isn't empty but doesn't contain HL7
…lt parsing to get the message type instead of RS specific parsing
…s deprecated because they are only being used in the CLI and should probably not be used elsewhere. Removing useages from CLI was out of scope for this ticket.
…d added some HL7Reader tests back in with modifications
@adegolier adegolier requested a review from a team as a code owner December 20, 2024 00:29
Copy link
Contributor

github-actions bot commented Dec 20, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

@adegolier adegolier added the platform Platform Team label Dec 20, 2024
Copy link
Contributor

github-actions bot commented Dec 20, 2024

Test Results

1 265 tests   - 4   1 261 ✅  - 4   8m 4s ⏱️ +33s
  164 suites ±0       4 💤 ±0 
  164 files   ±0       0 ❌ ±0 

Results for commit e44d58d. ± Comparison against base commit e0509fe.

This pull request removes 4 tests.
gov.cdc.prime.router.fhirengine.utils.HL7ReaderTests ‑ get getMessages can parse a message that uses the deprecated CE type in OBX2()
gov.cdc.prime.router.fhirengine.utils.HL7ReaderTests ‑ get getMessages no mapped models()
gov.cdc.prime.router.fhirengine.utils.HL7ReaderTests ‑ get getMessages v27 succeeds()
gov.cdc.prime.router.fhirengine.utils.HL7ReaderTests ‑ test getMessageProfile()

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Dec 20, 2024

Integration Test Results

 60 files  ±0   60 suites  ±0   43m 20s ⏱️ +31s
428 tests ±0  418 ✅ ±0  10 💤 ±0  0 ❌ ±0 
431 runs  ±0  421 ✅ ±0  10 💤 ±0  0 ❌ ±0 

Results for commit e44d58d. ± Comparison against base commit e0509fe.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@jack-h-wang jack-h-wang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple quick comments that stood out to me on a quick look, but overall looks good to me!

…e only otherwise part of the getMessages() saga
@adegolier
Copy link
Collaborator Author

Made changes that were previously logged as other tickets, still waiting for code owner approval.

val messages = HL7Reader(actionLogs).getMessages(content)
val isBatch = HL7Reader(actionLogs).isBatch(content, messages.size)
// create a Report for this incoming HL7 message to use for tracking in the database
val messageCount = HL7MessageHelpers.messageCount(content)
Copy link
Collaborator

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.

prime-router/src/main/kotlin/cli/ProcessFhirCommands.kt Outdated Show resolved Hide resolved
if (!isBatch && messages.size == 1) {
val message = messages.first()
if (!isBatch && messageCount == 1) {
val message = HL7Reader.parseHL7Message(requestBody)
Copy link
Collaborator

Choose a reason for hiding this comment

The 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 processRequest function and an HTTP error will be returned in from the caller submitToWaters. The DB state will be updated I think by this point, but the queueMessage for the convert step will not be populated.

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The 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

Copy link
Collaborator Author

@adegolier adegolier Jan 7, 2025

Choose a reason for hiding this comment

The 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.

@adegolier adegolier enabled auto-merge (squash) January 7, 2025 18:24
Copy link

sonarqubecloud bot commented Jan 8, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
68.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@adegolier adegolier merged commit aeb20c7 into main Jan 8, 2025
24 of 25 checks passed
@adegolier adegolier deleted the platform/angela/14116/ReadHL7 branch January 8, 2025 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform Platform Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

As a RS developer, I want a consistent way to read HL7 messages
4 participants