Giter Site home page Giter Site logo

codeforafrica / hurumap-apps Goto Github PK

View Code? Open in Web Editor NEW
13.0 20.0 16.0 186.71 MB

HURUmap is an interactive web platform that helps journalists and civic watchdogs easily explore and download census or other demographic data. The toolkit includes shareable and customisable infographics. Accessible at https://hurumap.org

Home Page: https://hurumap.org

Python 48.55% HTML 40.19% CSS 2.21% JavaScript 7.93% Dockerfile 0.05% Shell 0.07% Makefile 0.06% SCSS 0.93%
kenya wazimap hurumap census census-reporter census-data censusreporter tanzania zambia uganda

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.

Development

We use Docker Compose to simplify development.

To get started, set the HURUmap App you want to work on and spin up the container like so:

export HURUMAP_APP=hurumap_ke
make web

You can create a db and load initial data by running the the following commands;

make createdb
make loaddata

# (Optional) If sqlalchemy.exc.NoSuchTableError error thrown:
export HURUMAP_APP=hurumap_land
# 1. Local Docker DB
docker-compose up -d db
cat $HURUMAP_APP/sql/*.sql | docker-compose exec -T db psql $HURUMAP_APP
# 2. Remote DB option
cat $HURUMAP_APP/sql/*.sql | docker-compose exec -T -e PGPASSWORD=<pass> db psql -h <db.host.com> -U <user> $HURUMAP_APP

elimu_yangu .sql files

olevel_student_performance.sql has been split into 2 files by year because as a single file, it surpasses the maximum file size allowed by Github

Import Data into HURUmap

TODO: Needs to use docker-compose, test, and QA

  1. Ensure ${HURUMAP_APP}/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 importsimplecsv 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!

Downloading / Archive Data:

We make the data available in our repository for added availability in two primary ways:

  1. Django fixtures (primarily wazimap_geography)
  2. FieldTables as SQL files.

To do this, run the following command:

export HURUMAP_APP=<hurumap_app>
make dumpdata

Deployment

We use dokku to deploy on our own servers. It's awesome like sliced bread or chapati. Check out their docs on getting started: https://dokku.viewdocs.com/dokku

Once set up, you'll have to do a couple of things:

# Create app
dokku apps:create hurumap-ke

# Set environment variables
dokku config:set hurumap-ke \
  HURUMAP_APP=hurumap_ke \
  DJANGO_SETTINGS_MODULE=hurumap_ke.settings \
  DATABASE_URL=postgresql://hurumap_ke:hurumap_ke@localhost/hurumap_ke

After ensuring your ssh key is added, from your local machine you should now run:

git remote add dokku [email protected]:hurumap-ke
git push dokku

NOTE: You'll have to set up the database before deployment. Either self-hosted or managed.

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.

Contributing

If you'd like to contribute to HURUmap, check out the CONTRIBUTING.md file on how to get started.


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: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

Adding Google Analytics

HURUmap supports the use of both single and multiple tracking ids on a single page.

For the case of a single tracking id (or when one tracking id needs to be identified as the "default" tracking id), the variable ga_tracking_id should be set to the string value of the tracking id.

For example:

[hurumap_ke/settings.py]

...
HURUMAP['ga_tracking_id'] = 'UA-44795600-8'
...

And in those cases were multiple tracking ids need to be set, ga_tracking_ids (with an s) should be set as a list of tracking ids.

For example:

[hurumap_ke/settings.py]

...
HURUMAP['ga_tracking_ids'] = ['UA-44795600-1', 'UA-44795600-2', 'UA-44795600-3']
...

NOTE: By default, HURUMAP['ga_tracking_id'] = 'UA-44795600-8'. If you're not using ga_tracking_id at all (such as in those situation where you're only using multiple tracking ids or you're not using Google Analytics altogether), remember to set this variable to blank i.e. HURUMAP['ga_tracking_id'] = ''

Tests

?


License

MIT

hurumap-apps's People

Contributors

cliftonmcintosh avatar davidlemayian avatar dependabot-preview[bot] avatar dependabot[bot] avatar josephluvanda avatar karimkawambwa avatar khadijamahanga avatar kilemensi avatar longhotsummer avatar malgamves avatar mevey avatar nerdlet avatar phillipahereza avatar robinkiplangat avatar serahkiburu avatar snyk-bot avatar tebajanga avatar thepsalmist avatar tinamurimi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hurumap-apps's Issues

[WAJIBISHA] Sunset Wajibisha in HURUmap-apps

Is your feature request related to a problem? Please describe.
Wajibisha has stalled over a long time due to other pressing requirements and is not making enough movement quickly enough as part of the HURUmap ecosystem.

Describe the solution you'd like
Removen Wajibisha code + apps.

Describe alternatives you've considered
We're using simple Medium publication page and pointing people directly to a public Trello Team page.

Additional context
N/A

Communication channel

Description

How do you guys communicate? Is there a channel we can discuss a few things besides Github? Would love to.

[WAJIBISHA] Add Contact Information to the Footer

Description

Add contact information and links to Wajibisha/PesaCheck social media

Tasks

  • Add Contact details to the footer
  • Add social media links to the footer
  • Remove placeholder text from about us page
  • Add the contact details to about us page
  • Add the team images
  • Remove search bar
  • There’s a typo in the title text --> Some of the promises We’re Tracking.
  • Also, the styling (blue and bold) is different from the one on the county page (and other pages) that reads All the promises (black and lower case) - should be the same
  • Remove watch and congratulate button
  • Style dropdowns on all promises page
  • Increase margin betweem home page cards and testimonial

Dependabot couldn't find a package.json for this project

Dependabot couldn't find a package.json for this project.

Dependabot requires a package.json to evaluate your project's current JavaScript dependencies. It had expected to find one at the path: /dominion/dominion_ui/package.json.

If this isn't a JavaScript project, or if it is a library, you may wish to disable updates for it from within Dependabot.

Dependabot couldn't find a package.json for this project

Dependabot couldn't find a package.json for this project.

Dependabot requires a package.json to evaluate your project's current JavaScript dependencies. It had expected to find one at the path: /dominion/dominion_ui/package.json.

If this isn't a JavaScript project, or if it is a library, you may wish to disable updates for it from within Dependabot.

[WAJIBISHA] Design Feedback

Description

Design mockups for the Wajibisha promise tracker have been implemented. Using this issue to share comments / feedback / changes relevant to the platform.

Screenshots

Home Page

  • Thematic Icons

screen shot 2018-06-13 at 8 19 36 am

  • Footer

screen shot 2018-06-13 at 8 23 58 am

Nairobi County Page
screen shot 2018-06-13 at 11 08 42 am

Questions:

Articles Page

  1. What happened to the Articles page its absent?

Home Page
2. The retweet + like buttons don't function is that intentional?
3. I thought the tweets would redirect to a twitter account, right now its static. Whats the plan?
4. Promise tracker menu button doesn't lead to a different page from the home page. Was this the intended user journey?

Nairobi County Page
5. How is 'Days in office' updated?
6. The social media share button under "Category" section leads to PesaCheck account. Thought it would lead user to embed to their own account?
7. When I switch from Category filter to ALL the social media share buttons don't function?
8. I'm confused by the filter labels that change as the filter options change. The overview box shows: Promises fulfilled, Promises not fulfilled, Promises in progress, Promises stalled, which matches with the filter option to group by category but is different for the option to group by ALL. The latter introduces filter by Altered promises and Five year plans but I can't filter to see promises done/fulfilled or stalled. I'm I missing something?

Tasks

Home page:

  • Correct spelling + space errors below thematic icons (circled red)
  • Correct spelling errors on the footer (circled red)
  • Add hyperlinks to tools / projects (underlined purple)
  • Adjust font/ logo sizes (circled green)
  • Add CfK logo

Nairobi County Page:

  • Correct spelling + space errors

About page:

  • Team roles is a bit confusing, let's keep it simple
    Phillip Ahereza, Code for Africa Software Developer
    Eric Mugendi, PesaCheck Editor
    Nduta Waweru, Wajibisha Lead and Journalist
    Yazmin Jumaali, Code for Africa Project Manager
    Brenda Nyokabi, Code for Africa Front-end Developer
    Larry Wachira, UX/UI designer
  • Remove s from TZ email address

[Wajibisha] View all Promises on the `profile_detail` page

Description

Display all promises on a single page and add dropdowns for filtering by category and sector for the individual promises and other dropdowns for viewing all promises grouped by either category or status

Tasks

  • Remove promises from page context and use profile function

[PESAYETU/KE] Replace Code for Africa logo in footer

Description

In the PesaYetu footer we have the Code for Africa and ICFJ logos. The Code for Africa logo should instead be replaced with the Code for Kenya one and a white PesaCheck version also added.

Same thing should be done for HURUmap Kenya; only replacing the Code for Africa logo with Code for Kenya's.

Screenshots

PesaYetu:
screen shot 2018-01-05 at 14 23 14

HURUmap Kenya:
screen shot 2018-01-05 at 14 25 46

Dependabot couldn't find a package.json for this project

Dependabot couldn't find a package.json for this project.

Dependabot requires a package.json to evaluate your project's current JavaScript dependencies. It had expected to find one at the path: /dominion/dominion_ui/package.json.

If this isn't a JavaScript project, or if it is a library, you may wish to disable updates for it from within Dependabot.

Package HURUmap

Description

To improve ease for reuse, we should move hurumap module from this repo and rename this one HURUmap-apps.

**IMPORTANT UPDATE:**

If you're actively developing HURUmap, you'll have to change your origin link immediately i.e

$ git remote set-url origin https://github.com/CodeForAfrica/HURUmap-apps.git

Tasks

  • Rename this repo to HURUmap-apps
  • Create new repo and move hurumap
  • Delete hurumap app and use hurumap package instead
  • Write tests to run on CI
  • Add deployment from CI
  • Announce + document changes

[BUG] GDAL + pip setup broken on Mac

Description

Setting up development environment on Mac is broken. We had to downgrade GDAL version installed using git checkout because it's not a versioned and the latest libsass doesn't support the @include normalize.min line in _censusreporter.scss.

Also the latest WhiteNois v4 is broken.

How to install GDAL:

brew uninstall gdal
brew tap osgeo/osgeo4mac && brew tap --repair
brew install jasper netcdf
brew install gdal --with-complete --with-unsupported
brew link --force gdal2
brew install gdal-python

# Workaround until 2.3.1 released - https://github.com/OSGeo/gdal/issues/674
export PYTHONPATH=/usr/local/Cellar/gdal2-python/2.3.0/lib/python2.7/site-packages 

pip install "GDAL==2.3" "Shapely>=1.5.13"

Screenshots

N/A

Files

To Reproduce

Recreate virtual environment and run pip install requirements. Also any brew upgrade if GDAL installed with Homebrew should bring up the issue version issue.

Tasks

  • Document using GDAL options above
  • Add versioning to https://github.com/OSGeo/homebrew-osgeo4mac
  • Include specific version of libsass in requirements libsass==0.13.3
  • Include specific version of whitenoise in requirements whitenoise==3.3.1
  • 🤔

Dependabot couldn't find a package.json for this project

Dependabot couldn't find a package.json for this project.

Dependabot requires a package.json to evaluate your project's current JavaScript dependencies. It had expected to find one at the path: /dominion/dominion_ui/package.json.

If this isn't a JavaScript project, or if it is a library, you may wish to disable updates for it from within Dependabot.

Compile Error: File to import not found or unreadable: css/vendor/normalize.min. on Ubuntu

Description

I am having a compile error on Ubuntu while running HURUmap-apps python manage.py runserver:

CompileError at /
Error: File to import not found or unreadable: css/vendor/normalize.min.
        on line 1 of env/lib/python2.7/site-packages/wazimap/static/css/_censusreporter.scss
        from line 7 of env/lib/python2.7/site-packages/wazimap/static/css/wazimap.scss
>> @import "css/vendor/normalize.min";

To Reproduce

Clone HURUmap-apps, set up virtual environment, and run pip install requirements. Set up databases and start server

[FEATURE] Add top navigation bar

Description

Similar to Wazimap, let's add top navigation bar to HURUmap to make it easier to find data from a long list of visualisations.

Screenshots

screen shot 2018-01-15 at 16 12 59

Tasks

Include specific tasks in the order they need to be done in. Include links to specific lines of code where the task should happen at.

Add embed map functionality

Description

Just as how a user is able to embed Charts on HURUmap, we want to add a functionality for a user be able to embed HURUmap profile maps and able to use it else where.

Screenshots

N/A

Files

Tasks

Below are tasks that can achieve this:

  • Create a function that will regenerate profile map
  • Create a template for displaying the information
  • Add a link on profile page that will pop up a light box with iframe code of embed the map

Our land data tables

Is your feature request related to a problem? Please describe.
We have data from land audit report that needs to be visualised in our land project.

Describe the solution you'd like
-Format the dataset into hurumap structure
-Add field tables to project models/database
-Visualize data on profile details

Describe alternatives you've considered
N/A

Additional context
N/A

OUR LAND project setup

Is your feature request related to a problem? Please describe.
OUR LAND is a new project that will be build on top of HURUmap.

Describe the solution you'd like
Create a new app/project (OUR LAND) on HURUmap-apps, customise settings, add ZA's geojson/topojson files for country, provinces, districts, municipalities and wards, set up necessary environment for development as described on Read Me and run project successful

Describe alternatives you've considered
N/A

Additional context
N/A

[FEATURE] Add entity (person/organisation) functionality

Description

HURUmap / Wazimap helps to answer where (through geographies) and what (through the data tables) in regards to data collected. To improve how we help users find the stories behind the data, we should look to the five Ws which are some of the questions whose answers are considered basic in information gathering or problem solving;

  • Who was involved?
  • What happened?
  • When did it take place?
  • Where did it take place?
  • Why did that happen?

Entity data, a person or organisation, help to answer the question of who is involved. We should therefore look at how we can provide this data/functionality on HURUmap.

Tasks

To achieve this, we will look to start with politician data as they are the representatives/leaders of administrative boundaries. To achieve this, we will:

  • Create a schema for entity data modelling on FollowTheMoney
  • Scrape initial politician data for Kenya
  • Create a template for displaying this information
  • Document how to add entity data

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.