-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
2,832 additions
and
1,662 deletions.
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
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,76 @@ | ||
"""add patient_list table for paginated /patients view | ||
Revision ID: 038a1a5f4218 | ||
Revises: daee63f50d35 | ||
Create Date: 2024-09-30 16:10:26.216512 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '038a1a5f4218' | ||
down_revision = 'daee63f50d35' | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('patient_list', | ||
sa.Column('userid', sa.Integer(), nullable=False), | ||
sa.Column('study_id', sa.Text(), nullable=True), | ||
sa.Column('firstname', sa.String(length=64), nullable=True), | ||
sa.Column('lastname', sa.String(length=64), nullable=True), | ||
sa.Column('birthdate', sa.Date(), nullable=True), | ||
sa.Column('email', sa.String(length=120), nullable=True), | ||
sa.Column('questionnaire_status', sa.Text(), nullable=True), | ||
sa.Column('empro_status', sa.Text(), nullable=True), | ||
sa.Column('clinician', sa.Text(), nullable=True), | ||
sa.Column('action_state', sa.Text(), nullable=True), | ||
sa.Column('visit', sa.Text(), nullable=True), | ||
sa.Column('empro_visit', sa.Text(), nullable=True), | ||
sa.Column('consentdate', sa.DateTime(), nullable=True), | ||
sa.Column('empro_consentdate', sa.DateTime(), nullable=True), | ||
sa.Column('org_name', sa.Text(), nullable=True), | ||
sa.Column('deleted', sa.Boolean(), nullable=True), | ||
sa.Column('test_role', sa.Boolean(), nullable=True), | ||
sa.Column('org_id', sa.Integer(), nullable=True), | ||
sa.Column('last_updated', sa.DateTime(), nullable=False), | ||
sa.ForeignKeyConstraint(['org_id'], ['organizations.id'], ), | ||
sa.PrimaryKeyConstraint('userid') | ||
) | ||
op.create_index(op.f('ix_patient_list_action_state'), 'patient_list', ['action_state'], unique=False) | ||
op.create_index(op.f('ix_patient_list_birthdate'), 'patient_list', ['birthdate'], unique=False) | ||
op.create_index(op.f('ix_patient_list_clinician'), 'patient_list', ['clinician'], unique=False) | ||
op.create_index(op.f('ix_patient_list_consentdate'), 'patient_list', ['consentdate'], unique=False) | ||
op.create_index(op.f('ix_patient_list_email'), 'patient_list', ['email'], unique=False) | ||
op.create_index(op.f('ix_patient_list_empro_consentdate'), 'patient_list', ['empro_consentdate'], unique=False) | ||
op.create_index(op.f('ix_patient_list_empro_status'), 'patient_list', ['empro_status'], unique=False) | ||
op.create_index(op.f('ix_patient_list_empro_visit'), 'patient_list', ['empro_visit'], unique=False) | ||
op.create_index(op.f('ix_patient_list_firstname'), 'patient_list', ['firstname'], unique=False) | ||
op.create_index(op.f('ix_patient_list_lastname'), 'patient_list', ['lastname'], unique=False) | ||
op.create_index(op.f('ix_patient_list_org_name'), 'patient_list', ['org_name'], unique=False) | ||
op.create_index(op.f('ix_patient_list_questionnaire_status'), 'patient_list', ['questionnaire_status'], unique=False) | ||
op.create_index(op.f('ix_patient_list_study_id'), 'patient_list', ['study_id'], unique=False) | ||
op.create_index(op.f('ix_patient_list_visit'), 'patient_list', ['visit'], unique=False) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index(op.f('ix_patient_list_visit'), table_name='patient_list') | ||
op.drop_index(op.f('ix_patient_list_study_id'), table_name='patient_list') | ||
op.drop_index(op.f('ix_patient_list_questionnaire_status'), table_name='patient_list') | ||
op.drop_index(op.f('ix_patient_list_org_name'), table_name='patient_list') | ||
op.drop_index(op.f('ix_patient_list_lastname'), table_name='patient_list') | ||
op.drop_index(op.f('ix_patient_list_firstname'), table_name='patient_list') | ||
op.drop_index(op.f('ix_patient_list_empro_visit'), table_name='patient_list') | ||
op.drop_index(op.f('ix_patient_list_empro_status'), table_name='patient_list') | ||
op.drop_index(op.f('ix_patient_list_empro_consentdate'), table_name='patient_list') | ||
op.drop_index(op.f('ix_patient_list_email'), table_name='patient_list') | ||
op.drop_index(op.f('ix_patient_list_consentdate'), table_name='patient_list') | ||
op.drop_index(op.f('ix_patient_list_clinician'), table_name='patient_list') | ||
op.drop_index(op.f('ix_patient_list_birthdate'), table_name='patient_list') | ||
op.drop_index(op.f('ix_patient_list_action_state'), table_name='patient_list') | ||
op.drop_table('patient_list') | ||
# ### 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""empty message | ||
Revision ID: 5a300be640fb | ||
Revises: 038a1a5f4218 | ||
Create Date: 2024-10-08 14:34:28.085963 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '5a300be640fb' | ||
down_revision = '038a1a5f4218' | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint('adherence_data_patient_id_fkey', 'adherence_data') | ||
op.create_foreign_key( | ||
'adherence_data_patient_id_fkey', | ||
'adherence_data', | ||
'users', ['patient_id'], ['id'], ondelete='cascade') | ||
op.alter_column('patient_list', 'last_updated', | ||
existing_type=postgresql.TIMESTAMP(), | ||
nullable=True) | ||
op.create_foreign_key( | ||
'patient_list_userid_fkey', | ||
'patient_list', | ||
'users', ['userid'], ['id'], ondelete='cascade') | ||
op.drop_constraint('research_data_subject_id_fkey', 'research_data', type_='foreignkey') | ||
op.create_foreign_key( | ||
'research_data_subject_id_fkey', | ||
'research_data', | ||
'users', ['subject_id'], ['id'], ondelete='cascade') | ||
op.drop_constraint('research_data_questionnaire_response_id_fkey', 'research_data', type_='foreignkey') | ||
op.create_foreign_key( | ||
'research_data_questionnaire_response_id_fkey', | ||
'research_data', | ||
'questionnaire_responses', ['questionnaire_response_id'], ['id'], ondelete='cascade') | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint('research_data_subject_id_fkey', 'research_data', type_='foreignkey') | ||
op.create_foreign_key('research_data_subject_id_fkey', 'research_data', 'users', ['subject_id'], ['id']) | ||
op.drop_constraint('patient_list_userid_fkey', 'patient_list', type_='foreignkey') | ||
op.alter_column('patient_list', 'last_updated', | ||
existing_type=postgresql.TIMESTAMP(), | ||
nullable=False) | ||
# ### 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
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
Oops, something went wrong.