Skip to content

Commit

Permalink
fix: keep both tomogram.is_canonical and `tomogram.is_portal_standa…
Browse files Browse the repository at this point in the history
…rd` (#303)

* fix: keep both `tomogram.is_canonical` and `tomogram.is_portal_standard`
to allow the frontend queries to migrate.
  • Loading branch information
jgadling authored Oct 7, 2024
1 parent cf8d2e0 commit c65e2f6
Show file tree
Hide file tree
Showing 13 changed files with 395 additions and 267 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apiv2/database/models/tomogram.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apiv2/db_import/importers/tomogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def get_computed_fields(self) -> dict[str, Any]:
"fiducial_alignment_status": normalize_fiducial_alignment(self.metadata.get("fiducial_alignment_status")),
"reconstruction_method": self.normalize_to_unknown_str(self.metadata.get("reconstruction_method")),
"reconstruction_software": self.normalize_to_unknown_str(self.metadata.get("reconstruction_software")),
"is_canonical": True, # TODO: mark this for deprecation
"s3_omezarr_dir": self.join_path(s3_prefix, self.dir_prefix, self.metadata["omezarr_dir"]),
"https_omezarr_dir": self.join_path(https_prefix, self.dir_prefix, self.metadata["omezarr_dir"]),
"s3_mrc_file": self.join_path(s3_prefix, self.dir_prefix, self.metadata["mrc_files"][0]),
Expand All @@ -107,6 +106,7 @@ def get_computed_fields(self) -> dict[str, Any]:
"key_photo_thumbnail_url": None,
"neuroglancer_config": self.generate_neuroglancer_data(),
"type": self.get_tomogram_type(),
"is_canonical": self.metadata.get("is_standardized") or False,
"is_portal_standard": self.metadata.get("is_standardized") or False,
}
date_fields = ["deposition_date", "release_date", "last_modified_date"]
Expand Down
8 changes: 7 additions & 1 deletion apiv2/db_import/tests/populate_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ def populate_stale_tomogram_voxel_spacing(session: sa.orm.Session, run_id: int =
offset_y=0,
offset_z=0,
is_portal_standard=True,
is_canonical=True,
deposition_date=datetime.min,
release_date=datetime.min,
last_modified_date=datetime.min,
Expand Down Expand Up @@ -290,6 +291,7 @@ def populate_tomograms(session: sa.orm.Session) -> Tomogram:
offset_y=0,
offset_z=0,
is_portal_standard=True,
is_canonical=True,
deposition_date=datetime.min,
release_date=datetime.min,
last_modified_date=datetime.min,
Expand Down Expand Up @@ -323,6 +325,7 @@ def populate_stale_tomograms(session: sa.orm.Session) -> Tomogram:
offset_y=0,
offset_z=0,
is_portal_standard=True,
is_canonical=True,
deposition_date=datetime.min,
release_date=datetime.min,
last_modified_date=datetime.min,
Expand Down Expand Up @@ -546,7 +549,10 @@ def populate_stale_annotation_method_links(session: sa.orm.Session) -> None:
populate_stale_annotations(session)
session.add(
AnnotationMethodLink(
annotation_id=STALE_ANNOTATION_ID, name="Stale Link 0", link_type="other", link="https://some-link.com",
annotation_id=STALE_ANNOTATION_ID,
name="Stale Link 0",
link_type="other",
link="https://some-link.com",
),
)
session.add(
Expand Down
2 changes: 2 additions & 0 deletions apiv2/db_import/tests/test_db_tomo_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def expected_tomograms_by_run(http_prefix: str) -> dict[str, dict[float, list[di
"neuroglancer_config": '{"foo":"bar","baz":"test"}',
"deposition_id": 301,
"is_portal_standard": False,
"is_canonical": False,
"deposition_date": date(2023, 4, 2),
"release_date": date(2024, 6, 1),
"last_modified_date": date(2023, 9, 2),
Expand Down Expand Up @@ -116,6 +117,7 @@ def expected_tomograms_by_run(http_prefix: str) -> dict[str, dict[float, list[di
"neuroglancer_config": "{}",
"deposition_id": 300,
"is_portal_standard": False,
"is_canonical": False,
"deposition_date": date(2022, 4, 2),
"release_date": date(2022, 6, 1),
"last_modified_date": date(2022, 9, 2),
Expand Down
1 change: 1 addition & 0 deletions apiv2/graphql_api/helpers/tomogram.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions apiv2/graphql_api/schema.graphql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions apiv2/graphql_api/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions apiv2/graphql_api/types/tomogram.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apiv2/schema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Tomogram {
float tomogram_version
string processing_software
string reconstruction_software
boolean is_canonical
boolean is_portal_standard
boolean is_author_submitted
boolean is_visualization_default
Expand Down
Loading

0 comments on commit c65e2f6

Please sign in to comment.