This project is a lightweight parliamentary monitoring site for Nigeria. It uses EveryPolitician data, user-editable data (through prose.io), and CSV data. It doesn't use a database.
The approach of this project is similar to
viewer-sinatra
:
- This is a Sinatra application that uses content produced by
prose.io that is saved in
shineyoureye-prose
. - The
bin/deploy
script pulls this content, runs the app and scrapes it. - The scraped pages are then pushed to the
gh-pages
branch of another repo,shineyoureye-static
, which is configured to serve it's content via GitHub Pages.
Non-technical users can use prose.io to add content to the prose repo. Then, whenever there is a change in that repo, the script runs, producing an updated version of the site in the static repo.
Running a static site vs a dynamic one has several advantages. Also, we benefit from GitHub's free hosting.
This project uses data from several different sources:
- The basic details of current Senators and members of the House
of Representatives was generated from EveryPolitician. This
EveryPolitician data is accessed using the
everypolitician gem.
The
bin/everypolitician-to-csv
script is used to convert the EveryPolitician data to CSV format. The data on Nigeria is sourced from:- The National Assembly website http://www.nass.gov.ng/
- The old Pombola-based ShineYourEye website's Popolo JSON dumps, via https://morph.io/everypolitician-scrapers/nigeria-shineyoureye
- Wikidata
- Boundaries and geographical area information are from a MapIt instance:
http://nigeria.mapit.mysociety.org/
- Mappings between Federal Constituencies and Sentorial
Districts and their parent states are stored in the
responsitory. (n.b. these could be set in MapIt instead;
in fact, the senatorial districts already have
parent_area
set to the appropriate state):mapit/sen_to_sta_area_ids_mapping.csv
mapit/fed_to_sta_area_ids_mapping.csv
mapit/lga_to_sta_area_ids_mapping.csv
- Mappings between EveryPolitician area IDs and MapIt area
IDs are stored in the repository:
mapit/mapit_to_ep_area_ids_mapping_FED.csv
mapit/mapit_to_ep_area_ids_mapping_SEN.csv
mapit/mapit_to_ep_area_ids_mapping_LGA.csv
- Mappings between the slugs used for places in the old
Pombola-based ShineYourEye website and MapIt IDs are
stored in the repository:
mapit/pombola_place_slugs_to_mapit.csv
- Mappings between Federal Constituencies and Sentorial
Districts and their parent states are stored in the
responsitory. (n.b. these could be set in MapIt instead;
in fact, the senatorial districts already have
- Details of local governors are from a scraper hosted on Morph
https://morph.io/everypolitician-scrapers/nigeria-state-governors
- That gets data from:
- http://www.nigeriaembassyusa.org/
- The old Pombola-based ShineYourEye website's Popolo JSON dumps
- That gets data from:
- The images of politicians referenced by the site are served
from GitHub pages:
- https://github.com/theyworkforyou/shineyoureye-images
- That repository caches, at various sizes, the images from
EveryPolitician. The cache is generated by the
multiple-thumbnail-sizes
branch ofimage_cache
:https://github.com/everypolitician/image_cache/tree/multiple-thumbnail-sizes
If you want to contribute to this project, please read our contributing guidelines.
This is a Ruby project.
You will need to tell your favourite Ruby version manager to set your local Ruby
version to the one specified in the Gemfile
file.
For example, if you are using rbenv:
- Install the right Ruby version. That would be the version specified at the
beginning of the Gemfile. For example, if it was
ruby '2.5.3'
, you would type:
rbenv install 2.5.3
rbenv rehash
- Then you would move to the root directory of this project and type:
rbenv local 2.5.3
ruby -v
You will also need to install the bundler
gem, which will allow you to install
the rest of the dependencies listed in the Gemfile
file of this project.
gem install bundler
rbenv rehash
bin
: scripts, like deploy scripts, etc.lib
: the codebaselib/document
: code to parse prose.io files (markdown with frontmatter)lib/ep
: code to parse EveryPolitician datalib/helpers
: mostly site-specific stufflib/mapit
: code to parse Mapit datalib/membership_csv
: code to parse membership data coming from a CSV file, for example a scraper running in Morphlib/page
: presenters to extract all logic out of the viewsmapit
: CSV files that map MapIt Area IDs to other IDsmorph
: CSV files produced by a scraper on morph.ioprose
: where theshineyoureye-prose
repository will be cloned. Contains user introduced content, like blog posts, events, etc.public
: static assetspublic/stylesheets/sass
: sass files automatically compiled into csstests
: all the testsviews
: the erb templates to build the site
bundle install
bin/prepare-data
This will copy the user-editable contents of the site (the blog posts
and static pages generated using prose.io) into a
prose
directory.
bundle exec rackup
And go to http://localhost:9292/
For the tests, some of the user-editable contents of the site are used
as fixtures. So we have to use this data in a particular point of its
history. We can do that by positioning the repo at a particular commit,
using the same script we used before. For example, to use the contents
as they looked like at commit ffc1fe0
:
bin/prepare-data ffc1fe0
The right commit to use will be whichever the .travis.yml
file is
using.
After doing this, we can run the tests.
bundle exec rake
bundle exec rake rubocop
bundle exec rake test
bundle exec rake test TEST='path/to/test/file'