robbi5 / kleineanfragen

Collecting kleine Anfragen from Parlamentsdokumentationssystemen for easy search- and linkability
https://kleineanfragen.de
MIT License
43 stars 9 forks source link

kleineAnfragen.

Collecting kleine Anfragen from Parlamentsdokumentationssystemen for easy search- and linkability.

Update 2020-12-31: This project is dead now, the repository is only meant as an archive. Please refrain from forking and redeploying, the Parliaments need to do the next step now. More Information in German.

Development

For a simple and quick development environment, docker-compose is used. Install docker and docker-compose, then run:

docker-compose up

docker-compose downloads the required services (postgres, elasticsearch, redis, ...) as docker containers and links them with the app. If you want to look into postgres or elasticsearch, uncomment the ports section in docker-compose.yml.

You may be required to execute database migrations. Try this:

docker-compose run web rails db:migrate
docker-compose run web rails db:seed

To get a rails console, run:

docker-compose run web rails c

Importing papers from the public database dump

If you want to develop with already scraped data, you can use the public available data dumps from the kleineAnfragen.de data page. Download the latest kleineanfragen-....sql.bz2 from there and put it into tmp/dump/.

To begin importing the data, you have to first enter a docker container:

docker run -v $(pwd)/tmp/dump:/tmp/dump --rm --network kleineanfragen_default -it kleineanfragen_database bash

Inside this one-off throwaway container, import the data with following commands

bzcat /tmp/dump/kleineanfragen-*.sql.bz2 | psql -h database -U kleineanfragen import
pg_dump -h database -U kleineanfragen -d import --data-only | psql -h database -U kleineanfragen -d kleineanfragen
psql -h database -U kleineanfragen import -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public; GRANT ALL ON SCHEMA public TO postgres; GRANT ALL ON SCHEMA public TO public;"
exit

Normalizing Names with Nomenklatura

For normalizing names of people, parties and ministries, we use Nomenklatura.

If you want to use nomenklatura while developing, you need to edit docker-compose.yml:

After your next docker-compose up login to your nomenklatura instance (reachable at http://localhost:8080) and get the API key from the profile link. Insert it into docker-compose.yml.

kleineAnfragen needs multiple Datasets with the following identifiers that must be created in Nomenklatura:

Troubleshooting

You just git pulled and now kleineanfragen doesn't start anymore? Try docker-compose rm web and docker-compose build web — this rebuilds the container that the application is running in.

Dependencies

Configuration

Jobs

Jobs are run by ActiveJob / Sidekiq.

You may need to prefix them with bundle exec, so the correct gems are used.

The typical arguments are [State, LegislativeTerm, Reference]