Ocean Watch JSON - resource-watch/ocean-watch-data GitHub Wiki

The Ocean Watch JSON

The content displayed at the front end of the Ocean Watch pages is controlled by a JSON file. It is essential that Ocean Watch Data Team members familiarize themselves with this file and its organization, as they are responsible for maintaining and updating content on the site.

Organization and Configuration

Staging and Production

The JSON file has two top level properties: staging and production. These control the versions of the page display in the staging and production environments respectively. The staging environment allows you to test and experiment with different resources and configuration options without displaying the page publicly. Instead they will display only on the staging site (https://staging.resourcewatch.org/dashboards/ocean-watch). The production environment is the version of the page that is fully accessible publicly (https://resourcewatch.org/dashboards/ocean-watch).

Unless you are testing a new resource or configuration, the properties and values in these two sections should be exactly the same.

These staging and production properties have many sub-properties. Here is a skeleton of the organization of the top-level staging and production properties:

{
  "intro": {
    "indicators": [...],
    "steps": [...]
  },
  "country-profile": [
    [
      {
        "content": [...]
      }
    ],
    [
      {
        "title": "How is land based pollution generated?",
        "anchor": "how-is-land-based-pollution-generated",
        "anchorTitle": "Land-Based Pollution",
        "content": [...]
      }
    ],
    [
      {
        "title": "How do pollutants travel to the ocean?",
        "anchor": "how-do-pollutants-travel-to-the-ocean",
        "anchorTitle": "Movement of Ocean Pollutants",
        "content": [...]
      }
    ],
    [
      {
        "title": "How does pollution damage coastal ecosystems?",
        "anchor": "how-does-pollution-damage-coastal-ecosystems",
        "anchorTitle": "Effects of Coastal Pollution",
        "content": [...]
      }
    ],
    [
      {
        "title": "Why is the ocean so valuable?",
        "anchor": "why-is-the-ocean-so-valuable",
        "anchorTitle": "Value of Coastal Ecosystems",
        "content": [...]
      }
    ]
  ]
}

Introduction and Country Profiles

At the next level lower in the JSON specification, you will find the intro and country-profile properties. These specifications control the "Introduction" and "Coastal Profile" pages of Ocean Watch. The intro page of Ocean Watch loads global data. The country-profile page loads country or territory specific data. Specific data is loaded through "parametrization." See the parametrization page for more details.

Content

Within the intro and coastal-profile properties there are are content properties. content usually consists of lists of separate pieces of content organized in the order it will appear on the page. For content that contains standard Resource Watch resources, resources are referenced using a unique alpha-numeric API identifier.

            [
              {
                "grid": "100%",
                "widget": "dc1135ea-3539-432a-acd5-d5ac0e6d127d",
                "type": "map",
                "comment": "River Water Quality - Sediment Pressure Chart"
              }
            ]

Custom Ocean Watch resources, such as indicators, text, and mini-explore maps are configured directly in the JSON.

Updating the Ocean Watch JSON

The JSON file is managed by the Vizzuality development team via Github. The Ocean Watch data team can edit the JSON by creating a fork. image

It can be easier to copy the file and edit in a text editor, instead of directly in the Github browser. After making the necessary edits to the file, you can propose your changes and submit a pull request. It is recommended to make any initial updates in the staging property first. Then review these changes in the staging site. If the updates pass in staging, make the corresponding changes in the production property and submit a second pull request.