-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
8eab1c1
TN-3291 implement caching of research data, for dramatic performance …
pbugni 1ffc472
pep8 clean-up only
pbugni d66e85f
pep8 clean-up only
pbugni a74591e
patched failing tests: bundled assessment queries require QB association
pbugni 8aa0000
TN-3250 and research_data caching removed the ability to toggle quest…
pbugni 0216f5c
rename variable for fewer source code changes.
pbugni 4f7faf5
pep8
pbugni 47c73ec
pep8
pbugni 0f7e661
added missing `unique=True` detail to `research_data.questionnaire_re…
pbugni 6163c51
patch failing tests: mocking a questionnaire response needs to land i…
pbugni 73c091f
rename variable to reduce # of code changes in branch
pbugni 36d604e
pep issue.
pbugni 4fbfe02
eliminate unused imports.
pbugni 93c4df3
remove redundant unique contraint; questionnaire_response can only be…
pbugni a9e13c4
stick with `user_id` pattern, rather than `patient_id` as db column n…
pbugni bde05f9
research_data subject_id alligns best with questionnaire_response sub…
pbugni f8a03dc
as `invalidate_users_QBT()` also manages adherence and research data …
pbugni 494dc33
when `invalidate_users_QBT()` is called, also clear respective rows f…
pbugni 5c8e291
typo: overlooked `invalidate_existing` param from refactor.
pbugni 3d87a3b
correct failing tests: work around testing scenario with mock QRs and…
pbugni b2c9a92
Shifted version number in migration following rebase with develop
pbugni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
"""Add research_data table, to hold questionnaire response research data in a cache | ||
|
||
Revision ID: daee63f50d35 | ||
Revises: cf586ed4f043 | ||
Create Date: 2024-05-21 17:00:58.204998 | ||
|
||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'daee63f50d35' | ||
down_revision = '6120fcfc474a' | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
'research_data', | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('subject_id', sa.Integer(), nullable=False), | ||
sa.Column('questionnaire_response_id', sa.Integer(), nullable=False), | ||
sa.Column('instrument', sa.Text(), nullable=False), | ||
sa.Column('research_study_id', sa.Integer(), nullable=False), | ||
sa.Column('authored', sa.DateTime(), nullable=False), | ||
sa.Column('data', postgresql.JSONB(astext_type=sa.Text()), nullable=True), | ||
sa.ForeignKeyConstraint(['subject_id'], ['users.id'], ), | ||
sa.ForeignKeyConstraint( | ||
['questionnaire_response_id'], ['questionnaire_responses.id'], ), | ||
sa.PrimaryKeyConstraint('id'), | ||
) | ||
|
||
op.create_index( | ||
op.f('ix_research_data_authored'), 'research_data', ['authored'], unique=False) | ||
op.create_index( | ||
op.f('ix_research_data_instrument'), 'research_data', ['instrument'], unique=False) | ||
op.create_index( | ||
op.f('ix_research_data_subject_id'), 'research_data', ['subject_id'], unique=False) | ||
op.create_index( | ||
op.f('ix_research_data_questionnaire_response_id'), | ||
'research_data', ['questionnaire_response_id'], unique=True) | ||
op.create_index( | ||
op.f('ix_research_data_research_study_id'), | ||
'research_data', ['research_study_id'], unique=False) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index(op.f('ix_research_data_research_study_id'), table_name='research_data') | ||
op.drop_index(op.f('ix_research_data_questionnaire_response_id'), table_name='research_data') | ||
op.drop_index(op.f('ix_research_data_subject_id'), table_name='research_data') | ||
op.drop_index(op.f('ix_research_data_instrument'), table_name='research_data') | ||
op.drop_index(op.f('ix_research_data_authored'), table_name='research_data') | ||
op.drop_table('research_data') | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 avalueString
with a value ofNone
in a questionnaire response, would it?those were showing up as differences in the following test:
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.
probably not-
None
/null isn't the same type as valueString anyway