naturtag.models package

Submodules

naturtag.models.base module

class naturtag.models.base.BaseModel(id: Optional[int] = None, partial: Optional[bool] = None)[source]

Bases: object

Base class for models

classmethod from_json(value: Union[Dict, IO, Iterable[Dict], pathlib.Path, str], partial=False)[source]

Create a new model object from a JSON path, file-like object, or API response object

id: int
partial: bool
to_json()Dict[source]
class naturtag.models.base.ModelCollection(initlist=None)[source]

Bases: collections.UserList, Generic[naturtag.models.base.T]

Base class representing a collection of model objects. This is used mainly for initializing from API responses, and some convenience methods that aggregate info from multiple objects.

data: List[naturtag.models.base.T] = None
classmethod from_json(value: Union[Dict, IO, Iterable[Dict], pathlib.Path, str])[source]

Initialize from a JSON path, file-like object, or API response

classmethod model_class()Type[naturtag.models.base.BaseModel][source]

Inspect the class to get the model type

model_cls: Type[naturtag.models.base.BaseModel] = None
to_json()List[Dict][source]

naturtag.models.identification module

class naturtag.models.identification.Identification(id: Optional[int] = None, partial: Optional[bool] = None, body: Optional[str] = None, category: Optional[str] = None, comment: Optional[str] = None, current: Optional[bool] = None, current_taxon: Optional[bool] = None, disagreement: Optional[bool] = None, hidden: Optional[bool] = None, own_observation: Optional[bool] = None, previous_observation_taxon_id: Optional[int] = None, spam: Optional[bool] = None, taxon_change: Optional[bool] = None, taxon_id: Optional[int] = None, vision: Optional[bool] = None, created_at: Optional[str] = None, uuid=None, flags: List = NOTHING, moderator_actions: List = NOTHING, taxon: Optional[Union[Dict, IO, Iterable[Dict], pathlib.Path, str]] = None, user: Optional[Union[Dict, IO, Iterable[Dict], pathlib.Path, str]] = None)[source]

Bases: naturtag.models.base.BaseModel

body: str
category: str
comment: str
created_at: datetime.datetime
current: bool
current_taxon: bool
disagreement: bool
flags: List
hidden: bool
moderator_actions: List
own_observation: bool
previous_observation_taxon_id: int
spam: bool
taxon: naturtag.models.taxon.Taxon
taxon_change: bool
taxon_id: int
user: naturtag.models.user.User
uuid: uuid.UUID
vision: bool
class naturtag.models.identification.Identifications(initlist=None)[source]

Bases: collections.UserList, Generic[naturtag.models.base.T]

A collection of identification records

model_cls

alias of naturtag.models.identification.Identification

naturtag.models.image_metadata module

naturtag.models.keyword_metadata module

naturtag.models.meta_metadata module

naturtag.models.observation module

class naturtag.models.observation.Observation(id: Optional[int] = None, partial: Optional[bool] = None, cached_votes_total: Optional[int] = None, captive: Optional[bool] = None, comments_count: Optional[int] = None, community_taxon_id: Optional[int] = None, description: Optional[str] = None, faves_count: Optional[int] = None, geoprivacy: Optional[str] = None, id_please: Optional[bool] = None, identifications_count: Optional[int] = None, identifications_most_agree: Optional[bool] = None, identifications_most_disagree: Optional[bool] = None, identifications_some_agree: Optional[bool] = None, license_code: Optional[str] = None, map_scale: Optional[int] = None, mappable: Optional[bool] = None, num_identification_agreements: Optional[int] = None, num_identification_disagreements: Optional[int] = None, oauth_application_id: Optional[str] = None, obscured: Optional[bool] = None, out_of_range: Optional[bool] = None, owners_identification_from_vision: Optional[bool] = None, place_guess: Optional[str] = None, positional_accuracy: Optional[int] = None, public_positional_accuracy: Optional[int] = None, quality_grade: Optional[str] = None, site_id: Optional[int] = None, spam: Optional[bool] = None, species_guess: Optional[str] = None, uri: Optional[str] = None, created_at: Optional[str] = None, time_observed_at: Optional[str] = None, updated_at: Optional[str] = None, location: Optional[str] = None, uuid=None, annotations: List = NOTHING, comments: List = NOTHING, faves: List = NOTHING, flags: List = NOTHING, identifications: Union[Dict, IO, Iterable[Dict], pathlib.Path, str] = NOTHING, ofvs: List = NOTHING, outlinks: List = NOTHING, photos: Union[Dict, IO, Iterable[Dict], pathlib.Path, str] = NOTHING, place_ids: List = NOTHING, preferences: Dict = NOTHING, project_ids: List = NOTHING, project_ids_with_curator_id: List = NOTHING, project_ids_without_curator_id: List = NOTHING, project_observations: List = NOTHING, quality_metrics: List = NOTHING, reviewed_by: List = NOTHING, sounds: List = NOTHING, tags: List = NOTHING, taxon: Optional[Union[Dict, IO, Iterable[Dict], pathlib.Path, str]] = None, user: Optional[Union[Dict, IO, Iterable[Dict], pathlib.Path, str]] = None, votes: List = NOTHING)[source]

