Skip to content

fix: restore drug profile legend and filter tab functionality broken by DataTables upgrade#2404

Open
D3V41 wants to merge 1 commit intodevelopfrom
fix/restore-drug-profile-view-legend-searchdrug3
Open

fix: restore drug profile legend and filter tab functionality broken by DataTables upgrade#2404
D3V41 wants to merge 1 commit intodevelopfrom
fix/restore-drug-profile-view-legend-searchdrug3

Conversation

@D3V41
Copy link
Copy Markdown
Collaborator

@D3V41 D3V41 commented Apr 8, 2026

Summary

  • Restores the drug profile view legend table (filter tabs + "Change View" link) in SearchDrug3.jsp that was removed in edac1715d550de8062d066badc82eab62d833908
  • Restores server-side drug filtering in ListDrugs.jsp that was commented out in the same commit, causing the Active, Inactive, Long Term/Acute, and External filter tabs to return unfiltered results regardless of which tab was clicked
image

Summary by Sourcery

Restore drug profile legend and filtering functionality in the prescription UI.

Bug Fixes:

  • Reinstate the drug profile legend table and view-switching controls in SearchDrug3.jsp so users can change profile views and access filter tabs again.
  • Re-enable server-side filtering in ListDrugs.jsp so Active, Inactive, Long Term/Acute, and External tabs correctly return filtered drug lists.

Summary by cubic

Restores the drug profile legend (Change View + filter tabs) and fixes server-side filtering and section headings broken by the DataTables upgrade. Users can switch views and see correct Active, Inactive, Long Term, Acute, and External lists with proper headings.

  • Bug Fixes
    • Re-added the legend UI in SearchDrug3.jsp with tabs wired to ListDrugs.jsp AJAX calls, including the combined Long Term/Acute/Inactive/External view.
    • Re-enabled server-side filters in ListDrugs.jsp for status, longTermOnly, and drugLocation, and restored section headings (Long Term Meds, Acute, Inactive, External).

Written for commit e192e60. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes

    • Restored request-driven prescription filtering so status, duration (long‑term/acute), and location parameters correctly control which medications are shown.
  • New Features

    • Added interactive filter controls in the drug profile view (status, long‑term/acute, external) and a provider "change profile view" link for quick, AJAX‑driven updates.

@D3V41 D3V41 self-assigned this Apr 8, 2026
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Apr 8, 2026

Reviewer's Guide

Restores the drug profile legend UI (tabs and change-view link) in SearchDrug3.jsp and re-enables server-side filtering in ListDrugs.jsp so that the profile tabs once again return correctly filtered drug lists.

Sequence diagram for restored drug profile tab filtering

sequenceDiagram
  actor Clinician
  participant Browser
  participant SearchDrug3_jsp
  participant ListDrugs_jsp

  Clinician->>Browser: Clicks Active_tab
  Browser->>SearchDrug3_jsp: onclick callReplacementWebService(ListDrugs.jsp?status=active, drugProfile)
  activate SearchDrug3_jsp
  SearchDrug3_jsp->>ListDrugs_jsp: HTTP GET ListDrugs.jsp?status=active
  activate ListDrugs_jsp
  ListDrugs_jsp->>ListDrugs_jsp: Apply status and longTermOnly and drugLocation filters
  ListDrugs_jsp-->>SearchDrug3_jsp: Filtered HTML fragment for drugProfile
  deactivate ListDrugs_jsp
  SearchDrug3_jsp-->>Browser: Updated drugProfile HTML
  deactivate SearchDrug3_jsp
  Browser->>Browser: Replace drugProfile div contents

  Clinician->>Browser: Clicks LongTermAcuteInactiveExternal_tab
  Browser->>SearchDrug3_jsp: Multiple calls to callReplacementWebService and callAdditionWebService
  activate SearchDrug3_jsp
  SearchDrug3_jsp->>ListDrugs_jsp: GET ListDrugs.jsp?longTermOnly=true&heading=Long_Term_Meds
  SearchDrug3_jsp->>ListDrugs_jsp: GET ListDrugs.jsp?longTermOnly=acute&heading=Acute&status=active
  SearchDrug3_jsp->>ListDrugs_jsp: GET ListDrugs.jsp?longTermOnly=acute&heading=Inactive&status=inactive
  SearchDrug3_jsp->>ListDrugs_jsp: GET ListDrugs.jsp?heading=External&drugLocation=external
  ListDrugs_jsp-->>SearchDrug3_jsp: Filtered segments for each request
  deactivate SearchDrug3_jsp
  Browser->>Browser: Render combined filtered profile view
