/rtr-grants

querying grant moneys

Primary LanguageRubyBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

rtr subventionen

what is this?

the austrian Rundfunk und Telekom Regulierungs-GmbH provides a lot of open data. nice!

but who wants to deal with json or csv? i wrote a little importer in ruby that takes json data as provided by the rtr and builds the corresponding sql statements to put this into a database. that way, we can run some GROUP BY queries and add up some numbers!

the thing that sparked my interest initially, which is also downloaded as demo in this repository, is the Förderung Digitale Transformation.

how to use

please wear a helmet, no SQL sanitization is applied, only run this against trusted data!

run it yourself

in general, this should work for any json returned by RTR, but it's more a proof of concept than anything else.

  1. clone the repository
  2. install the right ruby version. please look up how to do this yourself :)
  3. bundle install
  4. put your json into the data/ folder
  5. adapt main.rb to your new file and table name.
  6. run bundle exec rake run – this should now create two files in the out folder: one to create the table, and one to insert all the data.
  7. if you have no entry in your json without NULL values, add a dummy entry so the script can derive the correct data types.
  8. please note, again that – no SQL sanitization is applied, only run this against trusted data!

i just want to query the data!

this is all made for sqlite3. do the following

  1. clone the repository
  2. hopefully, your OS includes sqlite3
  3. create a new database and pass in the create-table script: sqlite3 test.db < 2023-12-29-create-table.sql
  4. feed in the data: sqlite3 test.db < 2023-12-29-insert-into.sql
  5. open a shell in sqlite3 test.db
  6. run queries like: SELECT foerderungsnehmer, sum(foerderbetrag) AS foerderung FROM rtr_data GROUP BY foerderungsnehmer HAVING foerderung > 1000000 ORDER BY foerderung DESC;
  7. just have a look at the json or the create table to see what data is available

legal and stuff

everything in here is BSD licensed. the actual data received from RTR is »Freie Werke gemäß § 7 Urheberrechtsgesetz«, according to the metadata at: Förderung Digitale Transformation.