Skip to content
Open
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
1 change: 1 addition & 0 deletions submitr/validators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
import submitr.validators.tissue_sample_external_id_validator # noqa
import submitr.validators.dsa_haplotype_validator # noqa
import submitr.validators.ont_unaligned_reads_validator # noqa
import submitr.validators.released_item_validator # noqa
29 changes: 29 additions & 0 deletions submitr/validators/released_item_validator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from dcicutils.structured_data import StructuredDataSet
from submitr.validators.decorators import structured_data_validator_finish_hook

# Validator that reports any released items that are being modified

# NOTE: (WF) This check probably should not be a validator and would likely work
# best incorporated into the existing diff check. Running compare() takes some
# time, so probably best to not run it again
# NOTE: This code relies on an update to dcicutils where the diffs include
# the status of the existing items.

# TODO: Update this to not only check for released items, but other items
# that cannot be modified
_RELEASED = "released"

@structured_data_validator_finish_hook
def _released_item_validator(structured_data: StructuredDataSet, **kwargs) -> None:

diffs = structured_data.compare()

for object_type in diffs:
for object_info in diffs[object_type]:
if object_info.uuid:
if object_info.diffs:
if object_info.status == _RELEASED:
structured_data.note_validation_error(
f"{object_info.path} is not permitted to be modified because"
f" it is {_RELEASED} item. Please double-check this."
)
Loading