pyinaturalist.models Package

Data models that represent iNaturalist API response objects. See Models section for usage details.

Functions

add_lazy_attrs(cls, fields)

A field transformer to do some post-processing on a model class while it’s being created.

coordinate_pair(**kwargs)

Field containing a pair of coordiantes

datetime_field(**kwargs)

Field that converts date/time strings into datetime objects

datetime_now_field(**kwargs)

Field that converts date/time strings into datetime objects, and defaults to the current time

field([doc, options, metadata])

A field with extra metadata for documentation and options

get_lazy_properties(cls)

rtype

Dict[str, LazyProperty]

get_model_fields(obj)

Add placeholder attributes for lazy-loaded model properties so they get picked up by rich’s pretty-printer.

is_in(options)

Validator for an optional multiple-choice attribute

load_json(value)

Load a JSON string, file path, or file-like object

upper(value)

Converter to change a string to uppercase, if applicable

Classes

Annotation([id, concatenated_attr_val, …])

An annotation, meaning a controlled term value applied by a user to an observation.

BaseModel([id])

Base class for data models

BaseModelCollection([id])

Base class for data model collections.

Comment([id, body, created_at, hidden, …])

An observation comment, based on the schema of comments from GET /observations.

ConservationStatus([id, authority, …])

The conservation status of a taxon in a given location, based on the schema of:

ControlledTerm([id, is_value, multivalued, …])

A controlled term, based on the schema of GET /controlled_terms.

ControlledTermValue([id, blocking, label, …])

A controlled term value, based on the schema of GET /controlled_terms.

EstablishmentMeans([id, …])

The establishment means for a taxon in a given location

ID

alias of pyinaturalist.models.identification.Identification

Identification([id, body, category, …])

An observation identification, based on the schema of GET /identifications.

LazyProperty(converter[, name, doc, type])

A lazy-initialized/cached descriptor, similar to @functools.cached_property, but works for slotted classes by not relying on __dict__.

LifeList([id, count_without_taxon, data, …])

A user’s life list, based on the schema of GET /observations/taxonomy

LifeListTaxon([id, ancestor_ids, …])

A single Taxon in a user’s LifeList

OFD

alias of pyinaturalist.models.observation_field.ObservationField

OFV

alias of pyinaturalist.models.observation_field.ObservationFieldValue

Observation([created_at_details, …])

An observation, based the schema of GET /observations.

ObservationField([id, allowed_values, …])

An observation field definition, based on the schema of GET /observation_fields.

ObservationFieldValue([id, datatype, …])

An observation field value, based on the schema of Observation.ofvs from GET /observations.

Observations([id, data])

A collection of observations

Photo([id, attribution, license_code, …])

An observation photo, based on the schema of photos from:

Place([id, admin_level, ancestor_place_ids, …])

A curated or community-contributed place.

Project([id, banner_color, created_at, …])

An iNaturalist project, based on the schema of GET /projects.

ProjectObservation([id, preferences, …])

Metadata about an observation that has been added to a project

ProjectObservationField([id, …])

An ObservationField with additional project-specific information

ProjectUser([id, activity_count, …])

A User with additional project-specific information

SearchResult([id, score, type, matches, record])

A search result of any type, based on the schema of GET /search.

Taxon([id, ancestor_ids, complete_rank, …])

An iNaturalist taxon, based on the schema of GET /taxa.

TaxonCount([id, ancestor_ids, …])

A Taxon with an associated count, used in a TaxonCounts collection

TaxonCounts([id, data])

A collection of taxa with an associated counts.

User([id, activity_count, created_at, icon, …])

An iNaturalist user, based on the schema of GET /users/{id}.