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

Create/update observations with Observation objects #545

Open
JWCook opened this issue Jan 29, 2024 · 0 comments
Open

Create/update observations with Observation objects #545

JWCook opened this issue Jan 29, 2024 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@JWCook
Copy link
Member

JWCook commented Jan 29, 2024

Currently iNatClient.observations.create() and update() take individual keyword arguments, same as v1.create_observation(), but I would like it to optionally accept an Observation instead. This would be useful for observations loaded from a file (CSV, JSON, etc.) via pyinaturalist-convert. See also #542

A small problem is that only a subset of Observation attributes can be used to create a new observation. For example, you can't add identifications, comments, or a full Taxon record (aside from name/ID) that way. It might be sufficient to just ignore any extra attributes, and log a warning indicating which attributes were ignored. For example:

>>> obs = Observation(
...     ...,
...     identifications=[Identification(...)],
...     comments=[Comment(...)],
... )
>>> client.observations.create(obs)
'[WARNING] Read-only observation attributes ignored: identifications, comments'
@JWCook JWCook added the enhancement New feature or request label Jan 29, 2024
@JWCook JWCook added this to the v0.20 milestone Jan 29, 2024
@JWCook JWCook changed the title Create observations with Observation objects Create/update observations with Observation objects Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant