Coding with the Humanitarian Exchange Language

| January 11, 2021

Third party support for R is available via the package rhxl. It has basic support for reading HXLated files to make them available for advanced data-processing and analytics inside R.


| January 11, 2021

libhxl-js is a library for HXL written in Javascript. It supports high-level filtering and aggregation operations on HXL datasets. Its programming idiom is similar to libhxl-python, but it is smaller and contains fewer filters and no data-validation support.


| January 11, 2021

The most well developed HXL library, libhxl-python, is written in Python. The most recent versions support Python 3 only, but there are earlier versions with Python 2.7 support. Features of the library include filtering, validation and the ingestion and generation of various formats. libhxl-python uses an idiom that is familiar from JQuery and other Javascript libraries; for example, to load a dataset, you would use simply

import hxl 
source = hxl.data('http://example.org/dataset.xlsx')

As in JQuery, you process the dataset by adding additional steps to the chain. The following example selects every row with the organisation "UNICEF" and removes the column with email addresses:

source.with_rows('#org=UNICEF').without_columns('#contact+email')

The library also includes a set of command-line tools for processing HXL data in shell scripts. For example, the following will perform the same operation shown above, without the need to write Python code:

$ cat dataset.xlsx | hxlselect -q "#org=UNICEF" | hxlcut -x '#contact+email'

There is library API-level documentation available online.


| January 11, 2021

This section contains information for developers who want to write code to process datasets that use the Humanitarian Exchange Language (HXL). HXL is a different kind of data standard, adding hashtags to existing datasets to improve information sharing during a humanitarian crisis without adding extra reporting burdens. HXL has its own website and of particular interest will be the documentation section.