Skip to content

[Candidate Identifier (Rework Part 7)] Add Candidate Identifiers Query Engine to Data Query Tool - #11298

Open
HachemJ wants to merge 6 commits into
aces:mainfrom
HachemJ:AddCandidateIdentifiersQueryEngine
Open

HachemJ wants to merge 6 commits into
aces:mainfrom
HachemJ:AddCandidateIdentifiersQueryEngine

Conversation

@HachemJ

@HachemJ HachemJ commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Brief summary of changes

This PR adds support for configurable candidate identifiers in the Data Query Tool (DQT), allowing users to filter candidates using their identifiers and include identifier values in query results.

Previously, the DQT relied on the legacy candidate identifier fields. With the new Candidate Identifiers Query Engine, identifier types configured through the Candidate Identifiers module are dynamically available for querying.

This PR depends on #11288.

Changes

  • Added a Candidate Identifiers Query Engine that exposes configured identifier types, such as PSCID and ExternalID, as fields in the DQT.
  • Added support for filtering candidates by identifier values using the existing DQT query operators.
  • Added support for retrieving both single-value and multiple-value identifiers, including displaying multiple values for the same candidate.
  • Added permission checks so identifier types requiring specific permissions are only accessible to authorized users.
  • Added project restrictions so identifier values are only returned for candidates registered in the permitted projects.
  • Renamed the existing identifier category to "Legacy Candidate Identifiers" to distinguish it from the new configurable identifiers.
  • Added PHPUnit tests covering identifier filtering, data retrieval, and multiple identifier values.

Testing Instructions

  1. Activate the candidate_identifiers module, as it is installed inactive by default. The new category will only appear in the DQT once the module is activated.

  2. Open the Data Query Tool (Beta) and continue to Define Fields.

  3. Verify that the "Candidate Identifiers" category appears and contains configured identifier types such as PSCID and ExternalID.

  4. Select an identifier field, filter by a known value, and verify that the correct candidates are returned.

  5. Add PSCID and ExternalID as output fields and verify that their values are displayed correctly.

  6. Test an identifier type that allows multiple values and verify that all associated values are returned and displayed.

  7. Log in with a user who lacks permission for a restricted identifier type and verify that the field is not available.

  8. Verify that identifier types without additional permission restrictions remain available.

  9. Restrict an identifier type to a specific project and verify that its values are only returned for candidates registered in that project.

  10. Run the Candidate Identifiers Query Engine PHPUnit tests and verify that all tests pass:

    LORIS_DB_CONFIG=/path/to/credentials \
    vendor/bin/phpunit --bootstrap test/bootstrap.php \
    modules/candidate_identifiers/test/candidateIdentifiersQueryEngineTest.php
image

@github-actions github-actions Bot added Language: SQL PR or issue that update SQL code Language: PHP PR or issue that update PHP code Language: Javascript PR or issue that update Javascript code Module: api PR or issue related to api module Module: candidate_parameters PR or issue related to candidate_parameters module Module: configuration PR or issue related to configuration module Module: new_profile PR or issue related to new_profile module Module: dataquery PR or issue related to (new) dataquery module Multilingual Any tasks related to making LORIS multilingual labels Nov 6, 2026
@HachemJ HachemJ added State: Blocked PR or issue awaiting an external event such as the merge or another PR to proceed and removed Language: SQL PR or issue that update SQL code Language: PHP PR or issue that update PHP code Language: Javascript PR or issue that update Javascript code Module: api PR or issue related to api module Module: candidate_parameters PR or issue related to candidate_parameters module Module: configuration PR or issue related to configuration module Module: new_profile PR or issue related to new_profile module Module: dataquery PR or issue related to (new) dataquery module Multilingual Any tasks related to making LORIS multilingual labels Nov 6, 2026
@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersQueryEngine branch from c36beac to 458df71 Compare November 6, 2026 21:33
@github-actions github-actions Bot added Language: SQL PR or issue that update SQL code Language: PHP PR or issue that update PHP code Language: Javascript PR or issue that update Javascript code Module: api PR or issue related to api module Module: candidate_parameters PR or issue related to candidate_parameters module Module: configuration PR or issue related to configuration module Module: new_profile PR or issue related to new_profile module Module: dataquery PR or issue related to (new) dataquery module Multilingual Any tasks related to making LORIS multilingual labels Nov 6, 2026
@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersQueryEngine branch 7 times, most recently from ef3dea1 to f46fe32 Compare November 10, 2026 16:09
@HachemJ
HachemJ marked this pull request as ready for review November 10, 2026 16:19
@HachemJ HachemJ added the State: Blocking PR should be prioritized because it is blocking the progress of another task label Nov 17, 2026
@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersQueryEngine branch 6 times, most recently from 8662abf to cfeb84a Compare November 19, 2026 19:57

@HenriRabalais HenriRabalais left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@HachemJ

thanks for getting candidate fields with several values working in dataquery! A few comments inline, mostly small.

For the testing steps, the candidate_identifiers module is installed as inactive, so the new category only shows up in dataquery once it's turned on.

@ridz1208 with this in, PSCID shows up twice in dataquery, once under "Legacy Candidate Identifiers" and once under the new category. Should the legacy fields stay for now since saved queries use them, or go once the identifiers are migrated?

default:
throw new Error('Too many visit values');
}
} else if (dictionary?.scope === 'candidate' &&

@HenriRabalais HenriRabalais Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this same block is here, at line 769 and at line 930, joined with ; in two of them and ; in the third. Could it be one helper that takes the cell and the dictionary item?

Comment thread modules/dataquery/jsx/viewdata.tsx Outdated
if (dictionary.type === 'URI') {
return values[key];
}
return key + '=' + values[key];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

for identifiers the key is the CandidateIdentifierID, so a candidate with two values shows something like 4512=ABC;4513=DEF, and the numbers don't mean anything to the user. Could identifiers show just the values, like the URI case does?

$ids = new \LORIS\Data\Dictionary\Category(
"Identifiers",
dgettext("candidate_parameters", "Candidate Identifiers")
"Legacy Candidate Identifiers"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the label lost its dgettext() here, so it won't be translated anymore. Same for the new "Candidate Identifiers" category in queryengine.class.inc:47


$name = $item->getName();

if (!preg_match('/^Identifier_([1-9][0-9]*)$/', $name, $matches)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

small one, this parses the name again right after getFieldNameFromDict() did, could a private helper give both of them the alias?

@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersQueryEngine branch 2 times, most recently from 0a969fb to 1d8ea6c Compare November 26, 2026 16:09
@HachemJ

HachemJ commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks once again Henri!

I have addressed your comments and updated the testing instructions.

@HachemJ
HachemJ force-pushed the AddCandidateIdentifiersQueryEngine branch from 1d8ea6c to 296512f Compare November 27, 2026 20:10

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

Language: Javascript PR or issue that update Javascript code Language: PHP PR or issue that update PHP code Language: SQL PR or issue that update SQL code Module: api PR or issue related to api module Module: candidate_parameters PR or issue related to candidate_parameters module Module: configuration PR or issue related to configuration module Module: dataquery PR or issue related to (new) dataquery module Module: new_profile PR or issue related to new_profile module Multilingual Any tasks related to making LORIS multilingual State: Blocked PR or issue awaiting an external event such as the merge or another PR to proceed State: Blocking PR should be prioritized because it is blocking the progress of another task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants