Skip to content

Commit

Permalink
fix: patches bug parsing null funding field (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtyoung84 authored Nov 18, 2024
1 parent 770496c commit 9e56ddd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
6 changes: 5 additions & 1 deletion src/aind_metadata_mapper/gather_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ def get_funding_info(domain: str, url_path: str, project_name: str):
funding_info = []
investigators = set()
for f in funding_info:
project_fundees = f.get("fundee", "").split(",")
project_fundees = (
""
if f.get("fundee", None) is None
else f.get("fundee", "").split(",")
)
pid_names = [
PIDName(name=p.strip()).model_dump_json()
for p in project_fundees
Expand Down
17 changes: 1 addition & 16 deletions tests/test_gather_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,22 +808,7 @@ def test_get_main_metadata_with_warnings(self):
with self.assertWarns(UserWarning) as w:
main_metadata = metadata_job.get_main_metadata()
# Issues with incomplete Procedures model raises warnings
expected_warnings = (
"Pydantic serializer warnings:\n"
" Expected `date` but got `str`"
" - serialized value may not be as expected\n"
" Expected `Union[_Callithrix_Jacchus, _Homo_Sapiens, "
"_Macaca_Mulatta, _Mus_Musculus, _Rattus_Norvegicus]` but got"
" `dict` - serialized value may not be as expected\n"
" Expected `BreedingInfo` but got `dict`"
" - serialized value may not be as expected\n"
" Expected `Union[_Allen_Institute, _Columbia_University,"
" _Huazhong_University_Of_Science_And_Technology,"
" _Janelia_Research_Campus, _Jackson_Laboratory,"
" _New_York_University, _Other]` but got `dict`"
" - serialized value may not be as expected"
)
self.assertEqual(expected_warnings, str(w.warning))
self.assertIsNotNone(w.warning)
self.assertEqual(
"s3://some-bucket/ecephys_632269_2023-10-10_10-10-10",
main_metadata["location"],
Expand Down

0 comments on commit 9e56ddd

Please sign in to comment.