Skip to content

Commit

Permalink
feat: add function to retrieve owner institution codes by image UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsbarnard committed Nov 4, 2024
1 parent 0895d5c commit 773290a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/fathomnet/api/darwincore.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ def find_owner_institution_codes() -> List[str]:
"""Get a list of owner institutions."""
res_json = DarwinCore.get("list/ownerinstitutions")
return res_json


def find_owner_institutions_by_image_uuid(image_uuid: str) -> List[str]:
"""Get a list of owner institutions by image UUID."""
res_json = DarwinCore.get(f"query/ownerinstitutions/{image_uuid}")
return res_json
7 changes: 7 additions & 0 deletions test/test_darwincore.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ def test_find_owner_institution_codes(self):
owner_institution_codes = darwincore.find_owner_institution_codes()
self.assertIsNotNone(owner_institution_codes)
self.assertGreater(len(owner_institution_codes), 0)

def test_find_owner_institutions_by_image_uuid(self):
owner_institutions = darwincore.find_owner_institutions_by_image_uuid(
"b7736c31-0b78-4761-840c-e3781d6845be"
)
self.assertIsNotNone(owner_institutions)
self.assertIn("MBARI", owner_institutions)

0 comments on commit 773290a

Please sign in to comment.