Skip to content

[dictionary] Query visits and cohorts once per scan type and category - #11364

Open
HenriRabalais wants to merge 1 commit into
aces:29.0-releasefrom
HenriRabalais:2026-12-03_dictionary-field-queries
Open

HenriRabalais wants to merge 1 commit into
aces:29.0-releasefrom
HenriRabalais:2026-12-03_dictionary-field-queries

Conversation

@HenriRabalais

Copy link
Copy Markdown
Collaborator

Description

/dictionary/module/<name>, which dataquery calls when a category is picked, runs two queries for every field in the module. DataDictRowProvisioner queries the category's cohorts inside the loop over its items, although the cohorts depend only on the category. The imaging query engine's getVisitList() queries a scan type's visits once per field, although every field of a scan type has the same visits. On an instance with many scan types that adds up to thousands of identical queries, and the imaging dictionary takes about half a minute to load.

This moves the cohort query up to once per category, and caches visits per scan type in the imaging query engine, the same way the instruments query engine caches them per instrument. The imaging dictionary now loads in a couple of seconds, and so does the full dictionary that cross-category search needs.

Changes

  • DataDictRowProvisioner runs the cohort query once per category instead of once per item.
  • The imaging QueryEngine::getVisitList() caches the visit list for each scan type.

Testing Instructions

  1. On an instance with imaging data, log in and request GET /dictionary/module/imaging_browser, or pick the imaging category in the dataquery.
  2. Confirm it returns faster than before this change and the response body is the same.

Related Issues

Resolves #11224

@HenriRabalais HenriRabalais added Module: dictionary PR or issue related to (new) dictionary module Module: imaging_browser PR or issue related to imaging_browser module Category: Perfomance Issue or PR that aims to report or improve perfomance Language: PHP PR or issue that update PHP code labels Dec 3, 2026
@HenriRabalais HenriRabalais self-assigned this Dec 3, 2026
@HenriRabalais
HenriRabalais requested a review from driusan December 3, 2026 14:16
HenriRabalais added a commit to HenriRabalais/Loris that referenced this pull request Dec 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Category: Perfomance Issue or PR that aims to report or improve perfomance Language: PHP PR or issue that update PHP code Module: dictionary PR or issue related to (new) dictionary module Module: imaging_browser PR or issue related to imaging_browser module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants