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

Remove la obr except 54089 8 #1518

Merged
merged 23 commits into from
Dec 6, 2024
Merged

Remove la obr except 54089 8 #1518

merged 23 commits into from
Dec 6, 2024

Conversation

somesylvie
Copy link
Contributor

@somesylvie somesylvie commented Oct 30, 2024

Description

  • Add LA OBR removal Transformation
    • This is for the removal of all extra OBRs that are not '54089-8'
  • Add LA Sample files for testing
  • Add RS e2e testing with new sample file and assertions
    • This was tested locally with a local TI and RS instance. If you test this functionality, please run this locally.
    • Note: This RS e2e test does not work currently because the transformation code is not in staging.

Issue

#1355

Checklist

  • I have added tests to cover my changes

Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

1355 - Partially compliant

Fully compliant requirements:

  • The OBR for "54089-8" remains unchanged
  • All other OBR are removed from the outgoing HL7 ORU message
  • All OBXs appear under the sole remaining OBR

Not compliant requirements:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Test Completeness
The PR lacks tests to verify that OBX IDs are sequential and unique, which is a requirement of the ticket.

Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Score
Possible bug
Define the variable obr4_1 before using it to prevent undefined variable errors

Ensure that the variable obr4_1 is defined before it is used in the expect block to
avoid runtime errors.

etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/ruleengine/transformation/custom/RemoveObservationRequestsTest.groovy [57]

+def obr4_1 = '54089-8'
 obr4_1 in obr4_1Values
Suggestion importance[1-10]: 10

Why: The suggestion correctly identifies a critical bug where the variable obr4_1 is used before being defined, which would cause a runtime error. Defining it before use as suggested will prevent this error.

10
Ensure transformClass and args are initialized to prevent null pointer exceptions

Verify that the transformClass and args are properly defined and initialized before
their use in the when block to ensure the transformation logic is executed
correctly.

etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/ruleengine/transformation/custom/RemoveObservationRequestsTest.groovy [60]

+assert transformClass != null && args != null
 transformClass.transform(fhirResource, args)
Suggestion importance[1-10]: 6

Why: This suggestion is valid as it promotes the initialization check of transformClass and args before their use, which enhances the robustness of the code by preventing potential null pointer exceptions.

6
Best practice
Use safer type checks and conditional casting to avoid runtime exceptions

Replace the direct casting of DiagnosticReport and ServiceRequest with safer type
checks and conditional casting to prevent ClassCastException.

etor/src/test/groovy/gov/hhs/cdc/trustedintermediary/etor/ruleengine/transformation/custom/RemoveObservationRequestsTest.groovy [63-64]

-def dr = diagnosticReports.first() as DiagnosticReport
-def sr = HapiHelper.getServiceRequest(dr)
+def dr = diagnosticReports.first()
+if (dr instanceof DiagnosticReport) {
+    def sr = HapiHelper.getServiceRequest(dr)
+}
Suggestion importance[1-10]: 7

Why: The suggestion to replace direct casting with safer type checks and conditional casting is a good practice to avoid ClassCastException. This change improves the code's safety and robustness.

7
Enhancement
Provide a descriptive message for the transformation definition to enhance clarity and maintainability

Add a meaningful message in the "message" field of the transformation definition to
provide clarity on the operation being performed.

etor/src/main/resources/transformation_definitions.json [173]

-"message": "",
+"message": "This transformation removes all OBRs except for the specified OBR-4.1 value in LA Ochsner ORU messages."
Suggestion importance[1-10]: 5

Why: Adding a descriptive message to the transformation definition is a useful enhancement for clarity and maintainability. However, it's not critical for functionality, hence the moderate score.

5

@saquino0827 saquino0827 marked this pull request as ready for review December 2, 2024 22:29
Copy link
Contributor

@basiliskus basiliskus left a comment

Choose a reason for hiding this comment

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

Left some comments about the MSH-11 expected value

Copy link
Contributor

@basiliskus basiliskus left a comment

Choose a reason for hiding this comment

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

I noticed the files are not following the naming convention here: https://github.com/CDCgov/trusted-intermediary/tree/main/examples#naming-convention. Specifically regarding the suffixes for the flow steps, which are required for the update example script

Copy link

sonarqubecloud bot commented Dec 5, 2024

Copy link
Contributor

@basiliskus basiliskus left a comment

Choose a reason for hiding this comment

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

Thank you for addressing all my comments. Looks good!

@saquino0827 saquino0827 merged commit 459735b into main Dec 6, 2024
17 checks passed
@saquino0827 saquino0827 deleted the remove-la-obr-except-54089-8 branch December 6, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants