PRP relies on real geo data for many data models and business logic in place. UNICEF has been utilizing CartoDB service as a single source of truth when it come to Location and geographic polygon data. Similarly done in PMP, PRP also has an identical copy of CartoDB sync Celery task with Django admin interface on Location table.
Requirements
CartoDB sync process is a Celery task, therefore it requires a Celery worker running in the background.
Local environment setup steps
Docker-compose environment spins up Celery workers for you. Make sure your docker-compose is up: fab up If your docker-compose is running, that means Celery worker should be also active.
Docker cloud environment steps
Make sure Docker cloud has stackfile definitions for celery containers from local docker-compose.yml: beater-prp, celerycam-prp, worker-prp, flower-prp, prp-redis
Open up a browser and go `http://localhost:8082 api/admin/core/cartodbtable/` and log in.
In order to get real data, you'll need to go to etools.carto.com for getting dataset names. Consult UNICEF CartoDB expert to get dataset import metadata.
Click "ADD CARTO DB TABLE" button in Django admin and fill the following information:
Domain: etools
API KEY: *****
Table name: (Use above dataset name)
Display name: Use country name and location type for human readable format
Location type: (Create a new one with right admin level)
Use this convention for name field: <ISO3 code in uppercase>-Admin Level <LEVEL_NUMBER>
Ex) AFG-Admin Level 1
Name Column
Pcode Column
Parent Code Column
Parent: (Choose the parent carto db table object if admin level is not 0)
Country
Repeat Step 4 for each country until every single admin level carto db table is created.
After creating a carto db table, select 1 carto db table at a time (with admin level descending) and do "Import sites" Django admin action.
After that, the new locations should be created if import is successful.