Skip to content
This repository was archived by the owner on Feb 25, 2020. It is now read-only.

Generic CSV Format

Thomas Preusse edited this page Jul 28, 2013 · 8 revisions

General

  • Encoding: utf-8
  • Column separator: ,
  • Header row: required

Required columns

  • level ids: /level_(?<index>[0-9]+)_id/
  • level names: /level_(?<index>[0-9]+)_name/
  • values: /value_(?<collection>.+)_(?<type>.+)_(?<year>[0-9]{4})/

Other requirements

  • values are expected to integer (1) or float (1.00)
  • aggregate get created automatically
  • no intermediate rows

Example

level_0_id,level_0_name,level_1_id,level_1_name,value_expense_budget_2014,value_revenue_budget_2014
1,OpenData.ch,001,"hackdays, snacks and beer",10000,0
1,OpenData.ch,002,sponsors,0,10000
1,OpenData.ch,002,lobbying,1000,0

Real example: City of Bern 2014

Load Generic CSV

budget = OpenBudget::Budget.new
budget.load_csv 'path/to/file.csv'
budget.save_pretty_json 'path/to/file.json' # save as JSON
Clone this wiki locally