Loading

File-Level Changes

Change Details Files
Reintroduce the drug profile legend UI and tab interactions in the drug search/profile view.
  • Add a legend table with a 'Change View' link that opens the Rx profile view popup via popupPage().
  • Restore conditional rendering of legend tab links (current, all, active, inactive, and long-term/acute variants) based on existing boolean flags and OscarProperties.
  • Wire each legend tab to callReplacementWebService and callAdditionWebService with appropriate ListDrugs.jsp query parameters and to invoke CngClass(this) to update tab selection styling.
src/main/webapp/oscarRx/SearchDrug3.jsp
Re-enable server-side filtering logic used by the legend/filter tabs when fetching drugs.
  • Uncomment and reinstate request parameter checks for status to filter active vs inactive prescriptions.
  • Reinstate longTermOnly handling to include only long-term or only acute medications based on the parameter value.
  • Reinstate drugLocation='external' filter to include only external drugs when specified.
  • Keep the existing iteration logic otherwise unchanged so that client-side calls now retrieve correctly filtered result sets.
src/main/webapp/oscarRx/ListDrugs.jsp

Possibly linked issues

  • #[Regression]: Rx module no longer allows you to filer the medications list: Issue reports lost Rx filters; PR restores legend UI and ListDrugs.jsp server-side filtering behavior.

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

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Restore drug profile legend and filter tabs functionality

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Uncomments server-side drug filtering logic in ListDrugs.jsp
  - Restores Active, Inactive, Long Term/Acute, External filter functionality
• Restores drug profile legend table in SearchDrug3.jsp
  - Re-adds filter tabs and "Change View" link that were removed
Diagram
flowchart LR
  A["DataTables Upgrade<br/>Broke Filtering"] --> B["Commented Code<br/>in ListDrugs.jsp"]
  C["Missing Legend<br/>in SearchDrug3.jsp"] --> D["No Filter Tabs<br/>or Change View Link"]
  B --> E["Uncomment<br/>Filter Logic"]
  D --> F["Restore Legend<br/>Table HTML"]
  E --> G["Active/Inactive<br/>Filters Work"]
  F --> H["Filter Tabs &<br/>Change View Restored"]
Loading

Grey Divider

File Changes

1. src/main/webapp/oscarRx/ListDrugs.jsp 🐞 Bug fix +23/-23

Restore server-side drug filtering logic

• Uncomments 27 lines of server-side drug filtering logic
• Restores filtering by status (active/inactive)
• Restores filtering by medication type (long-term/acute)
• Restores filtering by drug location (external)

src/main/webapp/oscarRx/ListDrugs.jsp


2. src/main/webapp/oscarRx/SearchDrug3.jsp 🐞 Bug fix +93/-0

Restore drug profile legend and filter tabs

• Adds 93 lines of legend table HTML with filter tabs
• Restores "Change View" link for profile view switching
• Re-adds conditional filter tabs: Show Current, Show All, Active, Inactive
• Re-adds Long Term/Acute and Long Term/Acute/Inactive/External tabs

src/main/webapp/oscarRx/SearchDrug3.jsp


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Apr 8, 2026

Code Review by Qodo

🐞 Bugs (2)   📘 Rule violations (2)   📎 Requirement gaps (0)   🎨 UX Issues (0)
🐞\ ≡ Correctness (2)
📘\ ⚙ Maintainability (2)

Grey Divider


Action required

1. ListDrugs.jsp missing JSP comment 📘
Description
ListDrugs.jsp is modified in this PR but does not include the required comprehensive JSP comment
block after the copyright header (purpose/features/parameters/@since). This reduces maintainability
and violates the JSP documentation standard for modified JSPs.
Code

src/main/webapp/oscarRx/ListDrugs.jsp[R255-277]

+                if (request.getParameter("status") != null) { //TODO: Redo this in a better way
+                    String stat = request.getParameter("status");
+                    if (stat.equals("active") && !prescriptDrug.isLongTerm() && !prescriptDrug.isCurrent()) {
+                        continue;
+                    } else if (stat.equals("inactive") && prescriptDrug.isCurrent()) {
+                        continue;
+                    }
+                }
+                if (request.getParameter("longTermOnly") != null && request.getParameter("longTermOnly").equals("true")) {
+                    if (!prescriptDrug.isLongTerm()) {
+                        continue;
+                    }
+                }
+
+                if (request.getParameter("longTermOnly") != null && request.getParameter("longTermOnly").equals("acute")) {
+                    if (prescriptDrug.isLongTerm()) {
+                        continue;
+                    }
+                }
+                if (request.getParameter("drugLocation") != null && request.getParameter("drugLocation").equals("external")) {
+                    if (!prescriptDrug.isExternal())
+                        continue;
+                }
Evidence
PR Compliance ID 11 requires modified JSPs to include a comprehensive JSP comment block after the
copyright header. The file header shows only the copyright block followed immediately by imports,
with no required purpose/features/parameters/@since block.

CLAUDE.md
src/main/webapp/oscarRx/ListDrugs.jsp[1-49]
src/main/webapp/oscarRx/ListDrugs.jsp[255-277]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`src/main/webapp/oscarRx/ListDrugs.jsp` is modified but lacks the required comprehensive JSP comment block after the copyright header.

## Issue Context
Compliance requires modified JSPs to document purpose, key features, parameters (request/session inputs), and include an `@since` tag.

## Fix Focus Areas
- src/main/webapp/oscarRx/ListDrugs.jsp[1-60]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Duplicate Drug_table IDs 🐞
Description
The restored Long Term/Acute (and related) legend actions append multiple ListDrugs.jsp responses
into the same #drugProfile, but ListDrugs.jsp hard-codes id="Drug_table" and initializes
DataTables/state for that ID. This creates duplicate IDs and repeated DataTables
initialization/state collisions that can break filtering/sorting and produce unpredictable UI
behavior.
Code

src/main/webapp/oscarRx/SearchDrug3.jsp[R1284-1297]

+                      <a href="javascript:void(0);"
+                         onclick="callReplacementWebService('ListDrugs.jsp?longTermOnly=true&heading=Long Term Meds','drugProfile'); callAdditionWebService('ListDrugs.jsp?longTermOnly=acute&heading=Acute','drugProfile');CngClass(this);"
+                         TITLE="<fmt:setBundle basename='oscarResources'/><fmt:message key='SearchDrug.msgLongTermAcuteDesc'/>">
+                        <fmt:setBundle basename="oscarResources"/><fmt:message key="SearchDrug.msgLongTermAcute"/>
+                      </a>
+                    </td>
+                    <%
+                      }
+                      if (longterm_acute_inactive_external) {
+                    %>
+                    <td>
+                      <a href="javascript:void(0);"
+                         onclick="callReplacementWebService('ListDrugs.jsp?longTermOnly=true&heading=Long Term Meds','drugProfile'); callAdditionWebService('ListDrugs.jsp?longTermOnly=acute&heading=Acute&status=active','drugProfile');callAdditionWebService('ListDrugs.jsp?longTermOnly=acute&heading=Inactive&status=inactive','drugProfile');callAdditionWebService('ListDrugs.jsp?heading=External&drugLocation=external','drugProfile');CngClass(this);"
+                         TITLE="<fmt:setBundle basename='oscarResources'/><fmt:message key='SearchDrug.msgLongTermAcuteInactiveExternalDesc'/>">
Evidence
SearchDrug3.jsp restores legend links that call callReplacementWebService plus one or more
callAdditionWebService calls targeting the same DOM container; callAdditionWebService inserts at the
bottom with evalScripts enabled, so each ListDrugs.jsp response’s <table id="Drug_table"> and its
DataTables initialization script execute multiple times in the same document. ListDrugs.jsp
hard-codes the table ID and uses a fixed localStorage key, so multiple sections cannot coexist
without collisions.

src/main/webapp/oscarRx/SearchDrug3.jsp[1283-1301]
src/main/webapp/oscarRx/SearchDrug3.jsp[2225-2254]
src/main/webapp/oscarRx/ListDrugs.jsp[185-187]
src/main/webapp/oscarRx/ListDrugs.jsp[508-518]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`SearchDrug3.jsp` now appends multiple `ListDrugs.jsp` renderings into the same `#drugProfile` via `callAdditionWebService(...)`. `ListDrugs.jsp` renders `<table id="Drug_table">` and runs a DataTables init against `#Drug_table` while persisting state under a fixed `localStorage` key (`drugListTable`). When multiple sections are appended, this creates duplicate IDs and DataTables/state collisions.

### Issue Context
- `callAdditionWebService` uses `Insertion.Bottom` and `evalScripts: true`, so every appended `ListDrugs.jsp` response executes its `<script>` blocks.
- Multiple appended `ListDrugs.jsp` responses produce multiple elements with `id="Drug_table"`.

### Fix Focus Areas
- src/main/webapp/oscarRx/SearchDrug3.jsp[1283-1301]
- src/main/webapp/oscarRx/SearchDrug3.jsp[2225-2254]
- src/main/webapp/oscarRx/ListDrugs.jsp[185-187]
- src/main/webapp/oscarRx/ListDrugs.jsp[508-518]

### Concrete fix options (choose one)
1) **Parameterize table identity per section**
  - Add a request parameter (e.g., `tableId` and `stateKey`) that `SearchDrug3.jsp` passes in each URL.
  - In `ListDrugs.jsp`, set `<table id="${tableId}">` (or scriptlet equivalent) and initialize DataTables on that ID.
  - Use `localStorage` key names that include the tableId (e.g., `drugListTable_${tableId}`) to avoid cross-section state overwrites.

