{"id":26348380,"url":"https://github.com/codeforafrica/hurumap-apps","last_synced_at":"2025-07-17T17:40:49.963Z","repository":{"id":46640610,"uuid":"51447449","full_name":"CodeForAfrica/HURUmap-apps","owner":"CodeForAfrica","description":"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","archived":false,"fork":false,"pushed_at":"2023-09-04T14:43:14.000Z","size":191186,"stargazers_count":13,"open_issues_count":1,"forks_count":16,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-03-04T08:02:14.635Z","etag":null,"topics":["census","census-data","census-reporter","censusreporter","hurumap","kenya","tanzania","uganda","wazimap","zambia"],"latest_commit_sha":null,"homepage":"https://hurumap.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodeForAfrica.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-02-10T14:52:40.000Z","updated_at":"2023-09-04T14:43:29.000Z","dependencies_parsed_at":"2024-01-19T18:03:34.896Z","dependency_job_id":null,"html_url":"https://github.com/CodeForAfrica/HURUmap-apps","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeForAfrica%2FHURUmap-apps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeForAfrica%2FHURUmap-apps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeForAfrica%2FHURUmap-apps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeForAfrica%2FHURUmap-apps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeForAfrica","download_url":"https://codeload.github.com/CodeForAfrica/HURUmap-apps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243841191,"owners_count":20356446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["census","census-data","census-reporter","censusreporter","hurumap","kenya","tanzania","uganda","wazimap","zambia"],"created_at":"2025-03-16T08:14:44.008Z","updated_at":"2025-03-16T08:14:44.671Z","avatar_url":"https://github.com/CodeForAfrica.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"HURUmap\n=======\n\nWhat’s the data behind the story? [HURUmap](https://hurumap.org) gives infomediaries like journalists and civic activists an easy ‘plug \u0026 play’ toolkit for finding and embedding interactive data visualisations into their storytelling.\n\nHURUmap’s underlying data is quality-checked, from reputable official sources including the government Census, PEPFAR and Uwezo.\n\nThe project is built on [Wazimap](http://wazimap.readthedocs.org/en/latest/), an open source platform by OpenUp and Media Monitoring Africa for making census data more understandable.\n\n\n## Development\n\nWe use [Docker Compose](https://docs.docker.com/compose/) to simplify development.\n\nTo get started, set the HURUmap App you want to work on and spin up the container like so:\n\n```shell\nexport HURUMAP_APP=hurumap_ke\nmake web\n```\n\nYou can create a db and load initial data by running the the following commands;\n```shell\nmake createdb\nmake loaddata\n\n# (Optional) If sqlalchemy.exc.NoSuchTableError error thrown:\nexport HURUMAP_APP=hurumap_land\n# 1. Local Docker DB\ndocker-compose up -d db\ncat $HURUMAP_APP/sql/*.sql | docker-compose exec -T db psql $HURUMAP_APP\n# 2. Remote DB option\ncat $HURUMAP_APP/sql/*.sql | docker-compose exec -T -e PGPASSWORD=\u003cpass\u003e db psql -h \u003cdb.host.com\u003e -U \u003cuser\u003e $HURUMAP_APP\n```\n\n#### `elimu_yangu` `.sql` files\n\n`olevel_student_performance.sql` has been split into 2 files by year because as a single \nfile, it surpasses the maximum file size allowed by Github\n\n### Import Data into HURUmap\n\nTODO: Needs to use docker-compose, test, and QA\n\n1. 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**.\n2. Do a dry-run of the import, using the table name if necessary.\n\n        python manage.py importsimplecsv yourfile.csv --dry-run [--table TABLENAME]\n\n3. If it all looks good, run it without ``--dry-run``.\n4. Update (or create) the raw SQL data:\n\n        python manage.py dumppsql --table TABLENAME \u003e sql/TABLENAME.sql\n\n5. Commit to git.\n6. All done!\n\n\n### Downloading / Archive Data:\n\nWe make the data available in our repository for added availability in two primary ways:\n\n1. Django fixtures (primarily `wazimap_geography`)\n2. FieldTables as SQL files.\n\nTo do this, run the following command:\n```shell\nexport HURUMAP_APP=\u003churumap_app\u003e\nmake dumpdata\n```\n\n\n---\n\n## Deployment\n\nWe use [dokku](https://dokku.viewdocs.com/dokku) to deploy on our own servers. It's awesome like sliced bread or [*chapati*](https://google.com/search?q=chapati). Check out their docs on getting started: https://dokku.viewdocs.com/dokku\n\nOnce set up, you'll have to do a couple of things:\n```\n# Create app\ndokku apps:create hurumap-ke\n\n# Set environment variables\ndokku config:set hurumap-ke \\\n  HURUMAP_APP=hurumap_ke \\\n  DJANGO_SETTINGS_MODULE=hurumap_ke.settings \\\n  DATABASE_URL=postgresql://hurumap_ke:hurumap_ke@localhost/hurumap_ke\n```\n\nAfter ensuring your [ssh key is added](https://dokku.viewdocs.com/dokku/user-management), from your local machine you should now run:\n```\ngit remote add dokku dokku@hurumap.org:hurumap-ke\ngit push dokku\n```\n\n***NOTE:** You'll have to set up the database before deployment. Either [self-hosted](https://github.com/dokku/dokku-postgres-plugin) or [managed](https://aws.amazon.com/rds).*\n\n\n### Checks\n\nDokku allows for checks that make sure you have [zero-downtime deployments](http://dokku.viewdocs.io/dokku/deployment/zero-downtime-deploys/). We currently only check for DB errors but should allow for better checks in the future.\n\n\n## Contributing\n\nIf you'd like to contribute to HURUmap, check out the [CONTRIBUTING.md](CONTRIBUTING.md) file on how to get started.\n\n\n---\n\n## Importing data into HURUmap\n\n1. 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**.\n2. Do a dry-run of the import, using the table name if necessary.\n\n        python manage.py importcsv yourfile.csv --dry-run [--table TABLENAME]\n\n3. If it all looks good, run it without ``--dry-run``.\n4. Update (or create) the raw SQL data:\n\n        python manage.py dumppsql --table TABLENAME \u003e sql/TABLENAME.sql\n\n5. Commit to git.\n6. All done!\n\nTo dump all data tables at once, run\n```shell\nfor t in `ls hurumap_ke/sql/[a-z]*.sql`\ndo\n    echo $t\n    pg_dump \"postgres://hurumap_ke:hurumap_ke@localhost/hurumap_ke\" \\\n        -O -c --if-exists -t $(basename $t .sql) \\\n      | egrep -v \"(idle_in_transaction_session_timeout|row_security)\" \\\n      \u003e hurumap_ke/sql/$(basename $t .sql).sql\ndone\n```\n\n## Adding Google Analytics\n\nHURUmap supports the use of both single and multiple tracking ids on a single page.\n\nFor 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*](https://developers.google.com/edu/python/strings) value of the tracking id.\n\nFor example:\n\n```\n[hurumap_ke/settings.py]\n\n...\nHURUMAP['ga_tracking_id'] = 'UA-44795600-8'\n...\n```\n\nAnd in those cases were multiple tracking ids need to be set, `ga_tracking_ids` (with an s) should be set as a [*list*](https://developers.google.com/edu/python/lists) of tracking ids.\n\nFor example:\n\n```\n[hurumap_ke/settings.py]\n\n...\nHURUMAP['ga_tracking_ids'] = ['UA-44795600-1', 'UA-44795600-2', 'UA-44795600-3']\n...\n```\n\n**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'] = ''`\n\n### Tests\n\n?\n\n---\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeforafrica%2Fhurumap-apps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeforafrica%2Fhurumap-apps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeforafrica%2Fhurumap-apps/lists"}