Package hxl

Package hxl

source code

Support library for the Humanitarian Exchange Language (HXL), version 1.0.

This library provides support for parsing, validating, cleaning, and transforming humanitarian datasets that follow the HXL standard. Its use will be familiar to developers who have worked with libraries like JQuery. Here's an example:

 import hxl
 data = hxl.data('data.xlsx', True).with_rows('org=UNICEF').without_columns('contact').count('country')

This two-line script performs the following actions:

  1. Load and parse the spreadsheet data.xlsx (the library can also load from any URL, and understands how to read Google spreadsheets or CKAN resources).
  2. Filter out all rows where the value "UNICEF" doesn't appear under the #org (organisation) hashtag.
  3. Strip out personally-identifiable information by removing all columns with the #contact hashtag (e.g. #contact+name, #contact+phone, #contact+email).
  4. Produce a report showing the number of times each unique #country appears in the resulting sheet (e.g. to count the number of activities being conducted by UNICEF in each country).

To get started, read the documentation for the hxl.data function and the hxl.model.Dataset class. The various filters are also available as command-line scripts, so you could perform the same actions as above in a shell script like this:

 $ cat data.xlsx | hxlselect -q 'org=UNICEF' | hxlcut -x contact | hxlcount -t country

Author: David Megginson

Organization: UNOCHA

License: Public Domain

Date: Started August 2014

See Also:
http://hxlstandard.org for the HXL data standard, https://proxy.hxlstandard.org for web-based deployment of this library

Version: 4.8.2

Submodules
  • hxl.converters: Data-conversion classes
  • hxl.datatypes: Utility functions for testing and normalising scalar-ish data types
  • hxl.filters: Data filter classes for the Humanitarian Exchange Language (HXL) v1.0
  • hxl.geo: Geodata operations David Megginson Started February 2018
  • hxl.iati
  • hxl.io: Input/output library for the Humanitarian Exchange Language (HXL) v1.0 David Megginson Started October 2014
  • hxl.model: Data model for the Humanitarian Exchange Language (HXL) v1.0 David Megginson Started October 2014
  • hxl.scripts: Console scripts David Megginson April 2015
  • hxl.validation: Validation code for the Humanitarian Exchange Language (HXL) v1.0 David Megginson Started October 2014

Classes
  HXLException
Base class for all HXL-related exceptions.
Variables
  __version__ = "4.8.2"
Module version number see https://www.python.org/dev/peps/pep-0396/