gbif / hp-beaty-biodiversity-museum

This repository is for the GBIF Hosted Portal for the Beaty Biodiversity Museum
https://collections.beatymuseum.ubc.ca
Apache License 2.0
1 stars 3 forks source link

question: what is the formatting syntax for dynamic properties to be displayed nicely by the occurrence popover? #104

Closed mpitblado closed 1 month ago

mpitblado commented 2 months ago

I have recently begun to add dynamic properties to some of our datasets. The objective is to get dynamic properties to display the way that the Natural History Museum's dynamic properties display on GRSciColl:

An example of an occurrence that currently has dynamic properties in our portal can be found here

At first I thought that perhaps it was the fact that the value is structured as a list that was causing the difference, however I believe that gbifIssue is a list format in the NHM dataset based on how it is displayed in the gbif.org interface. Aside from this, it seems to me that both our format and their format are dicts with a string key and a value that can be a variety of datatypes.

Is there a particular formatting that is required to get the dynamic properties to be processed nicely by the component?

MortenHofft commented 1 month ago

Generally it just shows dynamicProperties as a string. But if the string is valid json it will try to present it with a bit more formatting. You example is {'Course Number(s)': ['BIOL427_Lab4', 'UNBC308', 'VIU325']} which isn't valid json.

JSON use " not ' and hence JSON.parse(input) will fail

mpitblado commented 1 month ago

Makes complete sense. Thanks for the lesson learned about the difference between double and single quotes in JSON!