AnnotationController¶
- class pyinaturalist.controllers.AnnotationController(*args, **kwargs)¶
Bases:
BaseControllerController for Annotation and ControlledTerm requests
Methods
- __init__(*args, **kwargs)¶
- all(**params) List[ControlledTerm]¶
List controlled terms and their possible values
- Return type:
Notes
API reference: GET /controlled_terms
Example
>>> terms = client.annotations.all() >>> pprint(terms) ID Label Values ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1 Life Stage Adult, Teneral, Pupa, ... 17 Alive or Dead Alive, Dead, Cannot Be Determined ...
- create(controlled_attribute_id, controlled_value_id, resource_id, resource_type='Observation', **params) Annotation¶
Create a new annotation on an observation.
- Parameters:
Example
Add a ‘Plant phenology: Flowering’ annotation to an observation (via IDs):
>>> client.annotations.create(12, 13, 164609837)
- Return type:
- Returns:
The newly created Annotation object
- delete(uuid, **params)¶
Delete an annotation
- Parameters:
uuid (
str) – Annotation UUID- Returns:
Nothing; success means the item has been deleted
- for_taxon(taxon_id, **params) List[ControlledTerm]¶
List controlled terms that are valid for the specified taxon.
Notes
API reference: GET /controlled_terms/for_taxon
Example
>>> client.annotations.for_taxon(12345)
- Parameters:
taxon_id (
int) – Taxon ID to get controlled terms for- Raises:
.TaxonNotFound – If an invalid
taxon_idis specified- Return type:
- lookup(annotations) List[Annotation]¶
Fill in missing information for the specified annotations. If only term and value IDs are present, this will look up, cache, and add complete controlled term details.
- Parameters:
annotations (
List[Annotation]) – Observation annotations- Return type:
- Returns:
Annotation objects with
controlled_attributeandcontrolled_valuepopulated