Skip to main content

Python utilities for working with inaturalist-open-data

Project description

pyinaturalist-open-data

This is a work in progress and not yet complete!

Python utilities for working with inaturalist-open-data and integrating with iNaturalist API data via pyinaturalist.

Installation

Install with pip:

pip install pyinaturalist-open-data

Or for local development:

git clone https://github.com/JWCook/pyinaturalist-open-data.git
cd pyinaturalist-open-data
pip install poetry && poetry install

Usage

This package provides the command pynat. See --help for commands and options:

Usage: pynat [OPTIONS] COMMAND [ARGS]...

  Commands for working with inaturalist open data

Options:
  -v, --verbose  Show more detailed output
  --help         Show this message and exit.

Commands:
  db    Load contents of CSV files into a database
  dl    Download and extract inaturalist open data archive
  init  Just create tables (if they don't already exist) without populating...
  load  Download and load all data into a database.

Run everything

The simplest command is load, which runs all steps:

  1. Download and extract the dataset
  2. Create database tables and indices
  3. Load the data into the database

Options:

Usage: pynat load [OPTIONS]

Options:
  -d, --download-dir TEXT  Alternate path for downloads
  -u, --uri TEXT           Alternate database URI to connect to
  --help                   Show this message and exit.

By default, this will create a new SQLite database. Alternatively, you can provide a URI for any supported database.

Run individual steps

Other commands are available if you only one to run one of those steps at a time.

dl command:

Usage: pynat dl [OPTIONS]

  Download and extract all files in the inaturalist open data archive

Options:
  -d, --download-dir TEXT  Alternate path for downloads
  --help                   Show this message and exit

db command:

Usage: pynat db [OPTIONS]

  Load contents of CSV files into a database. Also creates tables and
  indexes, if they don't already exist.

Options:
  -d, --download-dir TEXT         Alternate path for downloads
  -i, --init                      Just initialize the database with tables
                                  + indexes without loading data
  -t, --tables [observation|photo|taxon|user]
                                  Load only these specific tables
  -u, --uri TEXT                  Alternate database URI to connect to

  --help                          Show this message and exit.

Note: This can take a long time to run. Depending on the database type, you will likely get better performance with database-specific bulk loading tools (for example, psql with COPY for PostgreSQL)

Python package

To use as a python package instead of a CLI tool:

from pyinaturalist_open_data import download_metadata, load_all

download_metadata()
load_all()

Full package documentation on readthedocs will be coming soon.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyinaturalist-open-data-0.1.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

pyinaturalist_open_data-0.1.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file pyinaturalist-open-data-0.1.0.tar.gz.

File metadata

  • Download URL: pyinaturalist-open-data-0.1.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.4 Linux/5.4.0-1046-azure

File hashes

Hashes for pyinaturalist-open-data-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ddb5af82d4b0f8def628ef0b641c288d54c1510fbbf4587874ffd648416a638f
MD5 a683db5d4b683dd0e4269c3e7c16af6b
BLAKE2b-256 d1c024c316ca88cf95c1429f644bc13c0638976bf5ce07a3cb161c1ef7ffc942

See more details on using hashes here.

File details

Details for the file pyinaturalist_open_data-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pyinaturalist_open_data-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0599e6bd37c92f1220e331838fe7957d36e08ed3e0dbdbf7faa7d221a666694
MD5 bf1b4857a85d6394f755c89506ea8927
BLAKE2b-256 7a35e35537c7232518f655b796c24dc2eb30a13ae62af53609c62238cf9eb402

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page