Skip to content

JSON taggers

David Megginson edited this page Jul 7, 2020 · 5 revisions

(For coders)

A JSON tagger is a JSON specification for adding HXL hashtags to an untagged dataset, an optional part of a JSON processing spec (the value of the top-level tagger property).

Properties

The JSON tagger is an object (dictionary) with the following properties:

Property Required Description Example
specs yes A JSON object (dictionary) with header text as keys and HXL tagspecs as values ("#" is optional in the tagspecs). The keys match substrings unless the match_all property is specified, and always ignore character case, whitespace, and punctuation. {"Cluster": "#sector", "Province", "#adm1+name"}
default_tag no A HXL tagspec to apply to any columns that don't match one of the specs. affected+label
match_all no If the value is truthy, the keys in the specs property must match the entire header text rather than just a substring. 1

Example

The value of the tagger property in the processing spec is the tagging info:

{
    "input": "http://example.org/untagged-dataset.csv",
    "tagger": {
        "default_tag": "affected+label",
        "match_all": 1,
        "specs": {
            "country": "#country+name",
            "country code": "#country+code"
        }
    },
    "recipe": [
        {
            "filter": "count",
            "patterns": "sector"
        }
    ]
}
Clone this wiki locally