Skip to content

Commit

Permalink
Merge pull request #670 from kids-first/fix-biobank-contact
Browse files Browse the repository at this point in the history
♻️ Refactor biobank_contact to be two columns
  • Loading branch information
znatty22 authored Jun 6, 2024
2 parents a470710 + 2859cc2 commit ef9eb9e
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 5 deletions.
6 changes: 5 additions & 1 deletion dataservice/api/study/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ class Study(db.Model, Base):
doc='Link to attribution prose provided by dbGaP')
release_status = db.Column(db.Text(),
doc='Release status of the study')
biobank_contact = db.Column(
biobank_name = db.Column(
db.Text(),
doc='Name of study biobank or source of specimens'
)
biobank_email = db.Column(
db.Text(),
doc='Email for study biobank or source of specimens'
)
Expand Down
38 changes: 38 additions & 0 deletions migrations/versions/f07d043290d0_fix_biobank_contact.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""
1.23.0
Rename biobank_contact to biobank_email
Add biobank_name column
Revision ID: f07d043290d0
Revises: 1f14248ec4cf
Create Date: 2024-06-06 14:54:46.201004
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'f07d043290d0'
down_revision = '1f14248ec4cf'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('study', sa.Column(
'biobank_email', sa.Text(), nullable=True))
op.add_column('study', sa.Column('biobank_name', sa.Text(), nullable=True))
op.drop_column('study', 'biobank_contact')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('study', sa.Column('biobank_contact',
sa.TEXT(), autoincrement=False, nullable=True))
op.drop_column('study', 'biobank_name')
op.drop_column('study', 'biobank_email')
# ### end Alembic commands ###
6 changes: 4 additions & 2 deletions tests/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"release_status": "Pending",
"program": "Kids First",
"domain": "Cancer",
"biobank_contact": "research@cbtn.org"
"biobank_name": "CBTN Biobank",
"biobank_email": "research@cbtn.org"
},
"/investigators": { "name": "Investigator_0", "external_id": "inv001" },
"/study-files": {
Expand Down Expand Up @@ -153,7 +154,8 @@
"short_code": "KF-ST0",
"program": "Kids First",
"domain": "Cancer",
"biobank_contact": "research@cbtn.org"
"biobank_name": "CBTN Biobank",
"biobank_email": "research@cbtn.org"
},
"invalid": []
},
Expand Down
3 changes: 2 additions & 1 deletion tests/study/test_study_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ def create_study(self):
'short_name': 'S1',
'version': 'v1',
'release_status': 'Pending',
'biobank_contact': 'research@cbtn.org',
'biobank_name': 'CBTN Biobank',
'biobank_email': 'research@cbtn.org',
}
study = Study(**kwargs)

Expand Down
3 changes: 2 additions & 1 deletion tests/study/test_study_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ def _make_study(self, include_nullables=True, **kwargs):
'short_code': 'KF-ST0',
'program': 'Kids First',
'domain': 'Cancer',
'biobank_contact': 'research@cbtn.org',
'biobank_name': 'CBTN Biobank',
'biobank_email': 'research@cbtn.org',
}
body.update(kwargs)
if include_nullables:
Expand Down

0 comments on commit ef9eb9e

Please sign in to comment.