2015-05-19 09:49:07 +02:00
# Stadtratmonitor
## Setup
1. Install Ruby, Bundler, Elasticsearch
2015-05-19 09:59:43 +02:00
1. Start Elasticsearch: `elasticsearch`
1. Setup Rails app: `bundle && bundle exec rake db:setup`
1. Start Rails server: `bundle exec rails s`
2015-05-19 09:50:57 +02:00
1. Visit [http://localhost:3000 ](http://localhost:3000 )
2015-05-19 09:49:07 +02:00
2016-01-23 20:33:08 +01:00
### Using docker
1. Install docker and docker-compose: https://docs.docker.com/compose/install/
1. Start the app: `docker-compose up`
1. TODO db:migrate, import data, setup index
1. Get the address of the docker host: `docker-machine ip default`
2016-01-25 19:52:52 +01:00
1. Point your browser to: 'http://\<IP of docker host\>:3000'
2015-05-19 09:59:43 +02:00
## Adding a data source (web scraper)
Example scraper: https://morph.io/ahx/city_council_leipzig_recent_papers
Scrapers are stored inside the database (see "Importer" model). To Add a new scraper, you have to create a new Importer record and set it's url field to Morph.io's [API URL field ](https://morph.io/documentation/api?scraper=ahx%2Fcity_council_leipzig_recent_papers ).
Adding a scraper manually:
1. Start Rails console `bundle exec rails console`
2015-05-19 10:00:21 +02:00
2. `Import.create(url: "https://api.morph.io/[scraper]/data.json?key=[api_key]&query=[sql]")`
2015-05-19 09:59:43 +02:00
3. `exit`
2015-07-27 22:57:32 +02:00
Now import everything via `bundle exec rake import_papers` .