From 438612c278e068408290d539483927c054daf3eb Mon Sep 17 00:00:00 2001 From: David Michaels Date: Thu, 22 Aug 2024 23:57:31 -0400 Subject: [PATCH] some validators refactoring --- poetry.lock | 8 ++++---- pyproject.toml | 2 +- submitr/submission.py | 7 ++++++- .../validators/utils/structured_data_validator_hook.py | 7 +++++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/poetry.lock b/poetry.lock index d0d4af0a49..543a8ae008 100644 --- a/poetry.lock +++ b/poetry.lock @@ -534,14 +534,14 @@ test-randomorder = ["pytest-randomly"] [[package]] name = "dcicutils" -version = "8.14.2.1b3" +version = "8.14.2.1b4" description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources" category = "main" optional = false python-versions = "<3.13,>=3.8.1" files = [ - {file = "dcicutils-8.14.2.1b3-py3-none-any.whl", hash = "sha256:5363a02edf4f8d7ee07f53cd00524683c17a6757d9d6bc17feef167690333de0"}, - {file = "dcicutils-8.14.2.1b3.tar.gz", hash = "sha256:fb69dc1d9da54be1505dfd816affff54b4b223e797d0cba6d6e2f1dae0733f7e"}, + {file = "dcicutils-8.14.2.1b4-py3-none-any.whl", hash = "sha256:83a70e9551cbd28c974413badaf37d708f8004a4c4014fcdb5d1da4701cff866"}, + {file = "dcicutils-8.14.2.1b4.tar.gz", hash = "sha256:891705f5ca655f76c573438c3208ded5b84eb74b998f2af02c3f6eb8a5127d0b"}, ] [package.dependencies] @@ -2795,4 +2795,4 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"] [metadata] lock-version = "2.0" python-versions = ">=3.8.1,<3.13" -content-hash = "029da1ac864e792bb420f5791ecc2803ce95e4259a953af43aff17881785f696" +content-hash = "6e79177a5620830948622cf1369578f50f3456b3049b5d4cc94e26826758fccd" diff --git a/pyproject.toml b/pyproject.toml index 7b7ad5c530..c4e87c58ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,7 +51,7 @@ python = ">=3.8.1,<3.13" awscli = ">=1.33.17" boto3 = "^1.34.136" # dcicutils = "^8.14.2" -dcicutils = "8.14.2.1b3" +dcicutils = "8.14.2.1b4" PyYAML = "^6.0.1" requests = "^2.31.0" googleapi = "^0.1.0" diff --git a/submitr/submission.py b/submitr/submission.py index 47618ef95f..4d01194603 100644 --- a/submitr/submission.py +++ b/submitr/submission.py @@ -42,7 +42,10 @@ lookup_ingestion_submission_from_upload_file ) from submitr.utils import chars, format_path, get_health_page, is_excel_file_name, print_boxed, tobool -from submitr.validators.utils.structured_data_validator_hook import define_structured_data_validator_hook +from submitr.validators.utils.structured_data_validator_hook import ( + define_structured_data_validator_hook, + define_structured_data_validator_sheet_hook +) def set_output_file(output_file): @@ -1906,6 +1909,7 @@ def progress_report(status: dict) -> None: # noqa PRINT("DEBUG: Starting client validation.") validator_hook = define_structured_data_validator_hook(valid_submission_centers=valid_submission_centers) + validator_sheet_hook = define_structured_data_validator_sheet_hook() structured_data = StructuredDataSet(None, portal, autoadd=autoadd, # ref_lookup_strategy=ref_lookup_strategy, ref_lookup_nocache=ref_nocache, @@ -1922,6 +1926,7 @@ def progress_report(status: dict) -> None: # noqa progress=None if noprogress else define_progress_callback(debug=debug), # Doing submitted_id validation in validate_submitted_ids, in parallel. validator_hook=validator_hook, + validator_sheet_hook=validator_sheet_hook, debug_sleep=debug_sleep) structured_data.load_file(ingestion_filename) # finish_validators_hook(structured_data, valid_submission_centers=valid_submission_centers) diff --git a/submitr/validators/utils/structured_data_validator_hook.py b/submitr/validators/utils/structured_data_validator_hook.py index a85b13098d..ea92f67424 100644 --- a/submitr/validators/utils/structured_data_validator_hook.py +++ b/submitr/validators/utils/structured_data_validator_hook.py @@ -73,3 +73,10 @@ def finish_validators(structured_data: StructuredDataSet) -> None: def structured_data_validator_sheet_hook(**kwargs) -> Callable: pass + + +def define_structured_data_validator_sheet_hook(**kwargs) -> Callable: + def validators(structured_data: StructuredDataSet, sheet_name: str, data: dict) -> None: + # TODO + pass + return validators