MCPcopy Index your code
hub / github.com/OpenDataServices/flatten-tool

github.com/OpenDataServices/flatten-tool @v0.28.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.28.0 ↗ · + Follow
393 symbols 1,491 edges 33 files 54 documented · 14%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Flatten-Tool

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/

Core symbols most depended-on inside this repo

_
called by 54
flattentool/i18n.py
convert_type
called by 54
flattentool/input.py
parse
called by 44
flattentool/schema.py
unflatten
called by 34
flattentool/__init__.py
append
called by 26
flattentool/sheet.py
get_sheet_lines
called by 17
flattentool/input.py
get_sheet_lines
called by 16
flattentool/input.py
open
called by 12
flattentool/output.py

Shape

Function 173
Method 144
Class 45
Route 31

Languages

Python100%

Modules by API surface

flattentool/input.py54 symbols
flattentool/tests/test_json_input.py36 symbols
flattentool/tests/test_input_SpreadsheetInput.py36 symbols
flattentool/tests/test_init.py36 symbols
flattentool/tests/test_schema_parser.py33 symbols
flattentool/output.py18 symbols
flattentool/schema.py15 symbols
flattentool/tests/test_end_to_end.py13 symbols
flattentool/json_input.py13 symbols
flattentool/sheet.py12 symbols
flattentool/tests/test_unflatten.py11 symbols
flattentool/tests/test_input_SpreadsheetInput_unflatten.py11 symbols

For agents

$ claude mcp add flatten-tool \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact