Repository navigation
[dataquery] Query engines report the data they hold - #11236
Open
HenriRabalais wants to merge 8 commits into
Open
HenriRabalais wants to merge 8 commits into
HenriRabalais wants to merge 8 commits into
Conversation
HenriRabalais
force-pushed
the
2026-09-30_engine-availability
branch
from
October 4, 2026 02:52
9665261 to
0c9862f
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.QueryEnginegets a requiredgetDataAvailabilityItems()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, andDataAvailabilityItembuilds 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
getDataAvailabilityItems()toQueryEngine, andDataAvailabilityItemandDataAvailabilitySource, whichSQLQueryEnginematches and returns.imaging_browser_HasData,_Inserted,_QCPassedand_Selectedby scan type, withDICOMfor an archive or upload.getDataAvailabilityItems()with no items.Testing Instructions
ImagingQueryEngineTest.Display visits asoptions. The lists should show in each one.imaging_browser_QCPassedwithinand 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
existsordoes not existneeds #11235.Part of #11198