The Gobierto Developer Hub

Welcome to the Gobierto developer hub. You'll find comprehensive guides and documentation to help you start working with Gobierto as quickly as possible, as well as support if you get stuck. Let's jump right in!


Gobierto budgets data load

Gobierto budgets module visualizes the budget of an organization. Data is stored in ElasticSearch, and it can be a bit tricky to be loaded, that's why we have developed Rails tasks to load the data using CSV templates.

The data required for the module is:

  • budgets data itself, which can be budgeted or executed
  • population and debt data for every year

The order to load the data is important, population data needs to be present once budget data is loaded because the ration amount per inhabitant is calculated on every import.

In the next sections we describe how to load these datasets.

Load debt and population data

CSV template

The template is very simple, each row represents a year of data, on each cell it must be introduced:

  • the year, in integer format, i.e 2010
  • the debt, in float format
  • the population, in integer format

Once the file is ready, it can be imported using the Rails task: bin/rails gobierto_budgets:data:import_extra_data[madrid.gobierto.test,extra_data.csv]

The task takes two arguments:

  1. site domain: the domain of the site where data will be imported
  2. the full path to the CSV template

Load budgets data

CSV template

Valid values for Area are:

  • E (economic classification)
  • F (functional classification)
  • C (custom classification)

Valid values for Tipo are:

  • I (income)
  • E (expense)

Codigo stands for the category code that identifies the budget line.

Budgets data can be of two types: forecast data or execution data. This type, together with the year must be included as task arguments. It's necessary to create a separated file for each year of data and each type of budget. For example, if you want to load 2019 and 2020 data both for forecast and execution you should prepare 4 different CSVs.

Once the file is ready, it can be imported using the Rails task: bin/rails "gobierto_budgets:data:import[madrid.gobierto.testbudgets.csv,forecast,2020]"]

Other calculations

Once all the previous data has been loaded, there are a couple of extra steps required for the site to be complete:

  1. Generate open data to be downloaded: bin/rails gobierto_budgets:data:sites_annual
  2. Generate budgets bubbles visualization: bin/rails gobierto_budgets:data:bubbles_sites
  3. Clear site cache: bin/rails common:clear_cache

Updated 8 months ago

Gobierto budgets data load

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.