Skip to content

The safedata_metadata tool

Info

The subcommands of the safedata_metadata tools require that the metadata section of the resources configuration be completed. This is not required for simply validating datasets.

The safedata_metadata command line tool provides the following subcommands which are used to update a server running the safedata server API.

The top level command line help for the tool, showing the available subcommands is shown below:

cl_prompt $ safedata_metadata -h
usage: safedata_metadata [-h] [-r RESOURCES] [-s] [-q]  ...

Post updated information to a safedata server instance.

    This command line tool provides functions to update a web server running
    the safedata server API. This includes updating the gazetteer data used
    for the instance and updating the database of published datasets.

    To use these tools, the safedata_validator Resources configuration must
    contain the URL for the server and an access token.

positional arguments:

    post_metadata
                Post dataset metadata to a safedata server
    update_resources
                Update the gazetteer data on safedata server

options:
  -h, --help    show this help message and exit
  -r RESOURCES, --resources RESOURCES
                Path to a safedata_validator resource configuration file
  -s, --show-resources
                Validate and display the selected resources and exit
  -q, --quiet   Suppress normal information messages.

The safedata_metadata subcommands

The command line help for each of the various subcommands is shown below:

The post_metadata subcommand

cl_prompt $ safedata_metadata post_metadata -h
usage: safedata_metadata post_metadata [-h] zenodo_json dataset_json

This function posts dataset and Zenodo metadata for a validated and published
dataset to an server providing the API for accessing and searching safedata
metadata. The metadata server then handles populating a database with the
metadata and exposing that data via the server API.

positional arguments:
  zenodo_json   Path to a Zenodo metadata file
  dataset_json  Path to a dataset metadata file

options:
  -h, --help    show this help message and exit

The update_resources subcommand

cl_prompt $ safedata_metadata update_resources -h
usage: safedata_metadata update_resources [-h]

This function updates the resources being used by a safedata server instance. It
uploads the gazetteer geojson file, location aliases CSV and any project database
CSV being used. The server then validates the file contents.

The resource file being used sets both the metadata server instance IP address and
provides the paths to the files to be uploaded.

options:
  -h, --help  show this help message and exit