2) **Render into separate containers**
  - Update the legend view to load each section into a distinct container (e.g., `drugProfileLongTerm`, `drugProfileAcute`, `drugProfileInactive`, `drugProfileExternal`) instead of appending all into `drugProfile`.
  - Keep a single `Drug_table` per container/page.

3) **Avoid hard-coded ID**
  - Remove the fixed `id="Drug_table"` and initialize DataTables by selecting the table within the newly inserted fragment only (ensuring you don’t re-init an already-initialized table).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Inactive filter includes long-term 🐞
Description
ListDrugs.jsp’s restored status=inactive filter only excludes isCurrent() drugs, so long-term
drugs with isCurrent()==false (e.g., null/past endDate) can appear under the Inactive tab. This
contradicts the codebase’s own display logic which treats “expired” as !isLongTerm && !isCurrent
and treats long-term drugs as active for display purposes.
Code

src/main/webapp/oscarRx/ListDrugs.jsp[R255-261]

+                if (request.getParameter("status") != null) { //TODO: Redo this in a better way
+                    String stat = request.getParameter("status");
+                    if (stat.equals("active") && !prescriptDrug.isLongTerm() && !prescriptDrug.isCurrent()) {
+                        continue;
+                    } else if (stat.equals("inactive") && prescriptDrug.isCurrent()) {
+                        continue;
+                    }
Evidence
The restored filter’s inactive branch only checks prescriptDrug.isCurrent() and does not exclude
long-term drugs. Drug.isCurrent() returns false when endDate is null/throws, while
EctDisplayRx2Action explicitly classifies expiredDrug as !isLongTerm && !isCurrent and defines
active drugs as (isCurrent && !archived) || isLongTerm, implying long-term drugs should not be
grouped into “inactive/expired”.

src/main/webapp/oscarRx/ListDrugs.jsp[255-277]
src/main/java/ca/openosp/openo/commn/model/Drug.java[738-752]
src/main/java/ca/openosp/openo/commn/model/Drug.java[644-655]
src/main/java/ca/openosp/openo/encounter/pageUtil/EctDisplayRx2Action.java[197-218]
src/main/java/ca/openosp/openo/encounter/pageUtil/EctDisplayRx2Action.java[240-258]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`ListDrugs.jsp` restores server-side filtering for `status=inactive`, but the condition only skips drugs where `prescriptDrug.isCurrent()` is true. This allows long-term prescriptions that are not current (or have null endDate causing `isCurrent()` to be false) to appear in the Inactive results, conflicting with the codebase’s definition of expired/inactive display.

### Issue Context
- `Drug.isCurrent()` returns false when `endDate` is null/throws.
- Elsewhere (`EctDisplayRx2Action`), expired is treated as `!isLongTerm && !isCurrent`, and “active” includes long-term drugs.

### Fix Focus Areas
- src/main/webapp/oscarRx/ListDrugs.jsp[255-277]

### Suggested fix
Update the inactive branch to also exclude long-term drugs, e.g.:
```jsp
} else if ("inactive".equals(stat) && (prescriptDrug.isCurrent() || prescriptDrug.isLongTerm())) {
   continue;
}
```
Optionally, refactor the whole status block to use a single computed boolean for `isActive` consistent with the app’s display semantics (active: current && not archived, OR long-term; inactive/expired: not current AND not long-term).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

4. Inline //TODO on if 📘
Description
An end-of-line comment (//TODO: Redo this in a better way) is attached to an if statement,
instead of being a separate standalone comment line. This reduces readability and violates the
no-inline complexity comment requirement.
Code

src/main/webapp/oscarRx/ListDrugs.jsp[R255-256]

+                if (request.getParameter("status") != null) { //TODO: Redo this in a better way
+                    String stat = request.getParameter("status");
Evidence
PR Compliance ID 12 forbids complex-logic explanations as end-of-line comments; the added `if
(request.getParameter("status") != null) { //TODO: ... }` places the comment inline with the code
statement.

CLAUDE.md
src/main/webapp/oscarRx/ListDrugs.jsp[255-256]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
There is an inline end-of-line `//TODO` comment attached to an `if` statement.

## Issue Context
Compliance requires complex-logic comments to be on their own line(s) (above the relevant logic) to improve readability.

## Fix Focus Areas
- src/main/webapp/oscarRx/ListDrugs.jsp[255-256]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

Dependency Review

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

Snapshot Warnings

⚠️: No snapshots were found for the head SHA e192e60.
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

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d38a4f7e-f87f-4543-80bb-46908259dfa5

📥 Commits

Reviewing files that changed from the base of the PR and between 0211d37 and e192e60.

📒 Files selected for processing (2)
  • src/main/webapp/oscarRx/ListDrugs.jsp
  • src/main/webapp/oscarRx/SearchDrug3.jsp
✅ Files skipped from review due to trivial changes (2)
  • src/main/webapp/oscarRx/ListDrugs.jsp
  • src/main/webapp/oscarRx/SearchDrug3.jsp

📝 Walkthrough

Walkthrough

Re-enables request-driven row filtering in ListDrugs.jsp and adds an interactive legend UI in SearchDrug3.jsp that issues AJAX calls to load filtered drug lists (status, long-term/acute, and location filters).

Changes

Cohort / File(s) Summary
ListDrugs Filtering Logic
src/main/webapp/oscarRx/ListDrugs.jsp
Re-enabled conditional continue filtering inside the prescriptDrugs loop to skip rendering rows based on request params: status (active/inactive), longTermOnly (true / acute), and drugLocation=external.
SearchDrug3 Legend Controls
src/main/webapp/oscarRx/SearchDrug3.jsp
Added a legend table above drugProfile with provider link and interactive filter links (show_current, show_all, active, inactive, long-term/acute combos). Links call AJAX helpers (callReplacementWebService, callAdditionWebService) and update selection state via CngClass(this).

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Legend as SearchDrug3.jsp (Legend UI)
    participant AJAX as AJAX Request
    participant ListDrugs as ListDrugs.jsp (Filter & Render)
    participant Browser as Browser DOM

    User->>Legend: Click filter link
    Legend->>AJAX: callReplacementWebService / callAdditionWebService (filter params)
    AJAX->>ListDrugs: GET ListDrugs.jsp with params (status, longTermOnly, drugLocation)
    ListDrugs->>ListDrugs: Iterate prescriptDrugs, apply request filters, skip non-matching rows
    ListDrugs-->>AJAX: Return filtered HTML
    AJAX-->>Browser: Replace `drugProfile` content and call CngClass
    Browser-->>User: Rendered filtered drug list
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • yingbull
  • lacarmen

Poem

🐰 In a legend of links I hop and play,
Filters click, and lists obey,
Long-term, acute, external too—
I fetch the rows that match for you,
Hooray! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: restoring drug profile legend and filter tab functionality that was broken by a DataTables upgrade, which aligns with the PR objectives and file-level changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/restore-drug-profile-view-legend-searchdrug3

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request restores filtering logic in ListDrugs.jsp and introduces a new legend UI in SearchDrug3.jsp for filtering drug profiles. The feedback suggests optimizing the restored logic by reducing redundant request parameter calls and using more idiomatic string comparisons to improve code quality and maintainability.

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 - I've found 1 issue, and left some high level feedback:

  • In ListDrugs.jsp, the repeated request.getParameter(...) lookups and string equality checks for status, longTermOnly, and drugLocation would be easier to maintain if you cached the parameters into local variables and normalized them once before the loop.
  • The legend markup in SearchDrug3.jsp repeats <fmt:setBundle basename="oscarResources"/> multiple times inside anchors; consider setting the bundle once at a higher scope to reduce noise and potential mistakes.
  • The long onclick handlers in SearchDrug3.jsp that concatenate multiple callReplacementWebService/callAdditionWebService calls are hard to read and error-prone; consider extracting them into named JavaScript functions to make the behavior clearer and easier to modify.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In ListDrugs.jsp, the repeated `request.getParameter(...)` lookups and string equality checks for `status`, `longTermOnly`, and `drugLocation` would be easier to maintain if you cached the parameters into local variables and normalized them once before the loop.
- The legend markup in SearchDrug3.jsp repeats `<fmt:setBundle basename="oscarResources"/>` multiple times inside anchors; consider setting the bundle once at a higher scope to reduce noise and potential mistakes.
- The long `onclick` handlers in SearchDrug3.jsp that concatenate multiple `callReplacementWebService`/`callAdditionWebService` calls are hard to read and error-prone; consider extracting them into named JavaScript functions to make the behavior clearer and easier to modify.

## Individual Comments

### Comment 1
<location path="src/main/webapp/oscarRx/SearchDrug3.jsp" line_range="1223-1224" />
<code_context>
+          <table class="legend">
+            <tr>
+              <td class="legend-change-view">
+                <a href="#"
+                   title="<fmt:setBundle basename="oscarResources"/><fmt:message key="provider.rxChangeProfileViewMessage"/>"
+                   onclick="popupPage(230,860,'../setProviderStaleDate.do?method=viewRxProfileView');"
+                   class="link-red-no-decoration">
</code_context>
<issue_to_address>
**issue (bug_risk):** The nested double quotes in the `title` attribute will break JSP/HTML parsing; adjust quoting for the JSTL tags.

Because the `title` attribute is in double quotes, the inner `<fmt:setBundle basename="oscarResources"/>` also using double quotes will prematurely close the `title` value and break JSP/HTML parsing. Use a consistent quoting strategy, e.g. single quotes for the JSTL attributes (`basename='oscarResources'`) or single quotes around the HTML attribute and keep double quotes inside. Apply the same fix to any other attributes embedding JSTL tags.
</issue_to_address>

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.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-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.

1 issue found across 2 files

Confidence score: 4/5

  • There’s a minor but concrete UI risk: the nested double quotes in the title attribute could break HTML attribute parsing in src/main/webapp/oscarRx/SearchDrug3.jsp.
  • Severity is moderate (6/10) and localized, so overall this looks safe to merge with minimal risk if the markup is corrected.
  • Pay close attention to src/main/webapp/oscarRx/SearchDrug3.jsp - fix the title attribute quoting to avoid malformed HTML.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/main/webapp/oscarRx/SearchDrug3.jsp">

<violation number="1" location="src/main/webapp/oscarRx/SearchDrug3.jsp:1224">
P2: Nested double quotes in the `title` attribute will break HTML attribute parsing. `basename="oscarResources"` uses double quotes inside a double-quoted `title`, which can cause the attribute value to be prematurely terminated. Other title attributes in this same block correctly use single quotes for JSTL tag attributes (e.g., `basename='oscarResources'`). Use single quotes consistently for JSTL attributes inside double-quoted HTML attributes.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@D3V41 D3V41 force-pushed the fix/restore-drug-profile-view-legend-searchdrug3 branch from 0211d37 to e192e60 Compare April 8, 2026 16:40
@D3V41 D3V41 requested a review from LiamStanziani April 8, 2026 16:45
@D3V41 D3V41 linked an issue Apr 8, 2026 that may be closed by this pull request
2 tasks
@D3V41 D3V41 removed the request for review from LiamStanziani April 8, 2026 17:15
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.

[Regression]: Rx module no longer allows you to filer the medications list

1 participant