Skip to content

Conversation

@skarya22
Copy link
Contributor

@skarya22 skarya22 commented Oct 4, 2024

Brief summary of changes

  • Allow filtering by cohort in data dictionary and data dictionary (legacy)

Testing instructions (if applicable)

  1. Open data dictionary
  2. Try to filter by cohort, and confirm by using the test battery that only instruments with sessions in that cohort appear
  3. Confirm for data dictionary (legacy) as well

CCNA OVERRIDE PR

Copy link
Contributor

@maximemulder maximemulder left a comment

Choose a reason for hiding this comment

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

Sorry for the time I took to review. It works on my machine for the new DQT (old one is not loading but probably not related to this PR). It looks good but I have a few minor comments.

Copy link
Contributor

@maximemulder maximemulder left a comment

Choose a reason for hiding this comment

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

Sorry for the double review, but I had a doubt and decided to double check things. Here is another comment.

Comment on lines 72 to 78
$cohorts = $DB->pselectCol(
"SELECT DISTINCT tb.CohortID FROM test_names tn
JOIN test_battery tb ON tn.Test_name=tb.Test_name
WHERE tn.Test_name=:tn
ORDER BY tb.CohortID",
['tn' => $cat->getName()]
);
Copy link
Contributor

Choose a reason for hiding this comment

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

According to this statement, several variables named $cohorts refer to cohort IDs, hence I would prefer them to be named $cohort_ids.

I also see that some of them are documented as of type ?string[], but cohort IDs are nullable integers in the database. This is probably inaccurate ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! I have updated it to use the cohort name instead of the CohortID, as candidate_list does. It makes more sense as now in the list you see the titles instead of the IDs!

@skarya22 skarya22 added the State: Needs work PR awaiting additional work by the author to proceed label Oct 18, 2024
@skarya22 skarya22 assigned skarya22 and unassigned maximemulder Oct 18, 2024
@skarya22 skarya22 requested a review from maximemulder October 18, 2024 18:34
@skarya22 skarya22 removed the State: Needs work PR awaiting additional work by the author to proceed label Oct 18, 2024
@skarya22 skarya22 assigned maximemulder and unassigned skarya22 Oct 18, 2024
Comment on lines 28 to 35
$list_of_cohorts = [];
foreach ($projects AS $projectID) {
$list_of_cohorts = $list_of_cohorts + \Utility::getCohortList($projectID);
}
$cohort_options=[];
foreach (array_values($list_of_cohorts) as $name) {
$cohort_options[$name] = $name;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not like to name a variable $list_of_x as a plural variable name and its type already implies the variable contains a list (or other collection), I'd go back to $cohorts here.

Suggested change
$list_of_cohorts = [];
foreach ($projects AS $projectID) {
$list_of_cohorts = $list_of_cohorts + \Utility::getCohortList($projectID);
}
$cohort_options=[];
foreach (array_values($list_of_cohorts) as $name) {
$cohort_options[$name] = $name;
}
$cohorts = [];
foreach ($projects AS $projectID) {
$cohorts = $cohorts + \Utility::getCohortList($projectID);
}
$cohort_options=[];
foreach (array_values($cohorts) as $name) {
$cohort_options[$name] = $name;
}

Comment on lines +73 to +78
"SELECT GROUP_CONCAT(DISTINCT c.title) FROM test_names tn
JOIN test_battery tb ON tn.Test_name=tb.Test_name
JOIN cohort c ON tb.CohortID=c.CohortID
WHERE tn.Test_name=:tn
ORDER BY c.title",
['tn' => $cat->getName()]
Copy link
Contributor

Choose a reason for hiding this comment

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

I personally prefer to not use group concats (lists should be lists, not strings with commas), but if that's what the rest of the code does I am willing to accept it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this is what the rest of it was like so probably best to keep it the same

Copy link
Contributor

@maximemulder maximemulder left a comment

Choose a reason for hiding this comment

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

Some nits again. Double check the documentation types and I'll test it again. If it works I'll approve the PR.

Copy link
Contributor

@maximemulder maximemulder left a comment

Choose a reason for hiding this comment

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

Works on my machine. (I must shamefully admit that I was testing the DQT and not the data dictionary before, this is much easier to test 😆).

Fixed some formatting for CI.

@skarya22
Copy link
Contributor Author

Thank you for the review and the fix! @maximemulder

@driusan
Copy link
Collaborator

driusan commented Oct 29, 2024

@skarya22 This also has conflicts and can't be merged

@skarya22 skarya22 assigned skarya22 and unassigned maximemulder Oct 29, 2024
@skarya22 skarya22 added the State: Needs work PR awaiting additional work by the author to proceed label Oct 29, 2024
@skarya22 skarya22 removed the State: Needs work PR awaiting additional work by the author to proceed label Oct 29, 2024
@skarya22 skarya22 removed their assignment Oct 29, 2024
@driusan
Copy link
Collaborator

driusan commented Nov 6, 2024

I don't think this is going to scale because it looks like you're making SQL calls in inner loops but I haven't had a chance to test it yet.

@driusan driusan assigned driusan and unassigned maximemulder Nov 11, 2024
@driusan
Copy link
Collaborator

driusan commented Nov 11, 2024

Testing this on a large dataset is in my court

@maximemulder maximemulder added Project: CCNA Issue or PR related to the CCNA project and removed Priority: Projects labels Dec 2, 2024
@driusan
Copy link
Collaborator

driusan commented Feb 17, 2025

I did not test the performance of this, but if it proves problematic it can be optimized after.

@driusan driusan merged commit f86a8ca into aces:main Feb 17, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Project: CCNA Issue or PR related to the CCNA project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants