Skip to content

GFDRR/rdls-spreadsheet-template

Repository files navigation

Risk Data Library Standard Spreadsheet Template

A template for entering Risk Data Library Standard (RDLS) metadata in spreadsheet format. For more information on the Risk Data Library project, see https://riskdatalibrary.org/.

⬇️ Download the full template (Hazard, exposure, vulnerability and loss metadata)

How to use the template

  1. Read the RDLS documentation to learn about the structure of RDLS metadata.
  2. Download the template and enter your data in your preferred spreadsheet software:
    1. Start by entering data in the first row in the datasets worksheet and then complete any other worksheets that are relevant to your dataset.
    2. Use the field information to understand what data to enter into each column and how to format it.
    3. Use identifiers to relate data entered across multiple worksheets.
    4. Make sure that you complete all of the required fields for each worksheet that you add data to.
  3. Convert your data to JSON format and validate it against the RDLS schema using the RDLS Convertor.
  4. Fix any issues reported by the RDLS Convertor.

For more guidance on how to publish RDLS metadata, refer to the implementation guidance.

How to customise the template

You can hide worksheets and columns that are not relevant to your datasets. However, you must ensure that you complete all of the required fields for each worksheet to which you add data.

Frequently asked questions

What does the '0' refer to in the field names?

It indicates that each row under that field path should be interpreted as an item in an array, e.g. under attributions/0/id the first row will be interpreted as the id of the first item in the attributions array and the second row will be interpreted as the id of the second item.

Reference

Worksheets

The template consists of several worksheets, reflecting the structure of the RDLS schema. The datasets worksheet is the main worksheet and each row in the datasets worksheet represents a risk dataset. The other worksheets in the template represent arrays in the RDLS schema, with rows representing items in the arrays. For example, each row in the the resources worksheet represents a resource. For more information on the RDLS schema, refer to the schema reference.

Identifiers

Identifiers are used to relate data entered across multiple worksheets, allowing the possibility of one-to-many relationships, such as one dataset made up of many resources. Rows in child worksheets are related to rows in parent worksheets using the parent object’s id field. For example, the id column in the resources is used to reference the id of the dataset to which the resource belongs. Similarly, each row in the hazard_event_sets_events represents an event in an event set. The hazard/event_sets/0/id column references the event set to which the event belongs and the id column references the dataset to which the event set and event belong."

Field information

Each column in the template represents a field in the RDLS schema. The following information is provided for each field:

  • path: A JSON pointer that identifies the RDLS field represented by the column. This information is used to convert data from spreadsheet format to JSON format. For more information, refer to the Flatten Tool JSON pointer documentation.
  • title: The title of the field, from the RDLS schema.
  • description: The description of the field, from the RDLS schema. You must ensure that the data you enter into each column conforms to the field's description.
  • required: Whether the field is required (mandatory). You must populate required fields unless no other fields in the worksheet are populated.
  • type: The data type of the field, from the RDLS schema. The possible types are:
    • string (text)
    • number (decimal)
    • integer (whole number)
    • boolean (true/false)
    • array (list of values).
  • values: If the field references a closed codelist, the permitted values. If the value of the field must conform to a particular string format, the name of the format. The possible formats are:
    • date (YYYY-MM-DD)
    • email
    • iri (web address)
  • codelist: If the field references a codelist, the name of the codelist. To view the title and description of each code, open the link.
  • input guidance: Guidance on how to enter data in spreadsheet format.

Developer documentation

The spreadsheet template is generated from the RDLS schema using the script in manage.py.

Set up your development environment

Clone the repository

git clone git@github.com:GFDRR/rdls-spreadsheet-template.git
cd rdls-spreadsheet-template

Subsequent instructions assume that your current working directory is rdls-spreadsheet-template, unless otherwise stated.

Initialise and update submodules:

git submodule init
git submodule update

Create and activate a Python virtual environment

The following instructions assume you have Python 3.8 or newer installed on your machine.

You can use either pyenv or python3-venv for this step.

pyenv
  1. Install pyenv. The pyenv installer is recommended.

  2. Create a virtual environment.

    pyenv virtualenv rdls-spreadsheet-template
  3. Activate the virtual environment.

    pyenv activate rdls-spreadsheet-template
  4. Set the local application-specific virtual environment. Once set, navigating to the rdls-spreadsheet-template directory will automatically activate the environment.

    pyenv local rdls-spreadsheet-template
virtualenv
  1. Create a virtual environment named .ve.

  2. Linux/MacOS users:

    python3 -m venv .ve
  3. Windows users:

    py -m venv .ve
  4. Activate the virtual environment. You must run this command for each new terminal session.

  5. Linux/MacOS users:

    source .ve/bin/activate
  6. Windows users:

    .\.ve\Scripts\activate

Install requirements:

pip install --upgrade pip setuptools
pip install -r requirements.txt

Update the template

Update the main template:

python manage.py create-template

Update the component templates using the -c option, e.g. update the hazard component:

python manage.py create-template -c hazard

To see all options, pass the --help flag:

python manage.py create-template --help

About

A template for entering Risk Data Library Standard (RDLS) metadata in spreadsheet format

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages