naturtag.storage.client module¶
- class naturtag.storage.client.ObservationDbController(*args, taxon_controller, **kwargs)¶
Bases:
ObservationController
- count(username, **params)¶
Get the total number of observations matching the specified criteria
- Return type:
int
- from_ids(observation_ids, refresh=False, taxonomy=False, **params)¶
Get observations by ID; first from the database, then from the API
- Return type:
- get_user_observations(username, updated_since=None, limit=50, page=1)¶
Fetch any new user observations from the API since last search, save them to the db, and then return up to
limit
most recent observations from the db- Return type:
list
[Observation
]
- save(observations)¶
Save observations to the database (full records + text search index)
- search(**params)¶
Search observations, and save results to the database (for future reference by ID)
- Return type:
- class naturtag.storage.client.TaxonDbController(client)¶
Bases:
TaxonController
- from_ids(taxon_ids, accept_partial=False, refresh=False, **params)¶
Get taxa by ID; first from the database, then from the API
- Return type:
- search(**params)¶
Search taxa, and save results to the database (for future reference by ID)
- Return type:
- class naturtag.storage.client.iNatDbClient(db_path=PosixPath('/home/docs/.local/share/Naturtag/naturtag.db'), **kwargs)¶
Bases:
iNatClient
API client class that uses a local SQLite database to cache observations and taxa (when searched by ID)
- from_id(observation_id=None, taxon_id=None)¶
Get an iNaturalist observation and/or taxon matching the specified ID(s). If only a taxon ID is provided, the observation will be a placeholder with only the taxon field populated.
- Return type:
Optional
[Observation
]