-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
Hello @pbugni! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2024-09-05 20:45:35 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: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can't imagine it would ever be worth saving a
valueString
with a value ofNone
in a questionnaire response, would it?
probably not- None
/null isn't the same type as valueString anyway
3c97fdf
to
696a4df
Compare
a869bf0
to
c13ce5a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
@@ -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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can't imagine it would ever be worth saving a
valueString
with a value ofNone
in a questionnaire response, would it?
probably not- None
/null isn't the same type as valueString anyway
d8d0c47
to
1641407
Compare
…ionnaire-response: questionnaire-bank association.
…n the research_data table.
…long to a single patient, no need for a unique(patient, qnr_id)
…caches, refactor `invalidate_existing` out of `update_users_QBT()` for consistent use.
…rom research_data.
2df1268
to
b2c9a92
Compare
…nt (#4382) 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.
…nt (#4382) 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.
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:thereafter, it will generally find zero, as we immediately update on QNR put/post.