diff --git a/dataservice/api/study/models.py b/dataservice/api/study/models.py index bb398197..9d46e866 100644 --- a/dataservice/api/study/models.py +++ b/dataservice/api/study/models.py @@ -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' @@ -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", diff --git a/migrations/versions/1f14248ec4cf_add_biobank_contact.py b/migrations/versions/1f14248ec4cf_add_biobank_contact.py new file mode 100644 index 00000000..478ae1f6 --- /dev/null +++ b/migrations/versions/1f14248ec4cf_add_biobank_contact.py @@ -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 ### diff --git a/tests/data.json b/tests/data.json index 557ddaaa..c15c7963 100644 --- a/tests/data.json +++ b/tests/data.json @@ -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": { @@ -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": [] }, diff --git a/tests/study/test_study_models.py b/tests/study/test_study_models.py index 1252f14a..59da6df6 100644 --- a/tests/study/test_study_models.py +++ b/tests/study/test_study_models.py @@ -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) diff --git a/tests/study/test_study_resources.py b/tests/study/test_study_resources.py index 47bae8b3..d0571a1f 100644 --- a/tests/study/test_study_resources.py +++ b/tests/study/test_study_resources.py @@ -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: