Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: patches bug parsing null funding field #199

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading