Flatten Tool for OCDS

The Open Contracting Data Standard (OCDS) has an unofficial CSV serialization that can be converted to/from the canonical JSON form using Flatten Tool.

Templates

Spreadsheet templates for OCDS can be downloaded from https://github.com/open-contracting/sample-data/tree/master/flat-template

These are generated with the commands listed in Creating spreadsheet templates below.

Web interface

Flatten Tool is integrated into the Open Contracting Data Standard Validator, an online tool for validating and converting OCDS files.

This supports XLSX, but currently only supports uploading CSV (and only one CSV file).

Command Line Usage

Converting a JSON file to a spreadsheet

flatten-tool flatten input.json --root-id=ocid --main-sheet-name releases --root-list-path=releases

This command will create an output called flattened in all the formats we support - currently this is flattened.xlsx and a flattened/ directory of CSV files.

See flatten-tool flatten --help for details of the command line options.

Converting a populated spreadsheet to JSON

cp base.json.example base.json

And populate this with the package information for your release.

Then, for a populated XLSX template (in release_populated.xlsx):

flatten-tool unflatten release_populated.xlsx --root-id=ocid --base-json base.json --input-format xlsx --output-name release.json --root-list-path=releases

Or for populated CSV files (in the release_populated directory):

flatten-tool unflatten release_populated --root-id=ocid --base-json base.json --input-format csv --output-name release.json --root-list-path=releases

These produce a release.json file based on the data in the spreadsheets.

See flatten-tool unflatten --help for details of the command line options.

Creating spreadsheet templates

Download https://raw.githubusercontent.com/open-contracting/standard/1.0/standard/schema/release-schema.json to the current directory.

flatten-tool create-template --root-id=ocid --schema release-schema.json --main-sheet-name releases

This will create template.xlsx and a template/ directory of CSV files.

See flatten-tool create-template --help for details of the command line options.