From b8f3872376e4ff01fa04b3ec767a6a905742ae3c Mon Sep 17 00:00:00 2001 From: ChuckKollar Date: Fri, 8 Mar 2024 15:46:56 -0500 Subject: [PATCH] Added incomplete to schema_validators for dataset and upload status --- src/schema/provenance_schema.yaml | 4 ++-- src/schema/schema_validators.py | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/schema/provenance_schema.yaml b/src/schema/provenance_schema.yaml index 2f856b52..c663e389 100644 --- a/src/schema/provenance_schema.yaml +++ b/src/schema/provenance_schema.yaml @@ -312,7 +312,7 @@ ENTITIES: - validate_dataset_status_value - validate_status_changed generated: true - description: "One of: New|Processing|QA|Published|Error|Hold|Invalid|Submitted" + description: "One of: New|Processing|Published|QA|Error|Hold|Invalid|Submitted|Incomplete" before_create_trigger: set_dataset_status_new after_create_trigger: set_status_history after_update_trigger: set_status_history @@ -931,7 +931,7 @@ ENTITIES: - validate_status_changed type: string generated: true - description: "One of: New|Valid|Invalid|Error|Reorganized|Processing" + description: "One of: New|Valid|Invalid|Error|Reorganized|Processing|Submitted|Incomplete" # Trigger method will set the status to "New" on create before_create_trigger: set_upload_status_new after_create_trigger: set_status_history diff --git a/src/schema/schema_validators.py b/src/schema/schema_validators.py index 17ad3cf6..4fff1002 100644 --- a/src/schema/schema_validators.py +++ b/src/schema/schema_validators.py @@ -280,7 +280,9 @@ def validate_application_header_before_property_update(property_key, normalized_ """ def validate_dataset_status_value(property_key, normalized_entity_type, request, existing_data_dict, new_data_dict): # Use lowercase for comparison - accepted_status_values = ['new', 'processing', 'published', 'qa', 'error', 'hold', 'invalid', 'submitted'] + accepted_status_values = [ + 'new', 'processing', 'published', 'qa', 'error', 'hold', 'invalid', 'submitted', 'incomplete' + ] new_status = new_data_dict[property_key].lower() if new_status not in accepted_status_values: @@ -456,7 +458,9 @@ def validate_retracted_dataset_sub_status_value(property_key, normalized_entity_ """ def validate_upload_status_value(property_key, normalized_entity_type, request, existing_data_dict, new_data_dict): # Use lowercase for comparison - accepted_status_values = ['new', 'valid', 'invalid', 'error', 'reorganized', 'processing', 'submitted'] + accepted_status_values = [ + 'new', 'valid', 'invalid', 'error', 'reorganized', 'processing', 'submitted', 'incomplete' + ] new_status = new_data_dict[property_key].lower() if new_status not in accepted_status_values: @@ -481,7 +485,7 @@ def validate_upload_status_value(property_key, normalized_entity_type, request, """ def validate_sample_category(property_key, normalized_entity_type, request, existing_data_dict, new_data_dict): defined_tissue_types = ["organ", "block", "section", "suspension"] - sample_category = new_data_dict[property_key] + sample_category = new_data_dict[property_key].lower() if sample_category not in defined_tissue_types: raise ValueError(f"Invalid sample_category: {sample_category}")