Skip to content
Tools for generating CSV and other flat versions of the structured data
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Add preserve-fields functionality, fixes #302 Jun 11, 2019
examples Add preserve-fields functionality, fixes #302 Jun 11, 2019
flattentool Add preserve-fields functionality, fixes #302 Jun 11, 2019
.gitignore Add preserve-fields functionality, fixes #302 Jun 11, 2019
.landscape.yaml Add prospector and landscape configs Nov 4, 2014
.prospector.yaml Add prospector and landscape configs Nov 4, 2014
.travis.yml Also test against Python 3.7 Mar 21, 2019
CHANGELOG.md Add preserve-fields functionality, fixes #302 Jun 11, 2019
LICENSE Update copyright statement Dec 18, 2015
README.md Move documentation out of the README and into sphinx docs Jul 22, 2016
ROADMAP.rst
base.json.example Add example base.json Nov 10, 2014
flatten-tool
requirements.txt [#4] Structure the code as a python package Nov 3, 2014
requirements_dev.txt setup.py & requirements_dev.txt Oct 18, 2018
setup.cfg Create a basic flattener of the schema to CSV and Excel templates Oct 29, 2014
setup.py Prepare 0.7.0 release Apr 8, 2019

README.md

Flatten-Tool [Beta]

Build Status Coverage Status Code Health License: MIT Documentation Status

Flatten-Tool is a general purpose tool with the goal of allowing a dataset to be round-tripped between structured JSON and tabular data packages or spreadsheets: providing a bridge between richly structured datasets and accessible flat formats.

It was developed for use with the Open Contracting Data Standard, and has been further developed with the 360 Giving Data Standard. We're keen to see if it is useful in other contexts too.

It is also used in to power the COnvert Validate Explore (COVE) tool which provides a web interface for Flatten-Tool configured against a particular JSON Schema.

For more information see the Flatten-Tool docs.

Features

  • Convert data from a "flat" spreadsheet into structured form;
  • Take JSON data and provide a flattened output;
  • Generate a template Excel or CSV file based on a JSON Schema;
  • Use a JSON schema to guide the approach to flattening;
  • Use a JSON schema to provide column titles rather than field names;

For more information see the Flatten-Tool docs.

Quick Example

For more examples see http://flatten-tool.readthedocs.io/en/latest/examples/

{
    "main": [
        {
            "id": "1",
            "a": [
                {
                    "b": "2",
                    "c": "3"
                },
                {
                    "b": "4",
                    "c": "5"
                }
            ],
            "d": "6"
        },
        {
            "id": "7",
            "a": [
                {
                    "b": "8",
                    "c": "9"
                },
                {
                    "b": "10",
                    "c": "11"
                }
            ],
            "d": "12"
        }
    ]
}

Can be converted to/from these spreadsheets:

id d
1 6
7 12
id a/0/b a/0/c
1 2 3
1 4 5
7 8 9
7 10 11

For more examples see http://flatten-tool.readthedocs.io/en/latest/examples/

You can’t perform that action at this time.