Git Product home page Git Product logo

tebajanga / hurumap-apps Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codeforafrica/hurumap-apps

0.0 1.0 0.0 69.41 MB

HURUmap is an interactive web platform that allows citizens and journalists to explore, visualise, and download census data. This gives them the power to give context to stories that was otherwise hard to spot. Accessible at https://hurumap.org

Home Page: https://hurumap.org

Python 55.84% CSS 2.56% HTML 41.60%

hurumap-apps's Introduction

HURUmap

What’s the data behind the story? HURUmap gives infomediaries like journalists and civic activists an easy ‘plug & play’ toolkit for finding and embedding interactive data visualisations into their storytelling.

HURUmap’s underlying data is quality-checked, from reputable official sources including the government Census, PEPFAR and Uwezo.

The project is built on Wazimap, an open source platform by OpenUp and Media Monitoring Africa for making census data more understandable.

Local development

  1. Clone the repo
  2. cd HURUmap
  3. virtualenv --no-site-packages env
  4. source env/bin/activate
  5. pip install -r requirements.txt

You will need a Postgres database:

psql
create user hurumap_ke with password hurumap_ke;
create database hurumap_ke;
grant all privileges on database hurumap_ke to hurumap_ke;

Run migrations to keep Django happy:

python manage.py migrate

Import the data into the new database (will overwrite some tables created by Django, but that's ok).

cat hurumap_ke/sql/*.sql | psql -U hurumap_ke -W hurumap_ke

Start the server:

python manage.py runserver

Deployment

When deploying with dokku set the DJANGO_SETTINGS_MODULE in the following way:

dokku config:set hurumap-ke DJANGO_SETTINGS_MODULE=hurumap_ke.settings

Checks

Dokku allows for checks that make sure you have zero-downtime deployments. We currently only check for DB errors but should allow for better checks in the future.


Importing data into HURUmap

  1. Ensure hurumap_ke/tables.py has a FieldTable that has exactly the columns that you're importing. If there are multiple tables with exactly the same columns, perhaps because their Universes are different, then be sure to take note of the table id.

  2. Do a dry-run of the import, using the table name if necessary.

     python manage.py importcsv yourfile.csv --dry-run [--table TABLENAME]
    
  3. If it all looks good, run it without --dry-run.

  4. Update (or create) the raw SQL data:

     python manage.py dumppsql --table TABLENAME > sql/TABLENAME.sql
    
  5. Commit to git.

  6. All done!

To dump all data tables at once, run

for t in `ls hurumap_ke/sql/[a-z]*.sql`
do
    echo $t
    pg_dump "postgres://hurumap_ke@localhost/hurumap_ke" \
        -O -c --if-exists -t $(basename $t .sql) \
      | egrep -v "(idle_in_transaction_session_timeout|row_security)" \
      > hurumap_ke/sql/$(basename $t .sql).sql
done

Tests

?


License

MIT

hurumap-apps's People

Contributors

davidlemayian avatar longhotsummer avatar mevey avatar phillipahereza avatar serahkiburu avatar tinamurimi avatar malgamves avatar josephluvanda avatar cliftonmcintosh avatar

Watchers

Timothy Anthony avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.