From bf9109fdc14a16ddb303388febc966098a898031 Mon Sep 17 00:00:00 2001 From: Manasa Venkatakrishnan Date: Tue, 24 Sep 2024 09:25:29 -0700 Subject: [PATCH 1/3] Updating tomogram table --- .../versions/20240923_130016_autogenerated.py | 39 +++++++++++-------- apiv2/database/models/tomogram.py | 2 +- apiv2/graphql_api/helpers/tomogram.py | 2 +- apiv2/graphql_api/types/tomogram.py | 24 ++++++------ apiv2/schema/schema.yaml | 13 ++++--- apiv2/test_infra/factories/tomogram.py | 2 +- apiv2/validators/tomogram.py | 4 +- 7 files changed, 47 insertions(+), 39 deletions(-) diff --git a/apiv2/database/migrations/versions/20240923_130016_autogenerated.py b/apiv2/database/migrations/versions/20240923_130016_autogenerated.py index e4d16c9af..984d05665 100644 --- a/apiv2/database/migrations/versions/20240923_130016_autogenerated.py +++ b/apiv2/database/migrations/versions/20240923_130016_autogenerated.py @@ -3,35 +3,42 @@ Create Date: 2024-09-23 17:00:19.130349 """ + import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. -revision = '20240923_130016' -down_revision = '20240828_194323' +revision = "20240923_130016" +down_revision = "20240828_194323" branch_labels = None depends_on = None def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - op.alter_column('dataset', 'organism_name', - existing_type=sa.VARCHAR(), - nullable=True) - op.alter_column('tiltseries', 'microscope_manufacturer', - existing_type=sa.VARCHAR(length=4), - type_=sa.Enum('FEI', 'TFS', 'JEOL', 'SIMULATED', name='tiltseries_microscope_manufacturer_enum', native_enum=False), - existing_nullable=False) + op.alter_column("dataset", "organism_name", existing_type=sa.VARCHAR(), nullable=True) + op.alter_column( + "tiltseries", + "microscope_manufacturer", + existing_type=sa.VARCHAR(length=4), + type_=sa.Enum( + "FEI", "TFS", "JEOL", "SIMULATED", name="tiltseries_microscope_manufacturer_enum", native_enum=False, + ), + existing_nullable=False, + ) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - op.alter_column('tiltseries', 'microscope_manufacturer', - existing_type=sa.Enum('FEI', 'TFS', 'JEOL', 'SIMULATED', name='tiltseries_microscope_manufacturer_enum', native_enum=False), - type_=sa.VARCHAR(length=4), - existing_nullable=False) - op.alter_column('dataset', 'organism_name', - existing_type=sa.VARCHAR(), - nullable=False) + op.alter_column( + "tiltseries", + "microscope_manufacturer", + existing_type=sa.Enum( + "FEI", "TFS", "JEOL", "SIMULATED", name="tiltseries_microscope_manufacturer_enum", native_enum=False, + ), + type_=sa.VARCHAR(length=4), + existing_nullable=False, + ) + op.alter_column("dataset", "organism_name", existing_type=sa.VARCHAR(), nullable=False) # ### end Alembic commands ### diff --git a/apiv2/database/models/tomogram.py b/apiv2/database/models/tomogram.py index 7e95b3cdd..35798295f 100644 --- a/apiv2/database/models/tomogram.py +++ b/apiv2/database/models/tomogram.py @@ -87,7 +87,6 @@ class Tomogram(Base): tomogram_version: Mapped[float] = mapped_column(Float, nullable=True) processing_software: Mapped[str] = mapped_column(String, nullable=True) reconstruction_software: Mapped[str] = mapped_column(String, nullable=False) - is_canonical: Mapped[bool] = mapped_column(Boolean, nullable=True) s3_omezarr_dir: Mapped[str] = mapped_column(String, nullable=True) https_omezarr_dir: Mapped[str] = mapped_column(String, nullable=True) s3_mrc_file: Mapped[str] = mapped_column(String, nullable=True) @@ -103,4 +102,5 @@ class Tomogram(Base): key_photo_thumbnail_url: Mapped[str] = mapped_column(String, nullable=True) neuroglancer_config: Mapped[str] = mapped_column(String, nullable=True) is_standardized: Mapped[bool] = mapped_column(Boolean, nullable=False) + is_author_submitted: Mapped[bool] = mapped_column(Boolean, nullable=False) id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/graphql_api/helpers/tomogram.py b/apiv2/graphql_api/helpers/tomogram.py index 812e61a63..d2d248dfe 100644 --- a/apiv2/graphql_api/helpers/tomogram.py +++ b/apiv2/graphql_api/helpers/tomogram.py @@ -58,7 +58,6 @@ class TomogramGroupByOptions: tomogram_version: Optional[float] = None processing_software: Optional[str] = None reconstruction_software: Optional[str] = None - is_canonical: Optional[bool] = None s3_omezarr_dir: Optional[str] = None https_omezarr_dir: Optional[str] = None s3_mrc_file: Optional[str] = None @@ -74,6 +73,7 @@ class TomogramGroupByOptions: key_photo_thumbnail_url: Optional[str] = None neuroglancer_config: Optional[str] = None is_standardized: Optional[bool] = None + is_author_submitted: Optional[bool] = None id: Optional[int] = None diff --git a/apiv2/graphql_api/types/tomogram.py b/apiv2/graphql_api/types/tomogram.py index c99a30b43..2abde0a18 100644 --- a/apiv2/graphql_api/types/tomogram.py +++ b/apiv2/graphql_api/types/tomogram.py @@ -230,7 +230,6 @@ class TomogramWhereClause(TypedDict): tomogram_version: Optional[FloatComparators] | None processing_software: Optional[StrComparators] | None reconstruction_software: Optional[StrComparators] | None - is_canonical: Optional[BoolComparators] | None s3_omezarr_dir: Optional[StrComparators] | None https_omezarr_dir: Optional[StrComparators] | None s3_mrc_file: Optional[StrComparators] | None @@ -246,6 +245,7 @@ class TomogramWhereClause(TypedDict): key_photo_thumbnail_url: Optional[StrComparators] | None neuroglancer_config: Optional[StrComparators] | None is_standardized: Optional[BoolComparators] | None + is_author_submitted: Optional[BoolComparators] | None id: Optional[IntComparators] | None @@ -276,7 +276,6 @@ class TomogramOrderByClause(TypedDict): tomogram_version: Optional[orderBy] | None processing_software: Optional[orderBy] | None reconstruction_software: Optional[orderBy] | None - is_canonical: Optional[orderBy] | None s3_omezarr_dir: Optional[orderBy] | None https_omezarr_dir: Optional[orderBy] | None s3_mrc_file: Optional[orderBy] | None @@ -292,6 +291,7 @@ class TomogramOrderByClause(TypedDict): key_photo_thumbnail_url: Optional[orderBy] | None neuroglancer_config: Optional[orderBy] | None is_standardized: Optional[orderBy] | None + is_author_submitted: Optional[orderBy] | None id: Optional[orderBy] | None @@ -341,9 +341,6 @@ class Tomogram(EntityInterface): description="Processing software used to derive the tomogram", default=None, ) reconstruction_software: str = strawberry.field(description="Name of software used for reconstruction") - is_canonical: Optional[bool] = strawberry.field( - description="whether this tomogram is canonical for the run", default=None, - ) s3_omezarr_dir: Optional[str] = strawberry.field( description="S3 path to this tomogram in multiscale OME-Zarr format", default=None, ) @@ -379,6 +376,9 @@ class Tomogram(EntityInterface): is_standardized: bool = strawberry.field( description="Whether this tomogram was generated per the portal's standards", ) + is_author_submitted: bool = strawberry.field( + description="Whether this tomogram was generated by the author of the dataset", + ) id: int = strawberry.field(description="An identifier to refer to a specific instance of this type") @@ -467,7 +467,6 @@ class TomogramCountColumns(enum.Enum): tomogramVersion = "tomogram_version" processingSoftware = "processing_software" reconstructionSoftware = "reconstruction_software" - isCanonical = "is_canonical" s3OmezarrDir = "s3_omezarr_dir" httpsOmezarrDir = "https_omezarr_dir" s3MrcFile = "s3_mrc_file" @@ -483,6 +482,7 @@ class TomogramCountColumns(enum.Enum): keyPhotoThumbnailUrl = "key_photo_thumbnail_url" neuroglancerConfig = "neuroglancer_config" isStandardized = "is_standardized" + isAuthorSubmitted = "is_author_submitted" id = "id" @@ -552,9 +552,6 @@ class TomogramCreateInput: description="Processing software used to derive the tomogram", default=None, ) reconstruction_software: str = strawberry.field(description="Name of software used for reconstruction") - is_canonical: Optional[bool] = strawberry.field( - description="whether this tomogram is canonical for the run", default=None, - ) s3_omezarr_dir: Optional[str] = strawberry.field( description="S3 path to this tomogram in multiscale OME-Zarr format", default=None, ) @@ -590,6 +587,9 @@ class TomogramCreateInput: is_standardized: bool = strawberry.field( description="Whether this tomogram was generated per the portal's standards", ) + is_author_submitted: bool = strawberry.field( + description="Whether this tomogram was generated by the author of the dataset", + ) id: int = strawberry.field(description="An identifier to refer to a specific instance of this type") @@ -620,9 +620,6 @@ class TomogramUpdateInput: description="Processing software used to derive the tomogram", default=None, ) reconstruction_software: Optional[str] = strawberry.field(description="Name of software used for reconstruction") - is_canonical: Optional[bool] = strawberry.field( - description="whether this tomogram is canonical for the run", default=None, - ) s3_omezarr_dir: Optional[str] = strawberry.field( description="S3 path to this tomogram in multiscale OME-Zarr format", default=None, ) @@ -658,6 +655,9 @@ class TomogramUpdateInput: is_standardized: Optional[bool] = strawberry.field( description="Whether this tomogram was generated per the portal's standards", ) + is_author_submitted: Optional[bool] = strawberry.field( + description="Whether this tomogram was generated by the author of the dataset", + ) id: Optional[int] = strawberry.field(description="An identifier to refer to a specific instance of this type") diff --git a/apiv2/schema/schema.yaml b/apiv2/schema/schema.yaml index 3fc2c17ad..5094fcee5 100644 --- a/apiv2/schema/schema.yaml +++ b/apiv2/schema/schema.yaml @@ -2326,11 +2326,6 @@ classes: range: string required: true description: Name of software used for reconstruction - is_canonical: - name: is_canonical - description: whether this tomogram is canonical for the run - from_schema: cdp-dataset-config - range: boolean s3_omezarr_dir: name: s3_omezarr_dir description: S3 path to this tomogram in multiscale OME-Zarr format @@ -2441,7 +2436,13 @@ classes: range: boolean required: true # TODO - is this reasonable? - ifabsent: false + ifabsent: falsegit + is_author_submitted : + description: Whether this tomogram was generated by the author of the dataset + range: boolean + required: true + # TODO - is this reasonable? + ifabsent: true DateStampedEntityMixin: name: DateStampedEntityMixin description: A set of dates at which a data item was deposited, published and diff --git a/apiv2/test_infra/factories/tomogram.py b/apiv2/test_infra/factories/tomogram.py index 5fb78d580..03a7d252f 100644 --- a/apiv2/test_infra/factories/tomogram.py +++ b/apiv2/test_infra/factories/tomogram.py @@ -55,7 +55,6 @@ class Meta: tomogram_version = fuzzy.FuzzyFloat(1, 100) processing_software = fuzzy.FuzzyText() reconstruction_software = fuzzy.FuzzyText() - is_canonical = factory.Faker("boolean") s3_omezarr_dir = fuzzy.FuzzyText() https_omezarr_dir = fuzzy.FuzzyText() s3_mrc_file = fuzzy.FuzzyText() @@ -71,4 +70,5 @@ class Meta: key_photo_thumbnail_url = fuzzy.FuzzyText() neuroglancer_config = fuzzy.FuzzyText() is_standardized = factory.Faker("boolean") + is_author_submitted = factory.Faker("boolean") id = fuzzy.FuzzyInteger(1, 1000) diff --git a/apiv2/validators/tomogram.py b/apiv2/validators/tomogram.py index b417b1349..928eae6d0 100644 --- a/apiv2/validators/tomogram.py +++ b/apiv2/validators/tomogram.py @@ -68,7 +68,6 @@ class TomogramCreateInputValidator(BaseModel): strip_whitespace=True, ), ] - is_canonical: Annotated[bool | None, Field()] s3_omezarr_dir: Annotated[ str | None, StringConstraints( @@ -134,6 +133,7 @@ class TomogramCreateInputValidator(BaseModel): ), ] is_standardized: Annotated[bool, Field()] + is_author_submitted: Annotated[bool, Field()] id: Annotated[int, Field()] @@ -190,7 +190,6 @@ class TomogramUpdateInputValidator(BaseModel): strip_whitespace=True, ), ] - is_canonical: Annotated[bool | None, Field()] s3_omezarr_dir: Annotated[ str | None, StringConstraints( @@ -256,4 +255,5 @@ class TomogramUpdateInputValidator(BaseModel): ), ] is_standardized: Annotated[bool | None, Field()] + is_author_submitted: Annotated[bool | None, Field()] id: Annotated[int | None, Field()] From a4018ff43eb1da183948d484b62b5d6f8d2f012c Mon Sep 17 00:00:00 2001 From: Manasa Venkatakrishnan Date: Tue, 24 Sep 2024 09:31:03 -0700 Subject: [PATCH 2/3] Updating tomogram table --- .../versions/20240923_130016_autogenerated.py | 14 ++++++++++++-- apiv2/schema/schema.yaml | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/apiv2/database/migrations/versions/20240923_130016_autogenerated.py b/apiv2/database/migrations/versions/20240923_130016_autogenerated.py index 984d05665..a13f465fc 100644 --- a/apiv2/database/migrations/versions/20240923_130016_autogenerated.py +++ b/apiv2/database/migrations/versions/20240923_130016_autogenerated.py @@ -22,7 +22,12 @@ def upgrade() -> None: "microscope_manufacturer", existing_type=sa.VARCHAR(length=4), type_=sa.Enum( - "FEI", "TFS", "JEOL", "SIMULATED", name="tiltseries_microscope_manufacturer_enum", native_enum=False, + "FEI", + "TFS", + "JEOL", + "SIMULATED", + name="tiltseries_microscope_manufacturer_enum", + native_enum=False, ), existing_nullable=False, ) @@ -35,7 +40,12 @@ def downgrade() -> None: "tiltseries", "microscope_manufacturer", existing_type=sa.Enum( - "FEI", "TFS", "JEOL", "SIMULATED", name="tiltseries_microscope_manufacturer_enum", native_enum=False, + "FEI", + "TFS", + "JEOL", + "SIMULATED", + name="tiltseries_microscope_manufacturer_enum", + native_enum=False, ), type_=sa.VARCHAR(length=4), existing_nullable=False, diff --git a/apiv2/schema/schema.yaml b/apiv2/schema/schema.yaml index 5094fcee5..ad7abd5d8 100644 --- a/apiv2/schema/schema.yaml +++ b/apiv2/schema/schema.yaml @@ -2436,7 +2436,7 @@ classes: range: boolean required: true # TODO - is this reasonable? - ifabsent: falsegit + ifabsent: false is_author_submitted : description: Whether this tomogram was generated by the author of the dataset range: boolean From 2c44692a7591824ea188e086fe404dd814b36ff1 Mon Sep 17 00:00:00 2001 From: Manasa Venkatakrishnan Date: Tue, 24 Sep 2024 10:07:47 -0700 Subject: [PATCH 3/3] Updating tomogram table --- apiv2/database/models/tomogram.py | 1 - apiv2/graphql_api/helpers/tomogram.py | 1 - apiv2/graphql_api/types/tomogram.py | 12 ------------ apiv2/schema/schema.yaml | 6 ------ apiv2/test_infra/factories/tomogram.py | 1 - apiv2/validators/tomogram.py | 2 -- 6 files changed, 23 deletions(-) diff --git a/apiv2/database/models/tomogram.py b/apiv2/database/models/tomogram.py index 35798295f..82f82693c 100644 --- a/apiv2/database/models/tomogram.py +++ b/apiv2/database/models/tomogram.py @@ -102,5 +102,4 @@ class Tomogram(Base): key_photo_thumbnail_url: Mapped[str] = mapped_column(String, nullable=True) neuroglancer_config: Mapped[str] = mapped_column(String, nullable=True) is_standardized: Mapped[bool] = mapped_column(Boolean, nullable=False) - is_author_submitted: Mapped[bool] = mapped_column(Boolean, nullable=False) id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/graphql_api/helpers/tomogram.py b/apiv2/graphql_api/helpers/tomogram.py index d2d248dfe..a36a3ea0a 100644 --- a/apiv2/graphql_api/helpers/tomogram.py +++ b/apiv2/graphql_api/helpers/tomogram.py @@ -73,7 +73,6 @@ class TomogramGroupByOptions: key_photo_thumbnail_url: Optional[str] = None neuroglancer_config: Optional[str] = None is_standardized: Optional[bool] = None - is_author_submitted: Optional[bool] = None id: Optional[int] = None diff --git a/apiv2/graphql_api/types/tomogram.py b/apiv2/graphql_api/types/tomogram.py index 2abde0a18..d96a32f02 100644 --- a/apiv2/graphql_api/types/tomogram.py +++ b/apiv2/graphql_api/types/tomogram.py @@ -245,7 +245,6 @@ class TomogramWhereClause(TypedDict): key_photo_thumbnail_url: Optional[StrComparators] | None neuroglancer_config: Optional[StrComparators] | None is_standardized: Optional[BoolComparators] | None - is_author_submitted: Optional[BoolComparators] | None id: Optional[IntComparators] | None @@ -291,7 +290,6 @@ class TomogramOrderByClause(TypedDict): key_photo_thumbnail_url: Optional[orderBy] | None neuroglancer_config: Optional[orderBy] | None is_standardized: Optional[orderBy] | None - is_author_submitted: Optional[orderBy] | None id: Optional[orderBy] | None @@ -376,9 +374,6 @@ class Tomogram(EntityInterface): is_standardized: bool = strawberry.field( description="Whether this tomogram was generated per the portal's standards", ) - is_author_submitted: bool = strawberry.field( - description="Whether this tomogram was generated by the author of the dataset", - ) id: int = strawberry.field(description="An identifier to refer to a specific instance of this type") @@ -482,7 +477,6 @@ class TomogramCountColumns(enum.Enum): keyPhotoThumbnailUrl = "key_photo_thumbnail_url" neuroglancerConfig = "neuroglancer_config" isStandardized = "is_standardized" - isAuthorSubmitted = "is_author_submitted" id = "id" @@ -587,9 +581,6 @@ class TomogramCreateInput: is_standardized: bool = strawberry.field( description="Whether this tomogram was generated per the portal's standards", ) - is_author_submitted: bool = strawberry.field( - description="Whether this tomogram was generated by the author of the dataset", - ) id: int = strawberry.field(description="An identifier to refer to a specific instance of this type") @@ -655,9 +646,6 @@ class TomogramUpdateInput: is_standardized: Optional[bool] = strawberry.field( description="Whether this tomogram was generated per the portal's standards", ) - is_author_submitted: Optional[bool] = strawberry.field( - description="Whether this tomogram was generated by the author of the dataset", - ) id: Optional[int] = strawberry.field(description="An identifier to refer to a specific instance of this type") diff --git a/apiv2/schema/schema.yaml b/apiv2/schema/schema.yaml index ad7abd5d8..c05b26f36 100644 --- a/apiv2/schema/schema.yaml +++ b/apiv2/schema/schema.yaml @@ -2437,12 +2437,6 @@ classes: required: true # TODO - is this reasonable? ifabsent: false - is_author_submitted : - description: Whether this tomogram was generated by the author of the dataset - range: boolean - required: true - # TODO - is this reasonable? - ifabsent: true DateStampedEntityMixin: name: DateStampedEntityMixin description: A set of dates at which a data item was deposited, published and diff --git a/apiv2/test_infra/factories/tomogram.py b/apiv2/test_infra/factories/tomogram.py index 03a7d252f..4c53322a1 100644 --- a/apiv2/test_infra/factories/tomogram.py +++ b/apiv2/test_infra/factories/tomogram.py @@ -70,5 +70,4 @@ class Meta: key_photo_thumbnail_url = fuzzy.FuzzyText() neuroglancer_config = fuzzy.FuzzyText() is_standardized = factory.Faker("boolean") - is_author_submitted = factory.Faker("boolean") id = fuzzy.FuzzyInteger(1, 1000) diff --git a/apiv2/validators/tomogram.py b/apiv2/validators/tomogram.py index 928eae6d0..fc0e221ff 100644 --- a/apiv2/validators/tomogram.py +++ b/apiv2/validators/tomogram.py @@ -133,7 +133,6 @@ class TomogramCreateInputValidator(BaseModel): ), ] is_standardized: Annotated[bool, Field()] - is_author_submitted: Annotated[bool, Field()] id: Annotated[int, Field()] @@ -255,5 +254,4 @@ class TomogramUpdateInputValidator(BaseModel): ), ] is_standardized: Annotated[bool | None, Field()] - is_author_submitted: Annotated[bool | None, Field()] id: Annotated[int | None, Field()]