Skip to content

Fixed "Reason" tab in RX chart#637

Merged
yingbull merged 16 commits intodevelop/dogfishfrom
439-rx-not-saving
Sep 29, 2025
Merged

Fixed "Reason" tab in RX chart#637
yingbull merged 16 commits intodevelop/dogfishfrom
439-rx-not-saving

Conversation

@LiamStanziani
Copy link
Copy Markdown
Collaborator

@LiamStanziani LiamStanziani commented Sep 25, 2025

The "Reason" tab in the RX chart has been fixed, this was due to:

  • Misconfiguration of the issue code parameter
    • The code used an old hidden input attribute that has been commented out already, I switched this to use the autocompled "jsonDxSearch" parameter that is actually sent for the code
  • There was also an issue with getting to the struts action of "RxReason"
    • Since the path of the reason form, and archive had an incomplete path (should have included "${pageContext.request.contextPath}/oscarRx/" in the path)
    • And the action was being blocked from sending correctly due to a js function.

Summary by Sourcery

Fix the "Reason" tab in the RX chart by correcting form submission paths and parameter usage, and update test classes for database setup

Bug Fixes:

  • Correct SelectReason.jsp form actions to include the application context path for RxReason.do
  • Read the ICD code from the jsonDxSearch parameter in RxReason2Action instead of the deprecated hidden input
  • Remove the JavaScript click handler that prevented the reason form from submitting

Tests:

  • Refactor dashboard handler tests to extend DaoTestFixtures and add required imports for database fixtures
  • Update DemographicMergedDaoTest schema restore calls to include necessary tables

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Sep 25, 2025

Reviewer's Guide

This PR fixes the “Reason” tab in the RX chart by correcting form submission parameters and paths, removing a blocking JS handler, and refactoring related dashboard tests to leverage a common DAO test fixture.

Sequence diagram for submitting a drug reason in RX chart (updated parameter and form action)

sequenceDiagram
actor User
participant "SelectReason.jsp"
participant "RxReason2Action.java"
User->>"SelectReason.jsp": Fill and submit 'Assign Indication' form
"SelectReason.jsp"->>"RxReason2Action.java": POST to /oscarRx/RxReason.do with jsonDxSearch parameter
"RxReason2Action.java"->>"RxReason2Action.java": addDrugReason() uses jsonDxSearch for code
"RxReason2Action.java"-->>User: Return response (close window or show message)
Loading

File-Level Changes

Change Details Files
Revise JSP form behavior for RxReason
  • Removed document.ready click handler that prevented form submission
  • Updated form action URLs to include application context path
  • Cleaned up legacy commented-out disease code selector
  • Switched hidden input to use jsonDxSearch for code selection
src/main/webapp/oscarRx/SelectReason.jsp
Update action parameter handling in RxReason2Action
  • Replaced request.getParameter("code") with jsonDxSearch
  • Added JavaDoc for archiveReason method
src/main/java/ca/openosp/openo/prescript/pageUtil/RxReason2Action.java
Refactor dashboard handler tests to use DaoTestFixtures
  • Extended test classes from DaoTestFixtures
  • Added/updated imports for DaoTestFixtures and SpringUtils
  • Removed unused imports and commented-out code
  • Adjusted SchemaUtils.restoreTable calls
src/test/java/ca/openosp/openo/dashboard/handler/DrilldownQueryHandlerTest.java
src/test/java/ca/openosp/openo/dashboard/handler/IndicatorQueryHandlerTest.java
src/test/java/ca/openosp/openo/dashboard/handler/ExcludeDemographicHandlerTest.java
src/test/java/ca/openosp/openo/dashboard/handler/IndicatorTemplateXMLTest.java
src/test/java/ca/openosp/openo/dashboard/handler/IndicatorTemplateHandlerTest.java
src/test/java/ca/openosp/openo/dashboard/handler/DiseaseRegistryHandlerTest.java
src/test/java/ca/openosp/openo/commn/dao/DemographicMergedDaoTest.java

Possibly linked issues

  • Fixed the vulnerabilty #123: The PR fixes the Rx Chart 'Reason' tab not saving by correcting form submission paths and parameter handling.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 25, 2025

Dependency Review

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

Snapshot Warnings

⚠️: No snapshots were found for the head SHA e0a4fe9.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Scanned Files

None

@LiamStanziani
Copy link
Copy Markdown
Collaborator Author

Test fails in the PR? will have to look into this soon

@LiamStanziani LiamStanziani marked this pull request as ready for review September 29, 2025 14:05
@LiamStanziani
Copy link
Copy Markdown
Collaborator Author

Looks like the build is passing now! Sebastian's ticket was the solution for these specific test issues:

#152

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Use JSTL’s <c:url> tag to build form action URLs rather than manually prepending pageContext.request.contextPath for maintainability and correct encoding
  • Rename the hidden input field (id/codeTxt) to match the jsonDxSearch parameter name for clearer front-end/back-end consistency
  • Extract the repeated form action path into a shared JSP include or variable to avoid duplication
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Use JSTL’s <c:url> tag to build form action URLs rather than manually prepending pageContext.request.contextPath for maintainability and correct encoding
- Rename the hidden input field (id/codeTxt) to match the jsonDxSearch parameter name for clearer front-end/back-end consistency
- Extract the repeated form action path into a shared JSP include or variable to avoid duplication

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@yingbull yingbull self-requested a review September 29, 2025 18:26
@yingbull yingbull merged commit 7208264 into develop/dogfish Sep 29, 2025
14 of 15 checks passed
@yingbull yingbull deleted the 439-rx-not-saving branch September 29, 2025 18:28
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.

The Reason in Rx Chart can't be saved, it should be saved into drugReason table in database

2 participants