Skip to content

[dataquery] Query engines report the data they hold - #11236

Open
HenriRabalais wants to merge 8 commits into
aces:mainfrom
HenriRabalais:2026-09-30_engine-availability
Open

HenriRabalais wants to merge 8 commits into
aces:mainfrom
HenriRabalais:2026-09-30_engine-availability

Conversation

@HenriRabalais

@HenriRabalais HenriRabalais commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Dataquery can filter on the value of a field, but it can't say what data a module holds for a candidate or a session. To find the candidates with imaging a user picks a field and infers from a null, and to find which scan types exist they have to try each field in turn.

This lets a query engine describe the states its data goes through as fields in a "Data availability" category. Each field lists, per session, the items in one state, such as the scan types that passed QC. Every engine starts with <module>_HasData, which lists everything it holds any data for, and the rest are its own states, so a project filters on the one that matches what it considers done. They are ordinary fields, so they can be selected, shown per visit and filtered with the existing operators, and a client of the dataquery API finds them the same way in every module.

QueryEngine gets a required getDataAvailabilityItems() that returns these fields in order, which makes every engine provide them. An engine outside this repository needs to implement it on upgrade.

An engine declares each state with DataAvailabilitySources, and DataAvailabilityItem builds the SQL from them: a lookup per session to match, and for the results a temporary table of the requested candidates' items, joined once so that selecting several states doesn't multiply the rows.

imaging_browser reports its states here. biobank, candidate_parameters and instruments return no items for now and report theirs in follow-ups.

Changes

  • Added getDataAvailabilityItems() to QueryEngine, and DataAvailabilityItem and DataAvailabilitySource, which SQLQueryEngine matches and returns.
  • imaging_browser lists imaging_browser_HasData, _Inserted, _QCPassed and _Selected by scan type, with DICOM for an archive or upload.
  • biobank, candidate_parameters and instruments implement getDataAvailabilityItems() with no items.
  • The results view shows a value of a cardinality many field once when its key is the same.
  • Added tests for imaging_browser, and the fields to the dataquery test plan.

Testing Instructions

  1. Run ImagingQueryEngineTest.
  2. In dataquery, select the fields under "Data availability" in Imaging Browser and run the query. Each visit should list the scan types it holds, each one once.
  3. Switch between the Display visits as options. The lists should show in each one.
  4. Add a filter on imaging_browser_QCPassed with in and one scan type, at one visit. It should match the candidates with a file of that scan type that passed QC at that visit.

Filtering these fields with exists or does not exist needs #11235.

Part of #11198

@HenriRabalais HenriRabalais added Module: dataquery PR or issue related to (new) dataquery module Category: Feature PR or issue that aims to introduce a new feature Language: PHP PR or issue that update PHP code Language: Javascript PR or issue that update Javascript code Release: Breaking changes PR that contains changes that might impact the code or accepted practices of active projects labels Oct 3, 2026
@HenriRabalais HenriRabalais self-assigned this Oct 3, 2026
@github-actions github-actions Bot added Module: candidate_parameters PR or issue related to candidate_parameters module Module: dictionary PR or issue related to (new) dictionary module Module: imaging_browser PR or issue related to imaging_browser module Module: instruments PR or issue related to instruments module labels Oct 3, 2026
@HenriRabalais
HenriRabalais force-pushed the 2026-09-30_engine-availability branch from 9665261 to 0c9862f Compare October 4, 2026 02:52
@HenriRabalais HenriRabalais added Module: biobank PR or issue related to biobank module and removed Module: dictionary PR or issue related to (new) dictionary module labels Oct 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: Feature PR or issue that aims to introduce a new feature Language: Javascript PR or issue that update Javascript code Language: PHP PR or issue that update PHP code Module: biobank PR or issue related to biobank module Module: candidate_parameters PR or issue related to candidate_parameters module Module: dataquery PR or issue related to (new) dataquery module Module: imaging_browser PR or issue related to imaging_browser module Module: instruments PR or issue related to instruments module Release: Breaking changes PR that contains changes that might impact the code or accepted practices of active projects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants