Skip to content

Commit

Permalink
fix in structured_data to report date/time malformations
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichaels-harvard committed Aug 9, 2024
1 parent aca9158 commit 9551369
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Change Log
* Added run_concurrently function to misc_utils.
* Changed misc_utils.to_enum to default to non-fuzzy (prefix) match, for structured_data,
i.e for smaht-submitr to match on (case-insensitive) full enum namess.
* Changed dcicutils.structured_data.Schema._map_function_date/time to
report malformed dates, e.g. "6/29/2024" rather than "2024-06-29".


8.13.3
Expand Down
10 changes: 6 additions & 4 deletions dcicutils/structured_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,14 +749,16 @@ def map_string(value: str, src: Optional[str]) -> str:

def _map_function_date(self, typeinfo: dict) -> Callable:
def map_date(value: str, src: Optional[str]) -> str:
value = normalize_date_string(value)
return value if value is not None else ""
if not (parsed_value := normalize_date_string(value)):
return value
return parsed_value
return map_date

def _map_function_datetime(self, typeinfo: dict) -> Callable:
def map_datetime(value: str, src: Optional[str]) -> str:
value = normalize_datetime_string(value)
return value if value is not None else ""
if not (parsed_value := normalize_datetime_string(value)):
return value
return parsed_value
return map_datetime

def _map_function_ref(self, typeinfo: dict) -> Callable:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dcicutils"
version = "8.13.3.1b29" # TODO: To become 8.14.0
version = "8.13.3.1b30" # TODO: To become 8.14.0
description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources"
authors = ["4DN-DCIC Team <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 9551369

Please sign in to comment.