Skip to content

Commit

Permalink
README file
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando Blat committed Jan 21, 2016
1 parent 1e03b8c commit 85aaf52
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 26 deletions.
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 Gobierto

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Gobierto budgets data

This repository contains the data and the scripts needed to load the municipalities data from Spain
into a Postgres database. The data is from years 2010 to 2015 and includes forecast and execution.

**Important**: the data contained in this repository has been updated on 30/12/2015.

## How to load the data

### Setup

1 - Install Ruby 2.3.0

2 - Create a file `config/database.yml`. You can base it on `config/database.yml.example`

3 - Run `bundle install`

4 - Create two databases, one for forecast data, and other for execution data. In postgres you can
do it using `createdb`. Example:
- `createdb budgets-forecast`
- `createdb budgets-execution`

5 - Run the script:
- To load the forecast data: `$ bin/rails runner import.rb budgets-forecast planned`
- To load the forecast data: `$ bin/rails runner import.rb budgets-execution executed`

## Understanding the data

_Ministerio de Hacienda y Administraciones Públicas_ publishes in their website [the data](https://serviciosweb.meh.es/apps/EntidadesLocales/) of municipalities budgets, both the planned budget and the executed one. They have a couple of methodology notes in case you are interested in: [Nota Metodológica](https://www.minhap.gob.es/Documentacion/Publico/DGCFEL/InstruccionesAplicaciones/NOTA%20METODOL%C3%93GICA.Presupuestos%20y%20Liquidaciones.pdf) and [Metodología Base de datos Access](https://serviciosweb.meh.es/apps/EntidadesLocales/publicaciones/eell/Metodolog%C3%ADa%20base%20de%20Datos%20Access.doc). The data published is in Microsoft Access format.

We, at Gobierto, have followed these steps to convert it to SQL, which is a better format to
distribute the data.

1 - Fetch all the data from 2010 to 2015. There are separated files for each year and for forecast
and execution.

2 - Using an external application, we have converted the data to Postgres format.

3 - We have put each SQL file, compressed in GZip format, into a folder in
`data/presupuestos_municipales` with the name of the yar. There are two sub-folders named
`executed/` and `planned/`.

There are five main tables. We are not going to describe them completely, but if you want a deeper
description we recommend you to read the documentation mentioned above.

- `tb_inventario`: an inventory table with the list of local entities. An entity can be the
municipality itself and other local institutions depending on it. When we import the data, we
aggregate all those sub-budgets into the municipality.

- `tb_funcional`: budgeting data organized using the functional classifcation. In the functional
classification there are only expenses and not income.

- `tb_cuentasProgramas`: list of functional categories the budgets are organized.

- `tb_economica`: budgeting data organized using the functional classifcation. This classification
includes both expenses and income.

- `tb_cuentasEconomica`: list of economic categories the budgets are organized.

Both planned and executed data contain the same structure.

## Suggestions

Please, contact us at `[email protected]`.

## Contributing

Follow the regular steps: create and issue, or suggest a change with a PR.

## Credits

Gobierto, 2016
26 changes: 0 additions & 26 deletions data/presupuestos_municipales/README.md

This file was deleted.

0 comments on commit 85aaf52

Please sign in to comment.