fix(suggestions): TAMOC-388: 2.47 hotfix: Sorting on hierarchy suggesters with parent_id#9105
Conversation
Summary of ChangesHello @dannash100, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request delivers a crucial fix for sorting inconsistencies within the application's suggestion API and UI components. It ensures that hierarchical data, such as subdivisions filtered by a parent, and medication sets are consistently presented in alphabetical order. The backend logic for parent-child relationships has been refactored to use subqueries, enhancing efficiency and clarity. Additionally, translated enum options in the UI now display in a predictable, sorted manner, improving user experience. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
bugbot run |
|
Skipping Bugbot: Bugbot is disabled for this repository |
|
bugbot run |
|
Android builds 📱
|
🍹
|
|
bugbot run |
🍹
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request effectively addresses a sorting issue in hierarchical suggesters by replacing a JOIN with a subquery for parent ID filtering. This change prevents ambiguous column conflicts and correctly re-enables alphabetical sorting, which was previously disabled for these queries. The fix is well-supported by new tests covering sorting with both standard and translated names, as well as for complex cases like medication sets. My main feedback is a minor improvement to ensure deterministic option ordering in TranslatedEnumField, as mentioned in the pull request's goals.
…ters with parent_id (#9105) * wip * wip * fix hierarchy sorting * ya * ya * rename
…ters with parent_id (#9105) * wip * wip * fix hierarchy sorting * ya * ya * rename
…ters with parent_id (#9105) * wip * wip * fix hierarchy sorting * ya * ya * rename
…ters with parent_id (#9105) * wip * wip * fix hierarchy sorting * ya * ya * rename
…ters with parent_id (#9105) * wip * wip * fix hierarchy sorting * ya * ya * rename
…ters with parent_id (#9105) * wip * wip * fix hierarchy sorting * ya * ya * rename
* release: Cut-off for release/2.53 * fix(sync): TAMOC-410: Rebuild encounter_history in sync_lookup for change_type (HOTFIX 2.53) (#9515) fix(sync): TAMOC-410: Rebuild encounter_history in sync_lookup for change_type column (MAIN) (#9476) * rebuild encounter_history in sync_lookup * add comment * fix(suggestions): 2.53 fix: don’t filter by facility from Admin Panel (#9538) fix calls from central server * fix(permissions): 2.53 fix: `LabTestResult`’s list permission (#9539) * fix * animate disclosure icon * remove dead imports * fix(charting): 2.53 fix: show permission denied message instead of misleading no-charts message (#9537) fix(charting): show permission denied message instead of misleading no-charts message When a user lacks Charting list permission, the server filters out all chart surveys. The ChartsPane then shows "no charts available" instead of a proper permission denied message. Wrap ChartsPane with EncounterPaneWithPermissionCheck to match other permission-gated tabs. Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> * fix(invoicing): 2.53 fix: use invoice insurance plans in PDF header instead of legacy patient insurer (#9546) fix(invoicing): no-issue: use invoice insurance plans in PDF header instead of legacy patient insurer The invoice PDF header was reading the insurer name from patient.additionalData.insurer (a legacy patient-level field) rather than from invoice.insurancePlans (the plans actually selected on the invoice). This caused the "Insurer" field to appear blank on printed invoices when the legacy enablePatientInsurer setting was disabled, even though insurance plans were visible on the web UI. Now derives the insurer display from invoice.insurancePlans when present, falling back to the legacy patient-level field for backward compatibility. Made-with: Cursor Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * fix(tasks): Release fix 2.53: Update task list on area change (#9548) * Update DashboardTaskPane.jsx * Update DashboardTaskPane.jsx * fix: prevent race condition when changing location area When the area changes while a location is selected, LocationInput's handleChangeCategory calls both onGroupChange and onChange synchronously, causing two preference mutations with stale data. The first mutation from onLocationGroupIdChange was spreading the stale filter including the old locationId, while the second correctly cleared it. This created a race where the first mutation could persist invalid state. Fixed by making onLocationGroupIdChange always clear locationId when changing the group, ensuring both mutations write consistent state. Applied via @cursor push command * fix: preserve locationId during initialization when auto-detecting location group When LocationInput auto-detects the location group for an existing location during initialization, preserve the locationId in preferences instead of stripping it. This prevents existing users with saved location filters from having their locationId silently cleared on first load. Applied via @cursor push command --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> * fix(notifications): Release fix v2.53: Filter notifications linked to sensitive data (#9557) * filter notifications by sensitivity * refactor: reuse ADD_SENSITIVE_FACILITY_ID_IF_APPLICABLE constant in Notification model Replace duplicated sensitive facility SQL with the exported constant from buildEncounterLinkedLookupFilter to avoid maintenance drift. Applied via @cursor push command --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> * fix(programRegistry): 2.53: prevent survey submission from overwriting registration date (#9555) * fix(programRegistry): no-issue: prevent survey responses from overwriting registration date When a survey response updates an existing PatientProgramRegistration, the registration date was unconditionally set to the survey submission time. This only makes sense for new registrations. Made-with: Cursor * refactor(mobile): remove redundant getRecentOne query in writeToPatientFields Move the existing-registration check and date logic into upsertRegistration so the lookup happens once, matching the server-side implementation. Made-with: Cursor * fix(mobile): match server spread order for registration date fallback Move submittedTime before survey data spread so a survey-provided date overrides the fallback, consistent with the server create path. Made-with: Cursor * test(programRegistry): cover registration date on survey submission Assert new registrations use endTime as date and updates do not overwrite it. Made-with: Cursor * fix(sync): 2.53 fix: Filter task designations from sensitive facility sync (#9533) fix(sync): no-issue: Filter task designations from sensitive facility sync * fix(labs): Release fix v2.53: Lab panel override edge case (#9574) * Update LabRequestFormScreen2.jsx * Update LabRequestFormScreen2.jsx * fix(suggestions): TAMOC-388: 2.53 hotfix: Sorting on hierarchy suggesters with parent_id (#9580) fix(suggestions): TAMOC-388: 2.47 hotfix: Sorting on hierarchy suggesters with parent_id (#9105) * wip * wip * fix hierarchy sorting * ya * ya * rename * fix(surveyResponse): Fix release 2.53: Fix default survey code outside facility bug (#9581) * first draft * appropriate errors * cleanup overengineered util * Update SurveyResponseAnswer.ts * Update SurveyResponseAnswer.ts * fix(print): 2.53: fix attendant field on FSM birth certificate and use enum translations (#9571) * fix(print): no-issue: fix attendant field on FSM birth certificate and use enum translations The FSM birth certificate "Attendant" field was incorrectly displaying nameOfAttendantAtBirth (free text) instead of attendantAtBirth (the enum type e.g. Doctor/Nurse/Midwife). Also migrates both birth notification certificates and the FSM death certificate from getLabelFromValue with _OPTIONS constants to getEnumTranslation with _LABELS for proper i18n support. Registers BINARY_LABELS in the enum registry for death certificate binary fields (autopsy, pregnant, injury at work). Fixes the MARTIAL_STATUS typo to MARITAL_STATUS across constants, enum registry, surveys, schema validation, and form fields. Made-with: Cursor * gonna do this cleanup 2 * fix(print): remove unused _OPTIONS constants from birth constants These _OPTIONS arrays are no longer imported anywhere after migrating certificates to use _LABELS with getEnumTranslation. Also removes the entirely unused web/app/constants/births.js file. Made-with: Cursor * fix(print): 2.53: fix attendant field on FSM birth certificate and use enum translations Made-with: Cursor * fix(death): Release fix 2.53: Validate manner of death of form submit (#9584) Update DeathForm.jsx --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: chris-bes <63621318+chris-bes@users.noreply.github.com> Co-authored-by: Jasper Lai <33956381+jaskfla@users.noreply.github.com> Co-authored-by: Daniel Nash <38335330+dannash100@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Changes
Children Hierarchy fields would not sort alphabetically due to an exclusion added in medication epic to avoid ambiguous include issue.
I have also loaded Hierarchy reference data into deployed environment, and tested location hierarchy and medication set suggesters
Deploys
Tests
Remember to...
Note
Medium Risk
Changes how many
ReferenceDatasuggestion endpoints filter byparentId(moving from a self-join include to anIN (subquery)), which can affect result ordering/limits across address hierarchy and other reference types. While covered by added tests, it touches a high-traffic query path and could have SQL/performance edge cases in production data.Overview
Fixes
ReferenceDatasuggestion sorting when using hierarchical filters by switchingparentIdfiltering to anid IN (SELECT …)subquery and ensuring the default alphabetical order (including translated names) is still applied.Also tightens up ID exclusion logic for
medicationSet/noteTypesuggesters when combined with other filters, adds regression tests for parent-filtered sorting (including translations) and medication set sorting with complex includes, and makesTranslatedEnumFieldoption generation deterministic by sortingenumValuesentries before translating.Written by Cursor Bugbot for commit 3bba737. This will update automatically on new commits. Configure here.