Skip to content

Commit

Permalink
slight cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gesinaphillips committed Jul 31, 2023
1 parent adf3a52 commit dcbc1c5
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/ingest_validation_tools/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ def validation_routine(self) -> dict:
local_validated = {}
api_validated = {}
for tsv_path, schema_name in self.effective_tsv_paths.items():
if not type(tsv_path) == Path:
try:
tsv_path = Path(tsv_path)
except TypeError as e:
raise TypeError(
f"Path {tsv_path} is of invalid type {type(tsv_path)}. Exception: {e}"
)
df = pd.read_csv(tsv_path, delimiter="\t")
if df.get(["metadata_schema_id"]) is None:
logging.info(
Expand All @@ -216,13 +223,6 @@ def validation_routine(self) -> dict:
def api_validation(self, tsv_path: Path):
errors = {}
response = self.cedar_api_call(tsv_path)
# pretty_json = json.dumps(response.json(), indent=2)
# logging.info(
# f"""
# CEDAR validator returned {response.status_code} for TSV {tsv_path}:
# {pretty_json}
# """
# )
if response.status_code != 200:
errors["Request Errors"] = response
elif response.json()["reporting"] and len(response.json()["reporting"]) > 0:
Expand All @@ -231,13 +231,6 @@ def api_validation(self, tsv_path: Path):
logging.info(f"CEDAR Spreadsheet Validator errors for {tsv_path}: {errors}")
return errors

# def local_validation_routine(self, tsvs: dict) -> dict:
# errors = {}
# tsv_errors = self._get_tsv_errors(tsvs)
# if tsv_errors:
# errors["Metadata TSV Errors"] = tsv_errors
# return errors

###################################
#
# Top-level private methods:
Expand Down

0 comments on commit dcbc1c5

Please sign in to comment.