Skip to content

Commit

Permalink
allow null and non-unique email in patient_list, as required for `del…
Browse files Browse the repository at this point in the history
…eted` patients.
  • Loading branch information
pbugni committed Oct 2, 2024
1 parent c390571 commit 25d2532
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions portal/migrations/versions/038a1a5f4218_.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def upgrade():
sa.Column('first_name', sa.String(length=64), nullable=True),
sa.Column('last_name', sa.String(length=64), nullable=True),
sa.Column('birthdate', sa.Date(), nullable=True),
sa.Column('email', sa.String(length=120), nullable=False),
sa.Column('email', sa.String(length=120), nullable=True),
sa.Column('questionnaire_status', sa.Text(), nullable=True),
sa.Column('visit', sa.Text(), nullable=True),
sa.Column('study_id', sa.Text(), nullable=True),
Expand All @@ -35,7 +35,7 @@ def upgrade():
)
op.create_index(op.f('ix_patient_list_birthdate'), 'patient_list', ['birthdate'], unique=False)
op.create_index(op.f('ix_patient_list_consent_date'), 'patient_list', ['consent_date'], unique=False)
op.create_index(op.f('ix_patient_list_email'), 'patient_list', ['email'], unique=True)
op.create_index(op.f('ix_patient_list_email'), 'patient_list', ['email'], unique=False)
op.create_index(op.f('ix_patient_list_first_name'), 'patient_list', ['first_name'], unique=False)
op.create_index(op.f('ix_patient_list_last_name'), 'patient_list', ['last_name'], unique=False)
op.create_index(op.f('ix_patient_list_questionnaire_status'), 'patient_list', ['questionnaire_status'], unique=False)
Expand Down
6 changes: 3 additions & 3 deletions portal/models/patient_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ class PatientList(db.Model):
first_name = db.Column(db.String(64), index=True)
last_name = db.Column(db.String(64), index=True)
birthdate = db.Column(db.Date, index=True)
email = db.Column(db.String(120), unique=True, nullable=False, index=True)
email = db.Column(db.String(120), index=True)
questionnaire_status = db.Column(db.Text, index=True)
visit = db.Column(db.Text, index=True)
study_id = db.Column(db.Text, index=True)
consent_date = db.Column(db.DateTime, index=True)
sites = db.Column(db.Text, index=True)
deleted = db.Column(db.Boolean, default=False)
test_role = db.Column(db.Boolean, default=False)
test_role = db.Column(db.Boolean)
org_id = db.Column(db.ForeignKey('organizations.id')) # used for access control


Expand All @@ -50,7 +50,7 @@ def patient_list_update_patient(patient_id):
patient.email = user.email
patient.birthdate = user.birthdate
patient.deleted = user.deleted_id is not None
patient.test_role = user.has_role(ROLE.TEST.value)
patient.test_role = True if user.has_role(ROLE.TEST.value) else False
patient.org_id = user.organizations[0].id if user.organizations else None

# TODO
Expand Down

0 comments on commit 25d2532

Please sign in to comment.