Skip to content

Prod release: support unicode in data, load local jsPsych (dev), optimize email task - #1934

Merged
becky-gilbert merged 5 commits into
masterfrom
develop
Sep 18, 2026
Merged

becky-gilbert merged 5 commits into
masterfrom
develop

Conversation

@becky-gilbert

@becky-gilbert becky-gilbert commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

This PR moves the following changes into production:

* use utf-8 encoding for psychds download tmp files: write_overview_to_tmp_file for resp/child overviews; write for all responses JSON in render_to_response (fixes ascii cannot encode character error)

* use utf-8 encoding for frame data dict: less likely but possible for researchers to use unicode in frame IDs and keys

* add tests for non-ascii characters in all changed file operations
* update announcement email query: remove child/family/study cases where a message line exists, even if sent_timestamp is NULL, to ensure that same email is never resent

* add test for study/family/child announcement email targeting with and without an existing message row that has a NULL timestamp

* add more test coverage for announcement emails: existing announcement row should only exclude that specific study/family/child combination from potential targets; inactive users should be excluded as potential targets
* optimize get_child_eligibility_for_study performance: run child in age range check first (pure python) to short-circuit majority of ineligible pairs without having to run DB queries (participation eligibility check) or criteria expression evaluation (eligibility check)

* cache all of the distinct compiled expressions (keyed on the expression string) so that these do not need to be recompiled every time

* update MESSAGE_TARGET_QUERY string to filter study-child pairs on age range eligibility, rather than checking in python post-query: this greatly reduces the number of candidate child-study pairs that the query returns and that the python needs to loop over and check

* update test for the number of potential targets (reduced number because of inclusion of age range filtering in SQL query), add assertions for specific child-study targets and for children filtered out from targets due to age range
…se (#1938)

* optimize get_child_eligibility_for_study performance: run child in age range check first (pure python) to short-circuit majority of ineligible pairs without having to run DB queries (participation eligibility check) or criteria expression evaluation (eligibility check)

* cache all of the distinct compiled expressions (keyed on the expression string) so that these do not need to be recompiled every time

* update MESSAGE_TARGET_QUERY string to filter study-child pairs on age range eligibility, rather than checking in python post-query: this greatly reduces the number of candidate child-study pairs that the query returns and that the python needs to loop over and check

* update test for the number of potential targets (reduced number because of inclusion of age range filtering in SQL query), add assertions for specific child-study targets and for children filtered out from targets due to age range

* add jspsych study type to the check for previous study participation (exclude if child has completed the consent frame)

* add tests for excluding child with existing jspsych study response from message targets and including if completed consent frame is false
@sonarqubecloud

Copy link
Copy Markdown

@becky-gilbert becky-gilbert self-assigned this Sep 17, 2026
@becky-gilbert becky-gilbert changed the title Prod release: support unicode in data, load local jsPsych (dev) Prod release: support unicode in data, load local jsPsych (dev), optimize email task Sep 17, 2026
@becky-gilbert
becky-gilbert marked this pull request as ready for review September 17, 2026 05:51
@becky-gilbert
becky-gilbert merged commit d0e2c34 into master Sep 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant