Auxiliary Commands

In addition to the main and low level commands, pwfdf-api provides several auxiliary commands. These commands can help users locate ScienceBase resources, and can provide advanced developers with utilities for implementing ScienceBase API queries.

Catalog

The catalog CLI provides info to help locate ScienceBase catalog resources. The catalog CLI is split into two subcommands, url and browse, and the typical syntax is:

pwfdf catalog <subcommand> <resource>

The url subcommands return the URL to a given catalog resource, and the browse subcommands open the resource in a web browser. Refer to the API for a complete list of supported resources. Here, we highlight the browse status command, which opens the catalog status page:

pwfdf catalog browse status

The catalog package provides info to help locate ScienceBase catalog resources. The package is split into two modules, url and browse The url module contains functions that return the URL to a given catalog resource, and functions in the browse module open the resource in a web browser. Refer to the catalog API for a complete list of supported resources. Here, we highlight the browse.status function, which opens the catalog status page:

pwfdf_api.catalog.browse.status()

Parent

The parent CLI provides info on the PWFDF parent item. This item is the main landing page for the collection, and organizes each hazard assessment as a distinct child item. The parent CLI contains the following subcommands:

Subcommand

Description

id

Returns the ID of the PWFDF parent collection

url

Returns the URL to the PWFDF parent collection

browse

Opens the PWFDF parent in a web browser

sbjson

Returns the sbJSON info for the PWFDF parent

For example:

# Print the parent item ID
pwfdf parent id

# Open the parent item in a web browser
pwfdf parent browse

The parent module provides functions with info on the PWFDF parent item. This item is the main landing page for the collection, and organizes each hazard assessment as a distinct child item. The module contains the following functions:

Function

Description

id

Returns the ID of the PWFDF parent collection

url

Returns the URL to the PWFDF parent collection

browse

Opens the PWFDF parent in a web browser

sbjson

Returns the sbJSON info for the PWFDF parent

For example:

from pwfdf_api import parent

# Get the parent item ID
id = parent.id()

# Open the parent in a web browser
parent.browse()

Item

The item CLI provides info on a queried ScienceBase item. This CLI is mostly intended for advanced developers implementing low-level ScienceBase API calls. The item CLI provides similar subcommands as the parent CLI. However, there is no id subcommand, and the remaining commands all require an item ID as input. For example:

pwfdf item browse 6838d149d4be025925747189

The item module provides functions with info on a queried ScienceBase item. This module is mostly intended for advanced developers implementing low-level ScienceBase API calls. The module provides similar subcommands as the parent module. However, there is no id function, and the remaining functions all require an item ID as input. For example:

from pwfdf_api import item
item.browse("6838d149d4be025925747189")