Adding a new metadata field - Vanuatu-National-Statistics-Office/vnso-nsdp-platform GitHub Wiki

To add a new metadata field for display on indicators, you will first need to edit this file:

https://github.com/Vanuatu-National-Statistics-Office/vnso-nsdp-platform/blob/develop/metadata-schema.yml

Adding a new item in this file will have two effects:

  1. The new metadata field will appear on indicator pages
  2. The new metadata field will appear in the metadata edit forms

For example, at the time of this writing the file referenced above looks like this:

prose:
  metadata:
    meta:
      - name: "Proxy"
        field:
            element: text
            translation_key: "Proxy"
            scope: national
      - name: "Definition"
        field:
            element: text
            translation_key: "Definition"
            scope: national

Let's imagine we want to add a new field called "Email". To add this new "Email" field, you would need to add a new chunk of code to that file. You may find that it is easiest to copy/paste from one of the existing fields. For example, this might result in the following:

prose:
  metadata:
    meta:
      - name: "Proxy"
        field:
            element: text
            translation_key: "Proxy"
            scope: national
      - name: "Definition"
        field:
            element: text
            translation_key: "Definition"
            scope: national
      - name: "Email"
        field:
            element: text
            translation_key: "Email"
            scope: national

Notes about the keys used in this file:

  • name: This is the "machine name" of the field.
  • element: This should always be "text".
  • translation_key: This is the human-readable name of the field.
  • scope: This should always be "national".

NOTE: This file uses the YAML syntax, which is notoriously picky about indentation. When editing this file, be precise about the indentation used.