Skip to content
This repository has been archived by the owner on Jan 30, 2019. It is now read-only.

nerevu/hdxscraper-acled

Repository files navigation

ACLED Realtime Data Collector

HDX collector for ACLED Realtime Data.

Introduction

hdxscraper-acled operates in the following way:

  • Downloads the most recent acled-all-africa xls file by navigating the uploads directory
  • Filters for data in a given year or, if none is given, the current year
  • Groups the rows by year-month
  • Dynamically creates a separate database table for each group

With hdxscraper-acled, you can

  • Save ACLED Realtime Data to an external database
  • Create CKAN datasets/packages for each database table
  • Upload ScraperWiki generated CSV files into a CKAN instance
  • Update resources previously uploaded to CKAN with new metadata

View the live data

Requirements

hdxscraper-acled has been tested on the following configuration:

  • MacOS X 10.9.5
  • Python 2.7.10

hdxscraper-acled requires the following in order to run properly:

Setup

local

(You are using a virtualenv, right?)

git clone https://github.com/reubano/hdxscraper-acled.git
pip install -r requirements.txt
manage setup

ScraperWiki Box

rm -rf tool
git clone https://github.com/reubano/hdxscraper-fao.git tool
cd tool
make setup

Usage

local

manage run

ScraperWiki Box

cd tool
source venv/bin/activate
screen manage -m Scraper run
# Now press `Ctrl-a d`

The results will be stored in a SQLite database scraperwiki.sqlite.

view all available commands

manage

Upload tables to HDX/CKAN

upload to production site

manage upload

upload to staging site

manage upload -s

Update tables on HDX/CKAN with new metadata

update dataset on production site

manage update

update dataset on staging site

manage update -s

Update ScraperWiki box with new code

cd tool
make update
source venv/bin/activate
screen manage -m Scraper run
# Now press `Ctrl-a d`

Configuration

hdxscraper-acled will use the following Environment Variables if set:

Environment Variable Description
CKAN_API_KEY Your CKAN API Key
CKAN_PROD_URL Your CKAN instance remote production url
CKAN_REMOTE_URL Your CKAN instance remote staging url
CKAN_USER_AGENT Your user agent

Creating a new collector

If you would like to create collector or scraper from scratch, check out cookiecutter-collector.

pip install cookiecutter
cookiecutter https://github.com/reubano/cookiecutter-collector.git

Contributing

Code

  1. fork
  2. commit
  3. submit PR
  4. ???
  5. PROFIT!!!

Document

  • improve this readme
  • add comments to confusing parts of the code
  • write a "Getting Started" guide
  • write additional deployment instructions (Heroku, AWS, Digital Ocean, GAE)

QA

  1. follow this guide and see if everything works as expected
  2. if something doesn't work, please submit an issue

License

hdxscraper-acled is distributed under the MIT License.