Skip to content

Commit

Permalink
some validators refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichaels-harvard committed Aug 23, 2024
1 parent f052a01 commit 438612c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
8 changes: 4 additions & 4 deletions poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 6 additions & 1 deletion submitr/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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,
Expand All @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions submitr/validators/utils/structured_data_validator_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 438612c

Please sign in to comment.