Skip to content

Commit

Permalink
Merge pull request #668 from kids-first/more-study-info
Browse files Browse the repository at this point in the history
✨ Add biobank_contact to Study table
  • Loading branch information
znatty22 authored Jun 6, 2024
2 parents 9b836c3 + e33a2d4 commit a470710
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
6 changes: 6 additions & 0 deletions dataservice/api/study/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class Study(db.Model, Base):
:short_name: Short name for study
:param attribution: Link to attribution prose provided by dbGaP
:param release_status: Release status of the study
:param biobank_contact: Contact email for study's biobank or source of
specimens
"""
__tablename__ = 'study'
__prefix__ = 'SD'
Expand Down Expand Up @@ -54,6 +56,10 @@ 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(
db.Text(),
doc='Email for study biobank or source of specimens'
)
parent_study_id = db.Column(
KfId(),
doc="KF ID of the parent study",
Expand Down
30 changes: 30 additions & 0 deletions migrations/versions/1f14248ec4cf_add_biobank_contact.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""
1.22.0 Add biobank_contact to Study table
Revision ID: 1f14248ec4cf
Revises: a67246728831
Create Date: 2024-06-06 13:38:44.771175
"""
from alembic import op
import sqlalchemy as sa


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


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


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('study', 'biobank_contact')
# ### end Alembic commands ###
6 changes: 4 additions & 2 deletions tests/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"version": "v1",
"release_status": "Pending",
"program": "Kids First",
"domain": "Cancer"
"domain": "Cancer",
"biobank_contact": "research@cbtn.org"
},
"/investigators": { "name": "Investigator_0", "external_id": "inv001" },
"/study-files": {
Expand Down Expand Up @@ -151,7 +152,8 @@
"external_id": "Study_1",
"short_code": "KF-ST0",
"program": "Kids First",
"domain": "Cancer"
"domain": "Cancer",
"biobank_contact": "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 @@ -164,7 +164,8 @@ def create_study(self):
'short_code': 'KF-ST1',
'short_name': 'S1',
'version': 'v1',
'release_status': 'Pending'
'release_status': 'Pending',
'biobank_contact': 'research@cbtn.org',
}
study = Study(**kwargs)

Expand Down
1 change: 1 addition & 0 deletions tests/study/test_study_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ def _make_study(self, include_nullables=True, **kwargs):
'short_code': 'KF-ST0',
'program': 'Kids First',
'domain': 'Cancer',
'biobank_contact': 'research@cbtn.org',
}
body.update(kwargs)
if include_nullables:
Expand Down

0 comments on commit a470710

Please sign in to comment.