CORaleigh / Visual-Town-Budget

Open-source budget visualization framework.
http://openmaps.raleighnc.gov/budgetvisualization/
4 stars 3 forks source link

Stories in Ready Budget Visualization Framework ========

Adapted for Raleigh, NC.

screenshot Open-source budget visualization framework.

Requirements

Setup

Clone this repository to your local machine and point your webserver root to src/httpdocs, the application should work out of the box, this repository contains some sample data that can be used for testing.

Components

Cards

Report statical information about selected entry (src/httpdocs/js/cards.js).

card-img

Chart

Shows data change over time (src/httpdocs/js/chart.js).

chart-img

Treemap

Used as the main navigation component (src/httpdocs/js/treemap.js).

treemap-img

Table

Alternative navigation technique to a treemap (src/httpdocs/js/tables.js).

table-img

Component Interface

Each component implements a common interface of 3 calls:

Directory Structure

Required Libraries

Sample Datasets

Sample Expenses.json, Revenues.json and Funds.json from Arlington, MA in src/httpdocs/data.

Budget data is kept in JSON and CSV format. The JSON format is actively used for computation while the CSV format is kept for reference and data download.

Data structure

The base data unit is an object with the following fields:

A simple value object is defined by:

This data structure could be changed should it be considered not ideal for future uses.

Data structure sample

The data sample below is partial section of src/httpdocs/data/expenses.json.

{
    "key": "Expenses",
    "src": "",
    "hash": "13495828",
    "sub": [
        {
            "key": "Watershed Protection Fee Fund",
            "src": "",
            "hash": "bdec0635",
            "sub": [
                {
                    "key": "Non-Departmental",
                    "src": "",
                    "hash": "71dee769",
                    "sub": [
                        {
                            "key": "Interfund Transfers In/Out",
                            "src": "",
                            "hash": "9d0c00df",
                            "sub": [
                                {
                                    "key": "To 320 Water Bond",
                                    "src": "",
                                    "hash": "e39fcf89",
                                    "sub": [],
                                    "descr": "",
                                    "url": "",
                                    "values": [
                                        {
                                            "val": 0,
                                            "year": 2012
                                        },
                                        {
                                            "val": 0,
                                            "year": 2013
                                        },
                                        {
                                            "val": 0,
                                            "year": 2014
                                        },
                                        {
                                            "val": 0,
                                            "year": 2015
                                        },
                                        {
                                            "val": 1500000,
                                            "year": 2016
                                        }
                                    ]
                                }
                            ],
                            "descr": "",
                            "url": "",
                            "values": [
                                {
                                    "val": 0,
                                    "year": 2012
                                },
                                {
                                    "val": 0,
                                    "year": 2013
                                },
                                {
                                    "val": 0,
                                    "year": 2014
                                },
                                {
                                    "val": 0,
                                    "year": 2015
                                },
                                {
                                    "val": 1500000,
                                    "year": 2016
                                }
                            ]
                        }
                    ],
                    "descr": "",
                    "url": "",
                    "values": [
                        {
                            "val": 0,
                            "year": 2012
                        },
                        {
                            "val": 0,
                            "year": 2013
                        },
                        {
                            "val": 0,
                            "year": 2014
                        },
                        {
                            "val": 0,
                            "year": 2015
                        },
                        {
                            "val": 1500000,
                            "year": 2016
                        }
                    ]
                }
            ],
            "descr": "",
            "url": "",
            "values": [
                {
                    "val": 0,
                    "year": 2012
                },
                {
                    "val": 0,
                    "year": 2013
                },
                {
                    "val": 0,
                    "year": 2014
                },
                {
                    "val": 0,
                    "year": 2015
                },
                {
                    "val": 1500000,
                    "year": 2016
                }
            ]
        },
        {
            "key": "Water Infrastructure",
            "src": "",
            "hash": "da7c1e01",
            "sub": [
                {
                    "key": "Non-Departmental",
                    "src": "",
                    "hash": "71dee769",
                    "sub": [
                        {
                            "key": "Interfund Transfers In/Out",
                            "src": "",
                            "hash": "9d0c00df",
                            "sub": [
                                {
                                    "key": "To 320 Water Bond",
                                    "src": "",
                                    "hash": "e39fcf89",
                                    "sub": [],
                                    "descr": "",
                                    "url": "",
                                    "values": [
                                        {
                                            "val": 0,
                                            "year": 2012
                                        },
                                        {
                                            "val": 0,
                                            "year": 2013
                                        },
                                        {
                                            "val": 0,
                                            "year": 2014
                                        },
                                        {
                                            "val": 2888422,
                                            "year": 2015
                                        },
                                        {
                                            "val": 3720000,
                                            "year": 2016
                                        }
                                    ]
                                }
                            ],
                            "descr": "",
                            "url": "",
                            "values": [
                                {
                                    "val": 0,
                                    "year": 2012
                                },
                                {
                                    "val": 0,
                                    "year": 2013
                                },
                                {
                                    "val": 0,
                                    "year": 2014
                                },
                                {
                                    "val": 2888422,
                                    "year": 2015
                                },
                                {
                                    "val": 3720000,
                                    "year": 2016
                                }
                            ]
                        }
                    ],
                    "descr": "",
                    "url": "",
                    "values": [
                        {
                            "val": 0,
                            "year": 2012
                        },
                        {
                            "val": 0,
                            "year": 2013
                        },
                        {
                            "val": 0,
                            "year": 2014
                        },
                        {
                            "val": 2888422,
                            "year": 2015
                        },
                        {
                            "val": 3720000,
                            "year": 2016
                        }
                    ]
                }
            ],
            "descr": "",
            "url": "",
            "values": [
                {
                    "val": 0,
                    "year": 2012
                },
                {
                    "val": 0,
                    "year": 2013
                },
                {
                    "val": 0,
                    "year": 2014
                },
                {
                    "val": 2888422,
                    "year": 2015
                },
                {
                    "val": 3720000,
                    "year": 2016
                }
            ]
        }

Data pipeline

Town representatives are likely to be proficient in editing spreadsheets. The Visual Budget application currently uses a pipeline that converts CSV files (created with Microsoft Excel) to nested JSON files used for computation.

A python script src/httpdocs/data/processing/processCSV.py converts a flat CSV file into the nested JSON structure listed above. A php script src/httpdocs/data/processing/update.php orchestrates the entire data update procedure.

For more information about CSV data formats or update procedures check docs/data.

Future upgrades

Core Contributors

Involution Studios (Design and Coding)

Town of Arlington (Data Collection and Testing)

License

Visual Town Budget is licensed under the Apache-2.0 open source license. You can find more information on the Apache-2.0 license at http://www.apache.org/licenses/LICENSE-2.0