Skip to main content

A tool to crawl OSC STAC catalogs and ingest them into eoapi

Project description

osc-to-eoapi

A Python package to crawl OSC (Open Science Catalog) STAC catalogs and ingest them into an eoapi STAC API instance.

Installation

pip install .

Usage

Ingesting Data

osc-to-eoapi crawl [OPTIONS]

Options:

  • --github-url TEXT: URL to the root OSC STAC catalog.json on GitHub. (Default: ESA OSC main branch)
  • --eoapi-url TEXT: URL to the eoapi STAC API instance. (Default: http://localhost:8080)
  • --update: If a collection/item already exists (409), attempt to update it with a PUT request.
  • --overwrite: Force overwrite by deleting existing collections/items before ingestion.
  • --reset-db: Clear all collections from the target STAC API before starting the crawl.
  • --test-endpoint: Perform a health check on the STAC API before starting.
  • --crawl-external: Enable recursive crawling of external STAC links found in the catalog. Includes cycle detection to prevent infinite loops.
  • --kb-cache TEXT: Path to a local JSON file to cache the taxonomies (variables, projects, etc.) to significantly speed up subsequent runs. In order to disable it set it to an empty string. (Default: kb_cache.json)
  • --skip-collection TEXT: Collection ID to skip if it is already present in the target API. Can be provided multiple times (e.g., --skip-collection "col1" --skip-collection "col2").
  • --category TEXT: Specific category to crawl. Defaults to crawling all categories (products, experiments, workflows). Can be provided multiple times (e.g., --category workflows --category experiments).
  • --debug: Enable verbose debug logging to trace the recursive traversal of external catalogs and item discovery. Useful for identifying bottlenecks or infinite loops in remote datasets.

Loading Queryables

To enable filtering by the custom OSC properties (e.g., osc:project, kb:variable:title), load the queryables schema:

osc-to-eoapi load-queryables

You can also provide a custom schema:

osc-to-eoapi load-queryables --schema ./my-schema.json

Publishing to PyPI

  1. Ensure you have build and twine installed:
    pip install build twine
    
  2. Build the package:
    python -m build
    
  3. Upload to PyPI:
    python -m twine upload dist/*
    

Development

  1. Create and activate a Python virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Linux/macOS
    # OR: venv\Scripts\activate # On Windows
    
  2. Install in editable mode with dependencies:

    pip install -e .
    

Local Testing Environment

A docker-compose.yml is provided to easily spin up a local PgSTAC database and eoapi STAC API instance for testing.

  1. Start the local infrastructure:

    docker compose up -d
    
  2. Export local database credentials (required for pypgstac to load queryables). A .env file is provided, which you can source directly:

    set -a; source .env; set +a
    
  3. Load the custom queryables into the local database:

    osc-to-eoapi load-queryables
    
  4. Run the crawler against the local API (running on http://localhost:8080):

    osc-to-eoapi crawl --test-endpoint --reset-db --eoapi-url http://localhost:8080
    

    (Add --crawl-external if you want to test recursive external link crawling).

  5. Tear down the local infrastructure and wipe test data when finished:

    docker compose down -v
    

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

osc_to_eoapi-0.1.1.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

osc_to_eoapi-0.1.1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file osc_to_eoapi-0.1.1.tar.gz.

File metadata

  • Download URL: osc_to_eoapi-0.1.1.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for osc_to_eoapi-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fa536f4393859ef3164511b23d5e137d83624d2bc6fb5276035bff5101e2a316
MD5 d8d4185fda8a4e2630061cc7bdcb32f5
BLAKE2b-256 79686bf5186aebc1b6a054e8e9566fdacba59b37c7d68e9525e0bb65151360d8

See more details on using hashes here.

File details

Details for the file osc_to_eoapi-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: osc_to_eoapi-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for osc_to_eoapi-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 75110304985c7551ac7eee4637f7598842fb370f60a6972884a3823e450b1f1a
MD5 a66bb27016ce17b32e1c620ef9d2693e
BLAKE2b-256 f044f856d2e66db6383312270fcfbfe0e53bdf3972ffc522295f2a059b9ebd5f

See more details on using hashes here.

Supported by

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