Skip to content

Commit

Permalink
update discovery metadata docs (#80)
Browse files Browse the repository at this point in the history
* update discovery metadata docs

* fix intro section

* do disocvery metadata before data-mappings

* revert

* update data mappings

* Update configuring-wis2-discovery-metadata.md

---------

Co-authored-by: Tom Kralidis <[email protected]>
  • Loading branch information
maaikelimper and tomkralidis authored Jun 15, 2023
1 parent a33c771 commit e4e2592
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 57 deletions.
46 changes: 4 additions & 42 deletions documentation/docs/practical-sessions/configuring-data-mappings.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,58 +13,20 @@ will work on adding to the data mappings in support of publishing your data via

## Preparation

!!! note
Ensure you are logged into the **wis2box-management** container on your student VM:

```bash
cd ~/exercise-materials/wis2box-setup
python3 wis2box-ctl.py login
```

## Configure a data mapping

!!! note
Ensure you are logged into the **wis2box-management** container before continuing.

Inspect the wis2box environment to locate the data mappings in use by the system, as defined by the `WIS2BOX_DATA_MAPPINGS` environment variable:

```bash
wis2box environment show | grep WIS2BOX_DATA_MAPPINGS
```

!!! question
Where are the live data mappings located?

!!! question
How can using the `WIS2BOX_DATA_MAPPINGS` environment variable be valuable, as compared to `/data/wis2box/data-mappings.yml`?
Login to your student VM

### Add CSV data

Let's add a data mapping for wis2box to process CSV data. Inspect the contents of the sample SYNOP CSV data mapping:
Here's how to add data mapping for wis2box to process CSV data. Inspect the contents of the sample SYNOP CSV data mapping:

```bash
cat ~/exercise-materials/wis2box-setup/synop-csv-mappings.yml
cat ~/wis2box-1.0b4/synop-csv-mappings.yml
```

!!! question
What topic is defined in this mapping? What values of the topic are placeholders to be updated later in this session?

Copy and paste the above file contents into the `$WIS2BOX_DATA_MAPPINGS` file (either manually or via the command below)::

```bash
tail -n +2 exercise-materials/wis2box-setup/test-data/data-mappings.yml >> $WIS2BOX_DATA_MAPPINGS
```

!!! tip
Be sure that the first `data:` line from the above file is omitted when copying/pasting into the `$WIS2BOX_DATA_MAPPINGS` file.

Open the data mappings file:

```bash
vi $WIS2BOX_DATA_MAPPINGS
```

Verify that the file you copied from `~/exercise-materials/wis2box-setup/synop-csv-mappings.yml` is now part of the live data mappings file.
Copy and paste the above file contents into your file `~/wis2box-data/data-mappings.yml`

Update the `[country]` and `[centre_id]` values in your new/added data mapping. Use your username as the `centre_id` topic.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,23 @@ discovery metadata from wis2box from a configuration file.

## Preparation

!!! note
Ensure you are running MQTT Explorer and you are connected to the broker on your student VM before continuing.

!!! note
Ensure you are logged into the **wis2box-management** container on your student VM:
Ensure you are running MQTT Explorer and you are connected to the broker on your student VM before continuing.

```bash
cd ~/exercise-materials/wis2box-setup
python3 wis2box-ctl.py login
```
Login to your student VM using your SSH-client.

## Creating discovery metadata

Copy the test discovery metadata into your own file (you may name the file whatever you wish):

```bash
cp ~/exercise-materials/wis2box-setup/test-data/mwi-surface-weather-observations.yml ~/my-discovery-metadata.yml
cd ~/wis2box-1.0b4/
cp examples/config/surface-weather-observations.yml ~/wis2box-data/my-discovery-metadata.yml
```

Inspect the sample discovery metadata:

```bash
more ~/my-discovery-metadata.yml
more ~/wis2box-data/my-discovery-metadata.yml
```

!!! note
Expand Down Expand Up @@ -71,10 +65,16 @@ Update the following values in the discovery metadata configuration:

## Publishing discovery metadata

First login to the **wis2box-management** container:

```bash
python3 wis2box-ctl.py login
```

Run the following command to publish your discovery metadata:

```bash
wis2box metadata discovery publish ~/my-discovery-metadata.yml
wis2box metadata discovery publish /data/wis2box/my-discovery-metadata.yml
```

Ensure that your discovery metadata was published to the API, by navigating to `http://<your-host>/oapi/collections/discovery-metadata`.
Expand All @@ -89,8 +89,8 @@ Click on your discovery metadata record and inspect the content, noting how it r
Update the title of your discovery metadata, and re-publish:

```bash
vi ~/my-discovery-metadata.yml
wis2box metadata discovery publish ~/my-discovery-metadata.yml
vi /data/wis2box/my-discovery-metadata.yml
wis2box metadata discovery publish /data/wis2box/my-discovery-metadata.yml
```

Ensure that your discovery metadata updates were published to the API, by refreshing the page to your discovery metadata.
Expand All @@ -105,7 +105,7 @@ Feel free to update additional values and re-publishing your discovery metadata
Run the below command to add the data to the API:

```bash
wis2box data add-collection ~/my-discovery-metadata.yml
wis2box data add-collection /data/wis2box/my-discovery-metadata.yml
```

Ensure that your dataset was published to the API, by navigating to `http://<your-host>/oapi/collections/<metadata.identifier>`.
Expand Down

0 comments on commit e4e2592

Please sign in to comment.