Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ Rename GenomicFile.release_status #656

Merged
merged 3 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dataservice/api/genomic_file/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class GenomicFile(db.Model, Base, IndexdFile):
to generate the file. For source files, this field should be NULL
:param workflow_version: Indicates the major version of the workflow. For
source files, this field should be NULL
:param release_status: Indicates the release status
:param file_version_descriptor: Indicates the release status
:param data_category: Type of data
"""
__tablename__ = 'genomic_file'
Expand Down Expand Up @@ -87,7 +87,7 @@ class GenomicFile(db.Model, Base, IndexdFile):
doc='Indicates the major version of the workflow. For source files, '
' this field should be NULL'
)
release_status = db.Column(
file_version_descriptor = db.Column(
db.Text(),
doc='Inidicates release status'
)
Expand Down
8 changes: 4 additions & 4 deletions dataservice/api/genomic_file/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
"Somatic-Mutation",
}

RELEASE_STATUS_ENUM = {
FILE_VERSION_DESCRIPTOR_ENUM = {
"latest",
"previous",
"unharmonized",
Expand Down Expand Up @@ -201,9 +201,9 @@ class Meta(BaseSchema.Meta, IndexdFileSchema.Meta):
GenomicFile, 'workflow_type',
validate=enum_validation_generator(WORKFLOW_TYPE_ENUM)
)
release_status = field_for(
GenomicFile, 'release_status',
validate=enum_validation_generator(RELEASE_STATUS_ENUM)
file_version_descriptor = field_for(
GenomicFile, 'file_version_descriptor',
validate=enum_validation_generator(FILE_VERSION_DESCRIPTOR_ENUM)
)

_links = ma.Hyperlinks({
Expand Down
31 changes: 31 additions & 0 deletions migrations/versions/7cab6c9d8a24_rename_release_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
1.19.0 Rename release_status to file_version_descriptor

Revision ID: 7cab6c9d8a24
Revises: 1dd6c503d77f
Create Date: 2024-04-15 16:07:44.081102

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '7cab6c9d8a24'
down_revision = '1dd6c503d77f'
branch_labels = None
depends_on = None


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


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('genomic_file', sa.Column('release_status', sa.TEXT(), autoincrement=False, nullable=True))
op.drop_column('genomic_file', 'file_version_descriptor')
# ### end Alembic commands ###
6 changes: 3 additions & 3 deletions tests/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"workflow_type": "Alignment",
"workflow_tool": "tool",
"workflow_version": "v1",
"release_status": "latest",
"file_version_descriptor": "latest",
"data_category": "foo",
"visible": true
},
Expand Down Expand Up @@ -282,7 +282,7 @@
"paired_end": 1,
"data_type": "Expression",
"workflow_type": "Alignment",
"release_status": "latest"
"file_version_descriptor": "latest"
},
"invalid": [
{ "paired_end": -1 },
Expand All @@ -291,7 +291,7 @@
{ "availability": "availble for download" },
{ "data_type": "read" },
{ "workflow_type": "foo" },
{ "release_status": "foo" }
{ "file_version_descriptor": "foo" }
]
},
"/biospecimen-genomic-files": {
Expand Down
2 changes: 1 addition & 1 deletion tests/genomic_file/test_genomic_file_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_create_and_find(self):
'workflow_type': 'Alignment',
'workflow_tool': 'tool',
'workflow_version': 'v1',
'release_status': 'released',
'file_version_descriptor': 'released',
'data_category': 'foo',
}
# Add genomic file to db session
Expand Down
2 changes: 1 addition & 1 deletion tests/genomic_file/test_genomic_file_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_new_validation_error(client, entities):
'workflow_type': "Alignment",
'workflow_tool': "tool",
'workflow_version': "v1",
'release_status': "released",
'file_version_descriptor': "released",
'data_category': "foo",
}
init_count = GenomicFile.query.count()
Expand Down