Bases: naturtag.models.base.BaseModel

A data class containing information about an observation, matching the schema of GET /observations from the iNaturalist API: https://api.inaturalist.org/v1/docs/#!/Observations/get_observations

Can be constructed from either a full JSON record, a partial JSON record, or just an ID.

annotations: List
cached_votes_total: int
captive: bool
comments: List
comments_count: int
community_taxon_id: int
created_at: datetime.datetime
description: str
faves: List
faves_count: int
flags: List
classmethod from_id(id: int)[source]

Lookup and create a new Observation object from an ID

geoprivacy: str
id_please: bool
identifications: naturtag.models.base.ModelCollection[naturtag.models.identification.Identification]
identifications_count: int
identifications_most_agree: bool
identifications_most_disagree: bool
identifications_some_agree: bool
license_code: str
location: Optional[Tuple[float, float]]
map_scale: int
mappable: bool
num_identification_agreements: int
num_identification_disagreements: int
oauth_application_id: str
obscured: bool
ofvs: List
out_of_range: bool
owners_identification_from_vision: bool
photos: naturtag.models.base.ModelCollection[naturtag.models.photo.Photo]
place_guess: str
place_ids: List
positional_accuracy: int
preferences: Dict
project_ids: List
project_ids_with_curator_id: List
project_ids_without_curator_id: List
project_observations: List
public_positional_accuracy: int
quality_grade: str
quality_metrics: List
reviewed_by: List
site_id: int
sounds: List
spam: bool
species_guess: str
tags: List
taxon: naturtag.models.taxon.Taxon
property thumbnail_url: Optional[str]
time_observed_at: datetime.datetime
updated_at: datetime.datetime
uri: str
user: naturtag.models.user.User
uuid: uuid.UUID
votes: List
class naturtag.models.observation.Observations(initlist=None)[source]

Bases: collections.UserList, Generic[naturtag.models.base.T]

A collection of observation records

property identifiers: List[naturtag.models.user.User]

Get all unique identifiers

model_cls

alias of naturtag.models.observation.Observation

property taxa: naturtag.models.taxon.Taxa

Get all unique taxa

property thumbnail_urls: List[str]

Get thumbnails for all observation default photos

property users: List[naturtag.models.user.User]

Get all unique observers

naturtag.models.photo module

class naturtag.models.photo.Photo(id: Optional[int] = None, partial: Optional[bool] = None, attribution: Optional[str] = None, large_url: Optional[str] = None, medium_url: Optional[str] = None, original_url: Optional[str] = None, small_url: Optional[str] = None, square_url: Optional[str] = None, thumbnail_url: Optional[str] = None, url: Optional[str] = None, flags: List = NOTHING, license_code: Optional[str] = None, original_dimensions: Union[Tuple[int, int], Dict[str, int]] = (0, 0))[source]

Bases: naturtag.models.base.BaseModel

A data class containing information about a remote observation photo

attribution: str
flags: List
property has_cc_license: bool

Determine if this photo has a Creative Commons license

large_url: str
license_code: str
medium_url: str
original_dimensions: Tuple[int, int]
original_url: str
small_url: str
square_url: str
thumbnail_url: str
url: str
class naturtag.models.photo.Photos(initlist=None)[source]

Bases: collections.UserList, Generic[naturtag.models.base.T]

A collection of photos

model_cls

alias of naturtag.models.photo.Photo

naturtag.models.taxon module

class naturtag.models.taxon.Taxa(initlist=None)[source]

Bases: collections.UserList, Generic[naturtag.models.base.T]

A collection of taxon records

model_cls

alias of naturtag.models.taxon.Taxon

class naturtag.models.taxon.Taxon(id: Optional[int] = None, partial: Optional[bool] = None, ancestry: Optional[str] = None, atlas_id: Optional[int] = None, complete_rank: Optional[str] = None, complete_species_count: Optional[int] = None, extinct: Optional[bool] = None, iconic_taxon_id: Optional[int] = None, iconic_taxon_name: Optional[str] = None, is_active: Optional[bool] = None, listed_taxa_count: Optional[int] = None, name: Optional[str] = None, observations_count: Optional[int] = None, parent_id: Optional[int] = None, rank: Optional[str] = None, rank_level: Optional[int] = None, taxon_changes_count: Optional[int] = None, taxon_schemes_count: Optional[int] = None, wikipedia_summary: Optional[str] = None, wikipedia_url: Optional[str] = None, preferred_common_name: str = '', ancestor_ids: List[int] = NOTHING, ancestors: List[Dict] = NOTHING, children: List[Dict] = NOTHING, conservation_statuses: List[str] = NOTHING, current_synonymous_taxon_ids: List[int] = NOTHING, default_photo: Optional[Union[Dict, IO, Iterable[Dict], pathlib.Path, str]] = None, flag_counts: Dict = NOTHING, listed_taxa: List = NOTHING, taxon_photos=NOTHING)[source]

Bases: naturtag.models.base.BaseModel

A data class containing information about a taxon, matching the schema of GET /taxa from the iNaturalist API: https://api.inaturalist.org/v1/docs/#!/Taxa/get_taxa

Can be constructed from either a full JSON record, a partial JSON record, or just an ID. Examples of partial records include nested ancestors, children, and results from get_taxa_autocomplete()

ancestor_ids: List[int]
ancestors: List[Dict]
ancestry: str
property ancestry_str
atlas_id: int
property child_taxa: List

Get this taxon’s children as Taxon objects (in descending order of rank)

property child_taxa_ids: List
children: List[Dict]
complete_rank: str
complete_species_count: int
conservation_statuses: List[str]
current_synonymous_taxon_ids: List[int]
default_photo: naturtag.models.photo.Photo
extinct: bool
flag_counts: Dict
classmethod from_id(id: int)[source]

Lookup and create a new Taxon object from an ID

property icon_path: str
iconic_taxon_id: int
iconic_taxon_name: str
is_active: bool
listed_taxa: List
listed_taxa_count: int
name: str
observations_count: int
property parent

Return immediate parent, if any

parent_id: int
property parent_taxa: List

Get this taxon’s ancestors as Taxon objects (in descending order of rank)

property parent_taxa_ids: List
photos: List[naturtag.models.photo.Photo]
preferred_common_name: str
rank: str
rank_level: int
taxon_changes_count: int
taxon_photos: List[naturtag.models.photo.Photo]
taxon_schemes_count: int
update_from_full_record()[source]
property uri: str
wikipedia_summary: str
wikipedia_url: str
naturtag.models.taxon.convert_taxon_photos(taxon_photos)[source]
naturtag.models.taxon.get_icon_path(taxon_id: int)str[source]

An iconic function to return an icon for an iconic taxon

naturtag.models.user module

class naturtag.models.user.User(id: Optional[int] = None, partial: Optional[bool] = None, login: Optional[str] = None, name: Optional[str] = None, activity_count: Optional[int] = None, display_name: Optional[str] = None, icon: Optional[str] = None, icon_url: Optional[str] = None, identifications_count: Optional[int] = None, journal_posts_count: Optional[int] = None, observations_count: Optional[int] = None, orcid: Optional[str] = None, site_id: Optional[int] = None, spam: Optional[bool] = None, suspended: Optional[bool] = None, universal_search_rank: Optional[int] = None, username: Optional[str] = None, created_at: Optional[str] = None, roles: List = NOTHING)[source]

Bases: naturtag.models.base.BaseModel

activity_count: int
created_at: datetime.datetime
display_name: str
icon: str
icon_url: str
identifications_count: int
journal_posts_count: int
login: str
name: str
observations_count: int
orcid: str
roles: List
site_id: int
spam: bool
suspended: bool
universal_search_rank: int
username: str