Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TN-3291 implement caching of research data, for performance improvement #4382

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

pbugni
Copy link
Collaborator

@pbugni pbugni commented Jun 4, 2024

Reports from the field - the generation of research_data has become unreliable due to time it takes to build report.

Now retaining a table of cached values, one row per questionnaire response, for a responsive report generation.

Primary concern will be with cache-invalidation, especially on an org change of research protocol or a user's consent date change.

There is now a scheduled job that runs daily, to seek out any overlooked QNRs missing from this new cache table research_data. A dry run of the prod db:

"found 92748 questionnaire responses missing from research_data cache"
[...]
""Task portal.tasks.cache_research_data_task[f87d7130-d2b2-4413-a461-61cf3ebc9594] succeeded in 32897.385058208994s"

thereafter, it will generally find zero, as we immediately update on QNR put/post.

@pep8speaks
Copy link

pep8speaks commented Jun 4, 2024

Hello @pbugni! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2024-07-02 21:19:02 UTC

@@ -370,7 +370,8 @@ def quote_double_quote(value):
answer['valueCoding'].get('text')
)

text_and_coded_answers.append({'valueString': text_answer})
if text_answer is not None:
Copy link
Collaborator Author

@pbugni pbugni Jun 12, 2024

Choose a reason for hiding this comment

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

@ivan-c this change was necessary to get tests to pass, as some results after posting an update to a questionnaire response, would show valueString: None. i can't imagine it would ever be worth saving a valueString with a value of None in a questionnaire response, would it?

those were showing up as differences in the following test:

 py.test tests/test_assessment_engine.py::TestAssessmentEngine::test_update_assessment

@pbugni pbugni marked this pull request as ready for review June 13, 2024 03:33
@pbugni pbugni requested review from mcjustin and ivan-c June 13, 2024 03:33
Base automatically changed from feature/sequential-hard-triggers-fix to develop July 2, 2024 19:01
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.

None yet

2 participants