Repository navigation
Add search_occurrences() and get_occurrence() to WildbookClient - #18
Conversation
|
Thanks! Since Wildbook has migrated all of the user-facing bits to use "sighting" instead of "occurrence", I'm wondering if we should go with search_sightings() and get_sighting(). (Granted, it would also be good to alias the /api/v3/occurrences endpoint with /api/v3/sightings ...) Let's also update the README to include the new methods. |
|
Thanks Kirk, I pushed a commit renaming to search_sightings()/get_sighting() and adding a README section -- ready for another look whenever you get a chance |
|
Looking good Courtney! The other thing we should do, but can save for another PR is add unit testing for these. I need to do that for encounters so we can do all at once. I'll start a branch for that once we merge this one. |
|
Thanks Kirk - I added the same note to get_sighting (pushed). Sounds good on saving unit tests for a follow-up PR, especially if you're bundling encounters in with it. Let me know if this is good to merge as is. |
The Wildbook v3 API exposes /api/v3/search/occurrence and /api/v3/occurrences/{id} but WildbookClient has no methods for them. Users who need occurrence data (survey type, group size estimates, transect fields, etc.) are currently forced to bypass the client and call client.session.post() directly.
This PR adds search_occurrences() and get_occurrence() using the same pattern as the existing encounter and individual methods — no new dependencies, minimal change.
Tested against GiraffeSpotter (giraffespotter.org). The occurrence search returns fields including sightingPlatform, fieldSurveyCode, numAdults, numJuveniles, numCalves, groupComposition, groupBehavior, transect fields, and comments — all of which appear in the Wildbook web export CSVs but are not available via the current client.