Skip to content
Snippets Groups Projects
README.md 1.42 KiB
Newer Older
# datacrate

Node.js utilities for building and working with DataCrates.

(The DataCrate Standard is here: https://github.com/UTS-eResearch/datacrate)

This started as a library for crosswalking ReDBox 2 data publications
into CATALOG.json files as part of the publication workflow. It should
turn into a general-purpose toolkit which makes it easy to build
things like Provisioner bots and publication pipelines.

It doesn't generate the HTML for a DataCrate - that functionality is in
the Calcyte package, though in time this module might include that as 
a dependency.

## Usage

Note that this uses the jsonld_helper library from Calcyte to trim the context,
which is another historical artefact that should go away.

    const datacrate = require('datacrate').catalog;
    const jsonld_h = require('calcyte').jsonld;
    const datapub = get_metadata_from_rb2_somehow();
    const catalog = datacrate.datapub2catalog(datapub);
    jsonld_h.init(catalog);
    jsonld_h.trim_context();
    fs.writeFileSync('CATALOG.json', JSON.stringify(jsonld_h.json_ld, null, 2));


## To-do

Refactor this module so that it's a library of components which can 
be used to build crosswalks like datapub2catalog, and then factor the
rb2-specific stuff out into its own modules.

Get this to call the json_ld helper module to do things like context
trimming rather than having to do this explicitly.

Do a more robust job with the geolocations field using GeoJSON-LD.