Skip to content

Feat: add specialist name to the eChart Consultations box#160

Open
LiamStanziani wants to merge 4 commits into
MagentaHealth:release/2026-03-17from
openo-beta:feat/specialist-name-in-consultation-echart-box-base-release
Open

Feat: add specialist name to the eChart Consultations box#160
LiamStanziani wants to merge 4 commits into
MagentaHealth:release/2026-03-17from
openo-beta:feat/specialist-name-in-consultation-echart-box-base-release

Conversation

@LiamStanziani

@LiamStanziani LiamStanziani commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds the referred-to specialist's name into each row of the Consultations box in the eChart
left navbar, so referrals can be identified at a glance without opening them. Rows now read
Service - Specialist before the date (e.g. OBGYN - Smith, John ... 2023-09-15), and the hover
tooltip is aligned to the same format.

Original PR: openo-beta#2487

Problem

In the eChart Consultations box, each referral row showed only the service type and the referral
date — with no indication of who the referral was to:

OBGYN  ......  2023-09-15

This made it slow to identify the right referral when processing appointment notifications or
locating a referral referenced in a tickler, and contributed to duplicate-referral errors (a new
referral created when one already existed).

Solution

Surface the specialist inline as Service - Specialist, immediately before the existing date. The
specialist name was already loaded by the same query that builds the list (and already shown in the
row's hover tooltip), so this surfaces existing data rather than adding any new query.

Changes:

  • EctDisplayConsult2Action.java — builds the row label as Service - Specialist, omitting
    whichever part is missing so there is never a stray separator or an "N/A" placeholder
    (both → Service - Specialist; specialist only → Specialist; service only → Service). The
    visible title and the hover tooltip now use the same format; the tooltip also appends the date,
    replacing the legacy Service(Specialist) Date parenthesis format (which removes the old
    Service(N/A) Date artifact on no-specialist rows).
  • ConsultationListDTO.javaNOT_APPLICABLE ("N/A") promoted to public so the
    no-specialist sentinel has a single source of truth that the action references.
  • Output encoding — both HTML sinks are encoded in the action: Encode.forHtml(...) for the visible title (anchor body) and Encode.forHtmlAttribute(...) for the tooltip (title= attribute), since specialist names are user-entered. Encoding is done at the source, not in the shared LeftNavBarDisplay.jsp, because that JSP renders the title as raw HTML for boxes that intentionally embed markup (e.g. EctDisplayPregnancy2Action's red ), so a blanket sink-level encode would break them. The visible title is length-capped before encoding so the cap can't split an HTML entity; the tooltip is left full-length by design.

Behavior (visible row / hover tooltip):

Case Visible Hover
Normal referral OBGYN - Smith, John OBGYN - Smith, John 2023-09-15
No specialist OBGYN OBGYN 2023-09-15
eReferral Cardiology - Dr. Jones Cardiology - Dr. Jones 2023-09-15
Empty service + specialist Smith, John Smith, John 2023-09-15

UI Before:

image image

UI After

image image

Summary by Sourcery

Improve eChart Consultations list to show clearer referral information inline and in tooltips.

New Features:

  • Display the referred specialist name alongside the service in each eChart Consultations row and its hover tooltip.

Enhancements:

  • Standardize consultation hover tooltip format to Service - Specialist Date, omitting missing parts without placeholder artifacts.
  • Expose the NOT_APPLICABLE sentinel in ConsultationListDTO for reuse when handling missing specialist values.
  • HTML-encode consultation titles and tooltips at the source to safely render user-entered specialist names.

… the hover format to follow the new format in the echart box, guard for missing values to format correctly in potential use cases
…l and conditional path for hasService boolean, catch potential formatting issue with LinkTitle if referralLabel is empty (fall back to only service date in that case), and encode LinkTitle and Title
@LiamStanziani LiamStanziani self-assigned this Jun 29, 2026
@sourcery-ai

sourcery-ai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds specialist names to eChart Consultation box row labels and hover tooltips, refactors label construction to handle missing values and the "N/A" sentinel cleanly, and HTML-encodes titles/tooltips to safely render user-entered data.

File-Level Changes

Change Details Files
Consultation row labels and tooltips now show "Service - Specialist" before the date with robust handling of missing fields and the "N/A" sentinel.
  • Replace legacy "Service(Specialist) Date" link title format with a "label date" format where the label is built from service and specialist.
  • Compute a referral label that conditionally includes service, specialist, or both, skipping empty and "N/A" values so there is no stray separator or placeholder.
  • Use the referral label alone for the visible title and append the date only to the tooltip, using just the date when both service and specialist are missing.
src/main/java/ca/openosp/openo/encounter/pageUtil/EctDisplayConsult2Action.java
HTML encoding is applied at the action level for consultation titles and tooltips to protect user-entered specialist names while respecting existing JSP behavior.
  • Encode linkTitle with HTML attribute encoding before passing it to the JSP so the title attribute is safe.
  • Encode the visible title text with HTML encoding after length-capping the referral label, to avoid splitting entities.
  • Keep encoding localized to the action instead of in the shared LeftNavBar JSP, preserving other boxes that intentionally inject markup.
src/main/java/ca/openosp/openo/encounter/pageUtil/EctDisplayConsult2Action.java
The "N/A" sentinel for specialists is shared via a public constant so referral label logic can consistently detect the no-specialist case.
  • Promote NOT_APPLICABLE from a private to a public static constant on the DTO.
  • Reference the DTO constant from the action when determining whether the specialist field should be treated as absent.
src/main/java/ca/openosp/openo/consultation/dto/ConsultationListDTO.java
src/main/java/ca/openosp/openo/encounter/pageUtil/EctDisplayConsult2Action.java

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

@LiamStanziani LiamStanziani marked this pull request as ready for review June 29, 2026 17:33

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The referral label construction logic in EctDisplayConsult2Action (service/specialist combination, trimming, and NOT_APPLICABLE handling) is getting a bit dense; consider extracting it into a small helper method for readability and easier reuse/tests if other views need the same format.
  • Promoting ConsultationListDTO.NOT_APPLICABLE to public makes it accessible but ties other callers to this DTO; if this sentinel is shared domain-wide, consider moving it to a dedicated constants or utility class so the DTO doesn’t become a general-purpose constants holder.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The referral label construction logic in `EctDisplayConsult2Action` (service/specialist combination, trimming, and NOT_APPLICABLE handling) is getting a bit dense; consider extracting it into a small helper method for readability and easier reuse/tests if other views need the same format.
- Promoting `ConsultationListDTO.NOT_APPLICABLE` to `public` makes it accessible but ties other callers to this DTO; if this sentinel is shared domain-wide, consider moving it to a dedicated constants or utility class so the DTO doesn’t become a general-purpose constants holder.

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.

@LiamStanziani LiamStanziani requested a review from lacarmen June 29, 2026 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.

1 participant