├── tests ├── __init__.py ├── cms │ ├── __init__.py │ └── factories.py ├── boundaries │ ├── __init__.py │ └── factories.py ├── datasets │ ├── __init__.py │ ├── admin │ │ └── __init__.py │ ├── serializers │ │ ├── __init__.py │ │ └── test_serializers.py │ ├── admin_history │ │ └── __init__.py │ ├── tasks │ │ └── indicator_data_extraction │ │ │ └── __init__.py │ ├── models │ │ └── test_groups.py │ └── management │ │ └── test_reprocess_indicators.py ├── general │ ├── __init__.py │ └── views │ │ └── __init__.py ├── profile │ ├── __init__.py │ ├── views │ │ └── __init__.py │ └── admin_history │ │ └── __init__.py └── points │ ├── models │ └── __init__.py │ ├── admin_history │ └── __init__.py │ ├── conftest.py │ └── factoryboy.py ├── wazimap_ng ├── __init__.py ├── cms │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ └── 0002_auto_20210113_1124.py │ ├── tests.py │ ├── views.py │ ├── apps.py │ └── serializers.py ├── boundaries │ ├── __init__.py │ ├── tasks.py │ ├── migrations │ │ ├── __init__.py │ │ ├── 0008_delete_worldborder.py │ │ ├── 0003_remove_district_pr_code_st.py │ │ ├── 0012_auto_20200121_1158.py │ │ ├── 0020_ward_name.py │ │ ├── 0016_country_area.py │ │ ├── 0015_country_geom.py │ │ ├── 0007_auto_20200121_0907.py │ │ ├── 0009_auto_20200121_0954.py │ │ ├── 0023_geographyboundary_geom_cache.py │ │ ├── 0025_auto_20200329_0551.py │ │ ├── 0017_province_geography.py │ │ ├── 0026_auto_20200329_0554.py │ │ ├── 0014_country.py │ │ ├── 0024_auto_20200329_0545.py │ │ ├── 0027_auto_20200624_0311.py │ │ ├── 0001_initial.py │ │ ├── 0005_ward.py │ │ ├── 0010_auto_20200121_1041.py │ │ └── 0011_auto_20200121_1152.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ └── models.py ├── datasets │ ├── __init__.py │ ├── management │ │ ├── __init__.py │ │ └── commands │ │ │ └── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── 0031_merge_20200206_2350.py │ │ ├── 0081_delete_indicatorsubcategory.py │ │ ├── 0064_merge_20200409_0325.py │ │ ├── 0072_delete_profiledata.py │ │ ├── 0002_remove_profile_indicators.py │ │ ├── 0041_remove_universe_dataset.py │ │ ├── 0011_remove_profiledata_key_metric.py │ │ ├── 0071_rename_profilehighlight_sequence.py │ │ ├── 0097_auto_20200531_1821.py │ │ ├── 0127_auto_20220401_0949.py │ │ ├── 0089_auto_20200509_2036.py │ │ ├── 0104_auto_20200621_1015.py │ │ ├── 0120_auto_20210817_1005.py │ │ ├── 0026_auto_20200204_1338.py │ │ ├── 0101_auto_20200531_2327.py │ │ ├── 0110_metadata_url.py │ │ ├── 0049_geography_version.py │ │ ├── 0076_auto_20200411_2035.py │ │ ├── 0063_remove_profileindicator_key_metric.py │ │ ├── 0042_auto_20200220_0614.py │ │ ├── 0096_group_name.py │ │ ├── 0015_profileindicator_label.py │ │ ├── 0004_auto_20191220_1321.py │ │ ├── 0012_profileindicator_key_metric.py │ │ ├── 0050_auto_20200329_0620.py │ │ ├── 0079_delete_indicatorcategory.py │ │ ├── 0009_indicator_label.py │ │ ├── 0003_profile_indicators.py │ │ ├── 0082_delete_indicatorsubcategory.py │ │ ├── 0100_group_subindicators.py │ │ ├── 0040_auto_20200217_0337.py │ │ ├── 0060_profilehighlight_is_key_metric.py │ │ ├── 0069_auto_20200410_2016.py │ │ ├── 0021_auto_20200110_0628.py │ │ ├── 0098_group_dataset.py │ │ ├── 0103_auto_20200610_1137.py │ │ ├── 0122_auto_20211008_0540.py │ │ ├── 0118_remove_geography_version.py │ │ ├── 0113_dataset_content_type.py │ │ ├── 0014_profileindicator_universe.py │ │ ├── 0032_auto_20200208_0544.py │ │ ├── 0102_auto_20200601_0519.py │ │ ├── 0099_auto_20200531_1941.py │ │ ├── 0086_dataset_dataset_type.py │ │ ├── 0124_auto_20211009_1012.py │ │ ├── 0024_profilehighlight_value.py │ │ ├── 0034_dataset_groups.py │ │ ├── 0035_auto_20200209_1315.py │ │ ├── 0025_auto_20200125_1452.py │ │ ├── 0037_auto_20200211_1929.py │ │ ├── 0084_auto_20200411_2129.py │ │ ├── 0058_auto_20200402_0804.py │ │ ├── 0027_auto_20200204_1340.py │ │ ├── 0059_auto_20200402_0808.py │ │ ├── 0020_auto_20200110_0626.py │ │ ├── 0036_auto_20200209_1515.py │ │ ├── 0038_profileindicator_subindicators.py │ │ ├── 0039_indicator_subindicators.py │ │ ├── 0083_auto_20200411_2133.py │ │ ├── 0046_datasetfile_task.py │ │ ├── 0093_auto_20200520_2031.py │ │ ├── 0073_auto_20200411_1832.py │ │ ├── 0077_auto_20200411_2044.py │ │ ├── 0078_auto_20200411_2042.py │ │ ├── 0090_auto_20200507_0306.py │ │ ├── 0052_profile_geography_hierarchy.py │ │ ├── 0080_auto_20200411_2108.py │ │ ├── 0111_auto_20210322_0740.py │ │ ├── 0053_dataset_geography_hierarchy.py │ │ ├── 0062_auto_20200407_0642.py │ │ ├── 0043_auto_20200228_0912.py │ │ ├── 0092_auto_20200520_1048.py │ │ ├── 0054_profileindicator_choropleth_method.py │ │ ├── 0070_auto_20200411_0621.py │ │ ├── 0075_auto_20200411_1843.py │ │ ├── 0062_auto_20200410_1242.py │ │ ├── 0114_create_versions_auto_20210818_0900.py │ │ ├── 0095_group.py │ │ ├── 0074_auto_20200411_1830.py │ │ ├── 0106_auto_20200624_0318.py │ │ ├── 0010_auto_20191222_0916.py │ │ ├── 0051_geographyhierarchy.py │ │ ├── 0016_auto_20200101_2051.py │ │ ├── 0008_auto_20191220_2154.py │ │ ├── 0056_auto_20200331_1256.py │ │ ├── 0018_auto_20200110_0533.py │ │ ├── 0068_auto_20200410_1712.py │ │ ├── 0029_auto_20200206_1122.py │ │ ├── 0114_auto_20210803_0721.py │ │ ├── 0030_auto_20200206_1308.py │ │ ├── 0033_auto_20200210_1843.py │ │ ├── 0045_auto_20200319_1946.py │ │ ├── 0048_auto_20200328_1253.py │ │ ├── 0088_auto_20200501_1258.py │ │ ├── 0109_auto_20200928_2255.py │ │ ├── 0116_auto_20210803_2049.py │ │ ├── 0013_universe.py │ │ ├── 0029_indicatordata.py │ │ ├── 0019_auto_20200110_0535.py │ │ └── 0121_auto_20211007_1056.py │ ├── services │ │ ├── __init__.py │ │ └── permissions.py │ ├── templatetags │ │ ├── __init__.py │ │ └── template_tags.py │ ├── admin │ │ ├── views │ │ │ ├── __init__.py │ │ │ └── metadata_inline_view.py │ │ └── forms │ │ │ ├── __init__.py │ │ │ ├── dataset_file_form.py │ │ │ └── indicator_admin_form.py │ ├── apps.py │ ├── static │ │ ├── images │ │ │ ├── ui-icons_444444_256x240.png │ │ │ ├── ui-icons_555555_256x240.png │ │ │ ├── ui-icons_777620_256x240.png │ │ │ ├── ui-icons_777777_256x240.png │ │ │ ├── ui-icons_cc0000_256x240.png │ │ │ └── ui-icons_ffffff_256x240.png │ │ └── css │ │ │ └── admin-custom.css │ ├── tasks │ │ ├── __init__.py │ │ └── delete_data.py │ ├── models │ │ ├── licence.py │ │ ├── __init__.py │ │ ├── universe.py │ │ ├── metadata.py │ │ ├── group.py │ │ └── indicatordata.py │ └── templates │ │ ├── admin │ │ └── datasets │ │ │ ├── indicator │ │ │ └── change_form.html │ │ │ └── dataset │ │ │ └── change_form.html │ │ └── custom │ │ ├── variable_task_warnings.html │ │ ├── render_profile_data.html │ │ ├── render_task_errors.html │ │ └── variable_task_errors.html ├── extensions │ ├── __init__.py │ └── migrations │ │ ├── __init__.py │ │ ├── 0001_initial.py │ │ └── 0002_auto_20200110_1607.py ├── general │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── 0002_auto_20200624_0311.py │ │ └── 0001_initial.py │ ├── services │ │ ├── __init__.py │ │ └── custom_permissions │ │ │ ├── __init__.py │ │ │ └── custom_permissions.py │ ├── templatetags │ │ ├── __init__.py │ │ └── custom_tags.py │ ├── static │ │ ├── img │ │ │ └── drag.png │ │ ├── css │ │ │ ├── sortable-widget.css │ │ │ ├── profile-indicator.css │ │ │ └── variable-filter-widget.css │ │ └── js │ │ │ └── sortable-widget.js │ ├── admin │ │ └── forms.py │ ├── serializers.py │ ├── templates │ │ ├── widgets │ │ │ ├── SortableWidget.html │ │ │ └── VariableFilterWidget.html │ │ └── emailTemplates │ │ │ ├── upload_task_notification.html │ │ │ └── indicator_extraction_task_notification.html │ └── models.py ├── points │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── 0054_auto_20230908_1810.py │ │ ├── 0053_auto_20230908_1810.py │ │ ├── 0040_merge_20210111_1807.py │ │ ├── 0043_merge_20210514_0918.py │ │ ├── 0018_delete_metadata.py │ │ ├── 0023_auto_20200509_2036.py │ │ ├── 0035_remove_profilecategory_permission_type.py │ │ ├── 0012_auto_20200331_1256.py │ │ ├── 0007_auto_20200316_1305.py │ │ ├── 0005_theme_icon.py │ │ ├── 0016_auto_20200422_0901.py │ │ ├── 0029_profilecategory_icon.py │ │ ├── 0045_auto_20211007_1056.py │ │ ├── 0028_coordinatefile_collection_id.py │ │ ├── 0039_profilecategory_color.py │ │ ├── 0052_location_content_search.py │ │ ├── 0055_auto_20230908_1813.py │ │ ├── 0025_auto_20200512_1322.py │ │ ├── 0037_auto_20200928_2309.py │ │ ├── 0048_auto_20220805_0616.py │ │ ├── 0049_auto_20220808_0720.py │ │ ├── 0024_auto_20200507_0306.py │ │ ├── 0027_auto_20200521_1201.py │ │ ├── 0031_auto_20200717_1053.py │ │ ├── 0003_auto_20200110_2056.py │ │ ├── 0044_auto_20210909_0748.py │ │ ├── 0041_profilecategory_attributes.py │ │ ├── 0020_category_permission_type.py │ │ ├── 0034_auto_20200821_0613.py │ │ ├── 0015_profilecategory_collection_type.py │ │ ├── 0017_category_metadata.py │ │ ├── 0021_theme_profile.py │ │ ├── 0013_auto_20200411_2129.py │ │ ├── 0009_coordinatefile_task.py │ │ ├── 0014_auto_20200412_0533.py │ │ ├── 0010_auto_20200328_1253.py │ │ ├── 0038_auto_20201202_1249.py │ │ ├── 0004_coordinatefile.py │ │ ├── 0032_auto_20200730_1120.py │ │ ├── 0036_auto_20200928_2255.py │ │ └── 0042_auto_20210507_1117.py │ ├── admin │ │ ├── forms │ │ │ └── __init__.py │ │ └── __init__.py │ ├── tests.py │ ├── apps.py │ └── services │ │ └── locations.py ├── profile │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── 0038_remove_profile_requires_authentication.py │ │ ├── 0039_remove_profilehighlight_name.py │ │ ├── 0033_auto_20200422_0901.py │ │ ├── 00065_logo_url.py │ │ ├── 0010_auto_20200407_1155.py │ │ ├── 0004_auto_20200330_2004.py │ │ ├── 0041_profile_description.py │ │ ├── 0034_profile_requires_authentication.py │ │ ├── 0042_indicatorcategory_icon.py │ │ ├── 0019_profilekeymetrics_label.py │ │ ├── 0017_delete_licence.py │ │ ├── 0002_auto_20200319_1956.py │ │ ├── 0035_auto_20200507_0306.py │ │ ├── 0043_profile_configuration.py │ │ ├── 0048_profileindicator_content_type.py │ │ ├── 0047_profileindicator_configuration.py │ │ ├── 0032_auto_20200417_0800.py │ │ ├── 0037_auto_20200521_1501.py │ │ ├── 0028_auto_20200420_1255.py │ │ ├── 0026_auto_20200420_1248.py │ │ ├── 0018_profilekeymetrics_profile.py │ │ ├── 0025_auto_20200420_1248.py │ │ ├── 0029_auto_20200420_1327.py │ │ ├── 0031_profile_profile_type.py │ │ ├── 0044_auto_20200805_0530.py │ │ ├── 00064_licence.py │ │ ├── 0007_auto_20200331_1036.py │ │ ├── 0027_auto_20200420_1255.py │ │ ├── 0003_choroplethmethod.py │ │ ├── 0022_auto_20200420_0949.py │ │ ├── 0023_auto_20200420_1211.py │ │ ├── 0054_auto_20220726_0553.py │ │ ├── 0016_auto_20200412_0544.py │ │ ├── 0021_profilehighlight_denominator.py │ │ ├── 0030_auto_20200420_1328.py │ │ ├── 0001_initial.py │ │ ├── 0046_auto_20200822_0812.py │ │ ├── 0020_auto_20200419_0559.py │ │ ├── 0053_auto_20220719_1512.py │ │ ├── 0009_auto_20200406_1849.py │ │ ├── 0005_auto_20200330_2005.py │ │ └── 0024_auto_20200420_1227.py │ ├── admin │ │ ├── forms │ │ │ └── __init__.py │ │ ├── __init__.py │ │ ├── admins │ │ │ ├── __init__.py │ │ │ └── logo_admin.py │ │ └── utils.py │ ├── serializers │ │ ├── overview_serializer.py │ │ └── profile_logo.py │ └── templates │ │ └── admin │ │ └── profile │ │ ├── profileindicator │ │ └── change_form.html │ │ ├── profile │ │ └── change_form.html │ │ ├── indicatorcategory │ │ └── change_form.html │ │ └── indicatorsubcategory │ │ └── change_form.html ├── wsgi.py └── constants.py ├── runtime.txt ├── test_selenium ├── __init__.py ├── profile │ ├── __init__.py │ └── admin │ │ └── __init__.py └── datasets │ ├── __init__.py │ └── admin │ └── __init__.py ├── DOKKU_SCALE ├── CHECKS ├── scripts ├── shapefiles │ ├── country.cpg │ ├── country.dbf │ ├── country.shp │ ├── country.shx │ ├── country.prj │ └── country.qmd └── django │ ├── django_q.sh │ ├── predeploy.sh │ └── web.sh ├── nginx.conf.d └── upload.conf ├── Procfile ├── tox.ini ├── .dockerignore ├── pytest.ini ├── heroku.yml ├── Dockerfile ├── .codeclimate.yml ├── Makefile ├── .pre-commit-config.yaml ├── manage.py ├── .github └── PULL_REQUEST_TEMPLATE.md └── app.json /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/cms/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.7.6 2 | -------------------------------------------------------------------------------- /test_selenium/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/boundaries/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/general/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/profile/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/cms/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /DOKKU_SCALE: -------------------------------------------------------------------------------- 1 | web=1 2 | worker=1 -------------------------------------------------------------------------------- /test_selenium/profile/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/datasets/admin/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/general/views/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/points/models/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/profile/views/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/tasks.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/extensions/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/general/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/points/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/profile/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CHECKS: -------------------------------------------------------------------------------- 1 | /api/v1/datasets/ Dataset List -------------------------------------------------------------------------------- /scripts/shapefiles/country.cpg: -------------------------------------------------------------------------------- 1 | UTF-8 -------------------------------------------------------------------------------- /test_selenium/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/datasets/serializers/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/points/admin_history/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/cms/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test_selenium/datasets/admin/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test_selenium/profile/admin/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/datasets/admin_history/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/profile/admin_history/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/management/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/services/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/general/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/general/services/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/general/templatetags/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/templatetags/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/extensions/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/management/commands/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nginx.conf.d/upload.conf: -------------------------------------------------------------------------------- 1 | client_max_body_size 1000M; 2 | -------------------------------------------------------------------------------- /tests/datasets/tasks/indicator_data_extraction/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wazimap_ng/general/services/custom_permissions/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/django/django_q.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python3 manage.py qcluster 4 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: /app/scripts/django/web.sh 2 | worker: /app/scripts/django/django_q.sh -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length = 120 3 | 4 | [isort] 5 | multi_line_output=3 6 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/admin/views/__init__.py: -------------------------------------------------------------------------------- 1 | from .metadata_inline_view import MetaDataInline -------------------------------------------------------------------------------- /wazimap_ng/points/admin/forms/__init__.py: -------------------------------------------------------------------------------- 1 | from .category_admin_form import CategoryAdminForm -------------------------------------------------------------------------------- /wazimap_ng/cms/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /wazimap_ng/cms/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /wazimap_ng/points/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /scripts/django/predeploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd /app 4 | 5 | python3 manage.py collectstatic --noinput 6 | -------------------------------------------------------------------------------- /scripts/shapefiles/country.dbf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenUpSA/wazimap-ng/HEAD/scripts/shapefiles/country.dbf -------------------------------------------------------------------------------- /scripts/shapefiles/country.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenUpSA/wazimap-ng/HEAD/scripts/shapefiles/country.shp -------------------------------------------------------------------------------- /scripts/shapefiles/country.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenUpSA/wazimap-ng/HEAD/scripts/shapefiles/country.shx -------------------------------------------------------------------------------- /wazimap_ng/cms/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CmsConfig(AppConfig): 5 | name = 'cms' 6 | -------------------------------------------------------------------------------- /wazimap_ng/general/static/img/drag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenUpSA/wazimap-ng/HEAD/wazimap_ng/general/static/img/drag.png -------------------------------------------------------------------------------- /wazimap_ng/points/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PointsConfig(AppConfig): 5 | name = 'points' 6 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class DatasetsConfig(AppConfig): 5 | name = 'datasets' 6 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BoundariesConfig(AppConfig): 5 | name = 'boundaries' 6 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .cache 3 | .pyenv 4 | .pyenv/* 5 | .pytest_cache/ 6 | .data 7 | .data/* 8 | media 9 | docker-compose.yml 10 | db.credentials 11 | -------------------------------------------------------------------------------- /scripts/shapefiles/country.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] -------------------------------------------------------------------------------- /wazimap_ng/datasets/static/images/ui-icons_444444_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenUpSA/wazimap-ng/HEAD/wazimap_ng/datasets/static/images/ui-icons_444444_256x240.png -------------------------------------------------------------------------------- /wazimap_ng/datasets/static/images/ui-icons_555555_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenUpSA/wazimap-ng/HEAD/wazimap_ng/datasets/static/images/ui-icons_555555_256x240.png -------------------------------------------------------------------------------- /wazimap_ng/datasets/static/images/ui-icons_777620_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenUpSA/wazimap-ng/HEAD/wazimap_ng/datasets/static/images/ui-icons_777620_256x240.png -------------------------------------------------------------------------------- /wazimap_ng/datasets/static/images/ui-icons_777777_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenUpSA/wazimap-ng/HEAD/wazimap_ng/datasets/static/images/ui-icons_777777_256x240.png -------------------------------------------------------------------------------- /wazimap_ng/datasets/static/images/ui-icons_cc0000_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenUpSA/wazimap-ng/HEAD/wazimap_ng/datasets/static/images/ui-icons_cc0000_256x240.png -------------------------------------------------------------------------------- /wazimap_ng/datasets/static/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenUpSA/wazimap-ng/HEAD/wazimap_ng/datasets/static/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /wazimap_ng/datasets/admin/forms/__init__.py: -------------------------------------------------------------------------------- 1 | from .dataset_admin_form import DatasetAdminForm 2 | from .indicator_admin_form import IndicatorAdminForm 3 | from .dataset_file_form import DatasetFileAdminForm -------------------------------------------------------------------------------- /scripts/django/web.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd /app 4 | 5 | /usr/local/bin/gunicorn wazimap_ng.wsgi --workers=2 -b 0.0.0.0:${PORT:-8000} --forwarded-allow-ips="*" --reload --timeout=${GUNICORN_TIMEOUT:-300} 6 | -------------------------------------------------------------------------------- /wazimap_ng/profile/admin/forms/__init__.py: -------------------------------------------------------------------------------- 1 | from .profile_key_metrics import ProfileKeyMetricsForm 2 | from .profile_highlight_form import ProfileHighlightForm 3 | from .profile_indicator_form import ProfileIndicatorAdminForm -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | DJANGO_SETTINGS_MODULE=wazimap_ng.settings 3 | norecursedirs=docs *.egg-info .git appdir .tox .env data media static dist tmp __pycache__ scripts 4 | testpaths=tests 5 | python_files = tests.py test_*.py *_tests.py 6 | -------------------------------------------------------------------------------- /wazimap_ng/profile/serializers/overview_serializer.py: -------------------------------------------------------------------------------- 1 | 2 | #profile description can be assigned here too 3 | def OverviewSerializer(profile): 4 | return { 5 | "name": profile.name, 6 | "description": profile.description, 7 | } -------------------------------------------------------------------------------- /heroku.yml: -------------------------------------------------------------------------------- 1 | build: 2 | docker: 3 | web: Dockerfile 4 | worker: Dockerfile 5 | run: 6 | web: 'python manage.py collectstatic --noinput && gunicorn wazimap_ng.wsgi --workers=2 --forwarded-allow-ips="*" --reload --timeout=300' 7 | worker: scripts/django/django_q.sh 8 | -------------------------------------------------------------------------------- /wazimap_ng/points/admin/__init__.py: -------------------------------------------------------------------------------- 1 | from .theme_admin import ThemeAdmin 2 | from .location_admin import LocationAdmin 3 | from .profilecategory_admin import ProfileCategoryAdmin 4 | from .category_admin import CategoryAdmin 5 | from .coordinate_file_admin import CoordinateFileAdmin -------------------------------------------------------------------------------- /wazimap_ng/general/services/custom_permissions/custom_permissions.py: -------------------------------------------------------------------------------- 1 | from .. import permissions 2 | 3 | def user_has_perm_for_datasets_indicator(user, obj, perm): 4 | permission = permissions.permission_name(obj.dataset._meta, perm) 5 | return user.has_perm(permission, obj.dataset) -------------------------------------------------------------------------------- /wazimap_ng/profile/admin/__init__.py: -------------------------------------------------------------------------------- 1 | from django.contrib.gis import admin 2 | from .. import models 3 | 4 | from .admins import ( 5 | LogoAdmin, ProfileIndicatorAdmin, ProfileKeyMetricsAdmin, ProfileHighlightAdmin, 6 | IndicatorCategoryAdmin, IndicatorSubcategoryAdmin, ProfileAdmin 7 | ) 8 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/tasks/__init__.py: -------------------------------------------------------------------------------- 1 | from .process_uploaded_file import process_uploaded_file 2 | from .process_uploaded_file import process_file_data 3 | from .process_uploaded_file import process_csv 4 | 5 | from .indicator_data_extraction import indicator_data_extraction 6 | from .delete_data import delete_data -------------------------------------------------------------------------------- /wazimap_ng/datasets/admin/views/metadata_inline_view.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from ... import models 4 | 5 | 6 | class MetaDataInline(admin.StackedInline): 7 | model = models.MetaData 8 | fk_name = "dataset" 9 | 10 | verbose_name = "" 11 | verbose_name_plural = "Metadata" -------------------------------------------------------------------------------- /wazimap_ng/datasets/admin/forms/dataset_file_form.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from ... import models 3 | from wazimap_ng.general.admin.forms import HistoryAdminForm 4 | 5 | class DatasetFileAdminForm(HistoryAdminForm): 6 | 7 | class Meta: 8 | model = models.DatasetFile 9 | fields = '__all__' 10 | -------------------------------------------------------------------------------- /wazimap_ng/extensions/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | from django.contrib.postgres.operations import TrigramExtension 2 | 3 | from django.db import migrations 4 | 5 | class Migration(migrations.Migration): 6 | 7 | dependencies = [ 8 | ] 9 | 10 | operations = [ 11 | TrigramExtension(), 12 | ] 13 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/models/licence.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from wazimap_ng.general.models import BaseModel 3 | 4 | class Licence(BaseModel): 5 | name = models.CharField(max_length=30, blank=False) 6 | url = models.URLField(max_length=150, blank=True, null=True) 7 | 8 | def __str__(self): 9 | return f"{self.name}" -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0054_auto_20230908_1810.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.28 on 2023-09-08 18:10 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0053_auto_20230908_1810'), 10 | ] 11 | 12 | operations = [ 13 | ] 14 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0053_auto_20230908_1810.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.28 on 2023-09-08 18:10 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0052_location_content_search'), 10 | ] 11 | 12 | operations = [ 13 | ] 14 | -------------------------------------------------------------------------------- /wazimap_ng/general/static/css/sortable-widget.css: -------------------------------------------------------------------------------- 1 | .sortable { list-style-type: none; margin: 0 !important; padding: 0 !important; width: 60%; } 2 | .sortable li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; height: 18px; } 3 | .sortable li span { position: absolute; margin-left: -1.3em; } 4 | .sortable_widget { display: flex; } -------------------------------------------------------------------------------- /wazimap_ng/general/static/css/profile-indicator.css: -------------------------------------------------------------------------------- 1 | .alert-warning{ 2 | background: #fff3cd url(/static/admin/img/icon-alert.svg) 10px 12px no-repeat; 3 | width: fit-content; 4 | border-radius: 5px; 5 | border: 1px solid #ffecb5; 6 | color: #664d03 !important; 7 | padding-left: ; 8 | padding: 10px 10px 10px 28px; 9 | margin: 0 0 10px 0; 10 | } 11 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/templates/admin/datasets/indicator/change_form.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/change_form.html" %} 2 | {% block content %} 3 | {{ block.super }} 4 | {% if original %} 5 |
6 |

Variable Resources

7 | 8 | View/edit dataset 9 | 10 |
11 | {% endif %} 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0040_merge_20210111_1807.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.13 on 2021-01-11 18:07 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0038_auto_20201117_1559'), 10 | ('points', '0039_profilecategory_color'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0043_merge_20210514_0918.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.13 on 2021-05-14 09:18 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0042_auto_20210507_1117'), 10 | ('points', '0042_auto_20210421_0453'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0031_merge_20200206_2350.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-06 23:50 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0029_auto_20200206_1122'), 10 | ('datasets', '0030_auto_20200206_1308'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0081_delete_indicatorsubcategory.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 21:08 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0014_auto_20200411_2108'), 10 | ('datasets', '0080_auto_20200411_2108'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/templates/custom/variable_task_warnings.html: -------------------------------------------------------------------------------- 1 |
2 |

We were not able to find geographies for some rows. Either they does not exist in our system or they are invalid

3 |

Please check csv below for more info and contact our support staff accordingly

4 |

CSV for missing geo codes : {{ download_url }}

5 |
6 | -------------------------------------------------------------------------------- /wazimap_ng/profile/templates/admin/profile/profileindicator/change_form.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/change_form.html" %} 2 | {% block content %} 3 | {{ block.super }} 4 | {% if original %} 5 |
6 |

Profile Indicator Resources

7 | 8 | View/edit variable 9 | 10 |
11 | {% endif %} 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/services/permissions.py: -------------------------------------------------------------------------------- 1 | from wazimap_ng.utils import get_objects_for_user 2 | 3 | 4 | from ..models import Dataset 5 | 6 | 7 | 8 | def get_datasets_with_permission(user, permission): 9 | datasets = Dataset.objects.all() 10 | 11 | if user.is_superuser: 12 | return datasets 13 | 14 | datasets = get_objects_for_user(user, permission, Dataset) 15 | return datasets 16 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0064_merge_20200409_0325.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-09 03:25 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0060_profilehighlight_is_key_metric'), 10 | ('datasets', '0063_remove_profileindicator_key_metric'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0018_delete_metadata.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-28 15:43 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0017_category_metadata_2'), 10 | ] 11 | 12 | operations = [ 13 | migrations.DeleteModel( 14 | name='MetaData', 15 | ), 16 | ] 17 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0008_delete_worldborder.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-21 09:08 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('boundaries', '0007_auto_20200121_0907'), 10 | ] 11 | 12 | operations = [ 13 | migrations.DeleteModel( 14 | name='WorldBorder', 15 | ), 16 | ] 17 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/models/__init__.py: -------------------------------------------------------------------------------- 1 | from .geography import Geography, GeographyHierarchy, Version 2 | from .dataset import Dataset 3 | from .indicatordata import IndicatorData 4 | from .datasetdata import DatasetData 5 | from .indicator import Indicator 6 | from .universe import Universe 7 | from .metadata import MetaData 8 | from .licence import Licence 9 | from .upload import DatasetFile 10 | from .group import Group 11 | -------------------------------------------------------------------------------- /wazimap_ng/profile/admin/admins/__init__.py: -------------------------------------------------------------------------------- 1 | from .logo_admin import LogoAdmin 2 | from .profile_admin import ProfileAdmin 3 | from .profile_indicator_admin import ProfileIndicatorAdmin 4 | from .profile_key_metrics_admin import ProfileKeyMetricsAdmin 5 | from .profile_highlight_admin import ProfileHighlightAdmin 6 | from .indicator_category_admin import IndicatorCategoryAdmin 7 | from .indicator_subcategory_admin import IndicatorSubcategoryAdmin -------------------------------------------------------------------------------- /wazimap_ng/extensions/migrations/0002_auto_20200110_1607.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-10 16:07 2 | 3 | from django.db import migrations 4 | from django.contrib.postgres.operations import CreateExtension 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('extensions', '0001_initial'), 11 | ] 12 | 13 | operations = [ 14 | CreateExtension('postgis'), 15 | ] 16 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0072_delete_profiledata.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 09:14 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0071_rename_profilehighlight_sequence'), 10 | ] 11 | 12 | operations = [ 13 | migrations.DeleteModel( 14 | name='ProfileData', 15 | ), 16 | ] 17 | -------------------------------------------------------------------------------- /tests/boundaries/factories.py: -------------------------------------------------------------------------------- 1 | import factory 2 | from django.contrib.gis.geos import Polygon, MultiPolygon 3 | 4 | from wazimap_ng.boundaries.models import GeographyBoundary 5 | 6 | 7 | class GeographyBoundaryFactory(factory.django.DjangoModelFactory): 8 | class Meta: 9 | model = GeographyBoundary 10 | 11 | area = 10 12 | geom = MultiPolygon([Polygon( ((0.0, 0.0), (0.0, 50.0), (50.0, 50.0), (50.0, 0.0), (0.0, 0.0)) )]) 13 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/models/universe.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.contrib.postgres.fields import JSONField 3 | from wazimap_ng.general.models import BaseModel, SimpleHistory 4 | 5 | 6 | class Universe(BaseModel, SimpleHistory): 7 | filters = JSONField() 8 | 9 | label = models.CharField(max_length=100) 10 | 11 | def __str__(self): 12 | return f"{self.label}" 13 | 14 | class Meta: 15 | ordering = ["id"] -------------------------------------------------------------------------------- /wazimap_ng/general/admin/forms.py: -------------------------------------------------------------------------------- 1 | import json 2 | from django import forms 3 | 4 | from wazimap_ng.general.services.permissions import get_user_group 5 | 6 | 7 | class HistoryAdminForm(forms.ModelForm): 8 | change_reason_help = ("Explanation for the change") 9 | change_reason = forms.CharField( 10 | max_length=1024, help_text=change_reason_help, required=False, 11 | widget=forms.Textarea(attrs={'rows': 5, 'cols': 100}) 12 | ) -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0002_remove_profile_indicators.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.9 on 2019-12-20 13:19 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='profile', 15 | name='indicators', 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0003_remove_district_pr_code_st.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-20 16:27 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('boundaries', '0002_district'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='district', 15 | name='pr_code_st', 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0041_remove_universe_dataset.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-19 08:28 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0040_auto_20200217_0337'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='universe', 15 | name='dataset', 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for wazimap. 3 | It exposes the WSGI callable as a module-level variable named ``application``. 4 | For more information on this file, see 5 | https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/gunicorn/ 6 | """ 7 | import os 8 | 9 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wazimap_ng.settings") 10 | 11 | from django.core.wsgi import get_wsgi_application # noqa 12 | 13 | application = get_wsgi_application() 14 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0011_remove_profiledata_key_metric.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.9 on 2019-12-22 09:19 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0010_auto_20191222_0916'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='profiledata', 15 | name='key_metric', 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0071_rename_profilehighlight_sequence.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 06:43 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0070_auto_20200411_0621'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RunSQL('alter sequence datasets_profilehighlight_id_seq rename to profile_profilehighlight_id_seq;'), 14 | ] 15 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/templates/custom/render_profile_data.html: -------------------------------------------------------------------------------- 1 |
2 | {% if objects %} 3 | 8 | {% endif %} 9 |

Add new {{ model|title }} for {{ variable|title }}

10 |
11 | -------------------------------------------------------------------------------- /tests/points/conftest.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from tests.points.factories import ThemeFactory, ProfileCategoryFactory 4 | from tests.profile.factories import ProfileFactory 5 | 6 | 7 | @pytest.fixture 8 | def theme(profile): 9 | return ThemeFactory(profile=profile) 10 | 11 | @pytest.fixture 12 | def profile_category(theme): 13 | return ProfileCategoryFactory(theme=theme, label="profile category name", description="my test profile category", profile=theme.profile) 14 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0097_auto_20200531_1821.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-31 18:21 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0096_group_name'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='group', 15 | options={'verbose_name': 'SubindicatorsGroup'}, 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0023_auto_20200509_2036.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-09 20:36 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0022_auto_20200429_0749'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='theme', 15 | options={'ordering': ['profile__name']}, 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/templates/admin/datasets/dataset/change_form.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/change_form.html" %} 2 | {% block content %} 3 | {{ block.super }} 4 |
5 |

Dataset Resources

6 |

Subindicator groups

7 | 8 | {% for group in original.group_set.all %} 9 | 10 | 11 | 12 | {% endfor %} 13 |
{{ group.name }}
14 |
15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0035_remove_profilecategory_permission_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-08-26 15:17 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0034_auto_20200821_0613'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='profilecategory', 15 | name='permission_type', 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0012_auto_20200121_1158.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-21 11:58 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('boundaries', '0011_auto_20200121_1152'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='ward', 15 | old_name='wardno', 16 | new_name='code', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0127_auto_20220401_0949.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.24 on 2022-04-01 09:49 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ("datasets", "0126_auto_20211111_0413"), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterUniqueTogether( 14 | name="indicatordata", 15 | unique_together={("indicator", "geography")}, 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0012_auto_20200331_1256.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-31 12:56 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0011_auto_20200331_1035'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='metadata', 15 | old_name='license', 16 | new_name='licence', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0038_remove_profile_requires_authentication.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-21 14:54 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0037_auto_20200521_1501'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='profile', 15 | name='requires_authentication', 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0039_remove_profilehighlight_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-27 06:18 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0038_remove_profile_requires_authentication'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='profilehighlight', 15 | name='name', 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM osgeo/gdal:ubuntu-small-3.1.3 2 | 3 | RUN apt-get update && apt-get install -y \ 4 | postgresql-client vim less curl apt-transport-https \ 5 | git python3-pip libpq-dev 6 | 7 | 8 | RUN mkdir -p /config 9 | COPY ./requirements.txt /config 10 | WORKDIR /config 11 | RUN pip3 install -r ./requirements.txt 12 | 13 | ENV PYTHONUNBUFFERED 1 14 | 15 | COPY ./nginx.conf.d/ /app/nginx.conf.d 16 | COPY ./ /app 17 | WORKDIR /app 18 | RUN rm -rf .git 19 | CMD ["tail", "-f", "/dev/null"] 20 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0007_auto_20200316_1305.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-16 13:05 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0006_auto_20200310_2150'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='profilecategory', 15 | options={'verbose_name_plural': 'Profile Categories'}, 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0089_auto_20200509_2036.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-09 20:36 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0088_auto_20200501_1258'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='indicator', 15 | options={'ordering': ['id'], 'verbose_name': 'Variable'}, 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/profile/serializers/profile_logo.py: -------------------------------------------------------------------------------- 1 | from .. import models 2 | 3 | def ProfileLogoSerializer(profile): 4 | try: 5 | logo = models.Logo.objects.get(profile=profile) 6 | url = logo.url if logo.url and logo.url.strip() != "" else "/" 7 | return { 8 | "image": f"{logo.logo.url}", 9 | "url": url 10 | } 11 | except models.Logo.DoesNotExist: 12 | return { 13 | "image": "", 14 | "url": "/" 15 | } 16 | -------------------------------------------------------------------------------- /tests/cms/factories.py: -------------------------------------------------------------------------------- 1 | import factory 2 | from factory.django import FileField 3 | 4 | from wazimap_ng.cms import models 5 | 6 | 7 | class PageFactory(factory.django.DjangoModelFactory): 8 | class Meta: 9 | model = models.Page 10 | 11 | profile = factory.SubFactory("tests.profile.factories.ProfileFactory") 12 | 13 | 14 | class ContentFactory(factory.django.DjangoModelFactory): 15 | class Meta: 16 | model = models.Content 17 | 18 | page = factory.SubFactory(PageFactory) 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0104_auto_20200621_1015.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-06-21 10:15 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0103_auto_20200610_1137'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='geographyhierarchy', 15 | options={'verbose_name_plural': 'Geography Hierarchies'}, 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0120_auto_20210817_1005.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.21 on 2021-08-17 10:05 2 | 3 | from django.db import migrations, models 4 | import tinymce.models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0118_remove_geography_version'), 11 | ] 12 | 13 | operations = [ 14 | migrations.RemoveField( 15 | model_name='dataset', 16 | name='geography_hierarchy', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/profile/admin/utils.py: -------------------------------------------------------------------------------- 1 | from django.db.models import Q 2 | from wazimap_ng.datasets.models import Indicator 3 | 4 | 5 | def filter_indicators_by_profile(profile_id, queryset=None): 6 | if not queryset: 7 | queryset = Indicator.objects.all() 8 | if profile_id: 9 | queryset = queryset.filter( 10 | Q(dataset__permission_type="public") 11 | | Q(dataset__permission_type="private", dataset__profile_id=profile_id) 12 | ) 13 | return queryset 14 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0033_auto_20200422_0901.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-22 09:01 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0032_auto_20200417_0800'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='profile', 15 | old_name='profile_type', 16 | new_name='permission_type', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/cms/serializers.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers 2 | 3 | from . import models 4 | 5 | 6 | class ContentSerializer(serializers.ModelSerializer): 7 | class Meta: 8 | model = models.Content 9 | fields = ("title", "text", "image", ) 10 | 11 | class PageSerializer(serializers.ModelSerializer): 12 | content_set = ContentSerializer(read_only=True, many=True) 13 | 14 | class Meta: 15 | model = models.Page 16 | fields = ("content_set", "name", "api_mapping") -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/00065_logo_url.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-31 07:40 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '00064_licence'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='logo', 15 | name='url', 16 | field=models.CharField(blank=True, max_length=255, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/profile/templates/admin/profile/profile/change_form.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/change_form.html" %} 2 | {% block content %} 3 | {{ block.super }} 4 |
5 |

Profile Resources

6 |

Indicator categories

7 | 8 | {% for category in original.indicatorcategory_set.all %} 9 | 10 | 11 | 12 | {% endfor %} 13 |
{{ category.name }}
14 |
15 | {% endblock %} -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0020_ward_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-30 13:10 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('boundaries', '0019_auto_20200125_1650'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='ward', 15 | name='name', 16 | field=models.CharField(blank=True, max_length=8), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0026_auto_20200204_1338.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-04 13:38 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0025_auto_20200125_1452'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddIndex( 14 | model_name='geography', 15 | index=models.Index(fields=['code'], name='datasets_ge_code_0edced_idx'), 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0101_auto_20200531_2327.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-31 23:27 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0100_group_subindicators'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='group', 15 | name='name', 16 | field=models.CharField(max_length=100), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0110_metadata_url.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.13 on 2020-11-17 19:05 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0109_auto_20200928_2255'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='metadata', 15 | name='url', 16 | field=models.URLField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0005_theme_icon.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-29 15:25 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0004_coordinatefile'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='theme', 15 | name='icon', 16 | field=models.CharField(blank=True, max_length=30, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0010_auto_20200407_1155.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-07 11:55 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0009_auto_20200406_1849'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='profilekeymetrics', 15 | options={'ordering': ['id'], 'verbose_name_plural': 'Profile key metrics'}, 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | checks: 3 | argument-count: 4 | enabled: false 5 | complex-logic: 6 | enabled: false 7 | file-lines: 8 | enabled: false 9 | method-complexity: 10 | enabled: false 11 | method-count: 12 | enabled: false 13 | method-lines: 14 | enabled: false 15 | nested-control-flow: 16 | enabled: false 17 | return-statements: 18 | enabled: false 19 | plugins: 20 | pep8: 21 | enabled: false 22 | exclude_patterns: 23 | - "tests/" 24 | - "**/migrations/" 25 | -------------------------------------------------------------------------------- /tests/datasets/serializers/test_serializers.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from wazimap_ng.datasets.serializers import MetaDataSerializer 4 | 5 | @pytest.mark.django_db 6 | class TestMetaDataSerializer: 7 | def test_output(self, metadata): 8 | serializer = MetaDataSerializer(metadata) 9 | assert serializer.data == { 10 | "description": "ABC", "source": "XYZ", "url": "http://example.com", "licence": { 11 | "name": "licence name", "url": "abc url" 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0004_auto_20200330_2004.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-30 20:04 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0003_choroplethmethod'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='choroplethmethod', 15 | name='description', 16 | field=models.TextField(max_length=255), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0049_geography_version.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-29 06:19 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0048_auto_20200328_1253'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='geography', 15 | name='version', 16 | field=models.CharField(blank=True, max_length=20), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0076_auto_20200411_2035.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 20:35 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0075_auto_20200411_1843'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='indicatorsubcategory', 15 | options={'ordering': ['id'], 'verbose_name_plural': 'Indicator Subcategories'}, 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0016_auto_20200422_0901.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-22 09:01 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0015_profilecategory_collection_type'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='profilecategory', 15 | old_name='collection_type', 16 | new_name='permission_type', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0041_profile_description.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-06-19 14:39 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0040_auto_20200603_0628'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='profile', 15 | name='description', 16 | field=models.TextField(blank=True, max_length=255), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0063_remove_profileindicator_key_metric.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-07 11:58 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0062_auto_20200407_0642'), 10 | ('profile', '0009_auto_20200406_1849'), 11 | ] 12 | 13 | operations = [ 14 | migrations.RemoveField( 15 | model_name='profileindicator', 16 | name='key_metric', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0042_auto_20200220_0614.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-02-20 06:14 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0041_remove_universe_dataset'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='indicator', 15 | options={'ordering': ['id'], 'verbose_name': 'Variable', 'verbose_name_plural': 'Variables'}, 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0096_group_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-31 12:50 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0095_group'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='group', 15 | name='name', 16 | field=models.CharField(default='', max_length=50), 17 | preserve_default=False, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/general/serializers.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers 2 | 3 | from wazimap_ng.datasets.models import Licence 4 | 5 | from . import models 6 | 7 | class LicenceSerializer(serializers.ModelSerializer): 8 | class Meta: 9 | model = Licence 10 | fields = ("name", "url",) 11 | 12 | class MetaDataSerializer(serializers.ModelSerializer): 13 | licence = LicenceSerializer(read_only=True) 14 | 15 | class Meta: 16 | model = models.MetaData 17 | fields = ('source', 'description', 'licence',) -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0016_country_area.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-21 14:45 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('boundaries', '0015_country_geom'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='country', 15 | name='area', 16 | field=models.FloatField(default=1220000), 17 | preserve_default=False, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0015_profileindicator_label.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.9 on 2020-01-01 20:33 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0014_profileindicator_universe'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='profileindicator', 15 | name='label', 16 | field=models.CharField(blank=True, max_length=60), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/general/templates/widgets/SortableWidget.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 10 |
11 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0034_profile_requires_authentication.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-09 20:55 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0033_auto_20200422_0901'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='profile', 15 | name='requires_authentication', 16 | field=models.BooleanField(default=False), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0042_indicatorcategory_icon.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-06-24 15:10 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0042_auto_20200624_0311'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='indicatorcategory', 15 | name='icon', 16 | field=models.CharField(blank=True, max_length=30, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0004_auto_20191220_1321.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.9 on 2019-12-20 13:21 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0003_profile_indicators'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='profile', 15 | name='indicators', 16 | ), 17 | migrations.DeleteModel( 18 | name='ProfileIndicator', 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0012_profileindicator_key_metric.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.9 on 2019-12-22 09:19 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0011_remove_profiledata_key_metric'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='profileindicator', 15 | name='key_metric', 16 | field=models.BooleanField(default=False), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0050_auto_20200329_0620.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-29 06:20 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0049_geography_version'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddConstraint( 14 | model_name='geography', 15 | constraint=models.UniqueConstraint(fields=('version', 'code'), name='unique_geography_code_version'), 16 | ), 17 | ] 18 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0029_profilecategory_icon.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-06-21 17:14 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0028_coordinatefile_collection_id'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='profilecategory', 15 | name='icon', 16 | field=models.CharField(blank=True, max_length=30, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0045_auto_20211007_1056.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.24 on 2021-10-07 10:56 2 | 3 | from django.db import migrations 4 | import tinymce.models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('points', '0044_auto_20210909_0748'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='profilecategory', 16 | name='description', 17 | field=tinymce.models.HTMLField(blank=True), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/profile/templates/admin/profile/indicatorcategory/change_form.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/change_form.html" %} 2 | {% block content %} 3 | {{ block.super }} 4 |
5 |

Indicator Category Resources

6 |

Indicator subcategories

7 | 8 | {% for subcategory in original.indicatorsubcategory_set.all %} 9 | 10 | 11 | 12 | {% endfor %} 13 |
{{ subcategory.name }}
14 |
15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0079_delete_indicatorcategory.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 20:59 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0078_auto_20200411_2042'), 10 | ] 11 | 12 | state_operations = [ 13 | migrations.DeleteModel( 14 | name='IndicatorCategory', 15 | ), 16 | ] 17 | 18 | operations = [ 19 | migrations.SeparateDatabaseAndState(state_operations=state_operations) 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0028_coordinatefile_collection_id.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-06-01 08:12 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0027_auto_20200521_1201'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='coordinatefile', 15 | name='collection_id', 16 | field=models.PositiveSmallIntegerField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0009_indicator_label.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.9 on 2019-12-20 21:55 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0008_auto_20191220_2154'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='indicator', 15 | name='label', 16 | field=models.CharField(default='', max_length=100), 17 | preserve_default=False, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0003_profile_indicators.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.9 on 2019-12-20 13:20 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0002_remove_profile_indicators'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='profile', 15 | name='indicators', 16 | field=models.ManyToManyField(through='datasets.ProfileIndicator', to='datasets.Indicator'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/templates/custom/render_task_errors.html: -------------------------------------------------------------------------------- 1 |
2 |

We will Not be able to upload data till all issue listed below are resolved in the uploaded file

3 |

Sample Error:

4 | 11 |

For more info Download csv : Error Log File

12 |
13 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0015_country_geom.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-21 14:44 2 | 3 | import django.contrib.gis.db.models.fields 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('boundaries', '0014_country'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='country', 16 | name='geom', 17 | field=django.contrib.gis.db.models.fields.MultiPolygonField(null=True, srid=4326), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/tasks/delete_data.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from django.db import transaction 4 | from django.db.models.query import QuerySet 5 | from django.conf import settings 6 | 7 | logger = logging.getLogger(__name__) 8 | 9 | 10 | @transaction.atomic 11 | def delete_data(data, object_name, **kwargs): 12 | """ 13 | Delete data 14 | """ 15 | data.delete() 16 | 17 | is_queryset = isinstance(data, QuerySet) 18 | 19 | return { 20 | "is_queryset": is_queryset, 21 | "data": data, 22 | "object_name": object_name, 23 | } 24 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0039_profilecategory_color.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.13 on 2021-01-08 09:43 2 | 3 | import colorfield.fields 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('points', '0038_auto_20201202_1249'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='profilecategory', 16 | name='color', 17 | field=colorfield.fields.ColorField(blank=True, default='', max_length=18), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0007_auto_20200121_0907.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-21 09:07 2 | 3 | import django.contrib.gis.db.models.fields 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('boundaries', '0006_worldborder'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='worldborder', 16 | name='mpoly', 17 | field=django.contrib.gis.db.models.fields.PolygonField(srid=4326), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0052_location_content_search.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.28 on 2023-09-08 17:58 2 | 3 | import django.contrib.postgres.search 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('points', '0051_add_theme_colors'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='location', 16 | name='content_search', 17 | field=django.contrib.postgres.search.SearchVectorField(null=True), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0019_profilekeymetrics_label.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-19 05:52 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0018_profilekeymetrics_profile'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='profilekeymetrics', 15 | name='label', 16 | field=models.CharField(default='', max_length=100), 17 | preserve_default=False, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0009_auto_20200121_0954.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-21 09:54 2 | 3 | import django.contrib.gis.db.models.fields 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('boundaries', '0008_delete_worldborder'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='province', 16 | name='geom', 17 | field=django.contrib.gis.db.models.fields.MultiPolygonField(srid=4326), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0055_auto_20230908_1813.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.28 on 2023-09-08 18:13 2 | 3 | import django.contrib.postgres.indexes 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('points', '0054_auto_20230908_1810'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddIndex( 15 | model_name='location', 16 | index=django.contrib.postgres.indexes.GinIndex(fields=['content_search'], name='points_loca_content_903b52_gin'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0017_delete_licence.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-12 05:44 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0016_auto_20200412_0544'), 10 | ('points', '0014_auto_20200412_0533'), 11 | ] 12 | 13 | state_operations = [ 14 | migrations.DeleteModel( 15 | name='Licence', 16 | ), 17 | ] 18 | 19 | operations = [ 20 | migrations.SeparateDatabaseAndState(state_operations=state_operations) 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0082_delete_indicatorsubcategory.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 21:13 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0081_delete_indicatorsubcategory'), 10 | ] 11 | 12 | state_operations = [ 13 | migrations.DeleteModel( 14 | name='IndicatorSubcategory', 15 | ), 16 | ] 17 | 18 | operations = [ 19 | migrations.SeparateDatabaseAndState( 20 | state_operations=state_operations) 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/general/static/css/variable-filter-widget.css: -------------------------------------------------------------------------------- 1 | #variable-permission-filter ul>li{ 2 | position: relative; 3 | display: inline-block; 4 | padding-left: 20px; 5 | margin-bottom: 0; 6 | font-weight: 400; 7 | vertical-align: middle; 8 | cursor: pointer; 9 | } 10 | 11 | #variable-permission-filter ul>li input{ 12 | margin-right: 5px; 13 | } 14 | 15 | #variable-permission-filter ul>li:first-child{ 16 | padding-left: 2px; 17 | } 18 | 19 | select[name="content_indicator"] { 20 | margin-left: 160px; 21 | } 22 | 23 | select#id_indicator{ 24 | max-width: 700px; 25 | } -------------------------------------------------------------------------------- /wazimap_ng/general/templatetags/custom_tags.py: -------------------------------------------------------------------------------- 1 | from django import template 2 | from django.urls import reverse 3 | from wazimap_ng.datasets.models import Group 4 | 5 | register = template.Library() 6 | 7 | @register.filter 8 | def get_subindicator_link(pi_obj): 9 | url = None 10 | if pi_obj: 11 | indicator = pi_obj.indicator 12 | group = Group.objects.filter( 13 | dataset=indicator.dataset, name=indicator.groups[0] 14 | ).first() 15 | if group: 16 | url = reverse("admin:datasets_group_change", args=(group.id,)) 17 | return url 18 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0025_auto_20200512_1322.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-12 13:22 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0024_auto_20200507_0306'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='category', 15 | name='permission_type', 16 | field=models.CharField(choices=[('private', 'Private'), ('public', 'Public')], default='public', max_length=32), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0037_auto_20200928_2309.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.13 on 2020-09-28 23:09 2 | 3 | import django.contrib.postgres.fields.jsonb 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('points', '0036_auto_20200928_2255'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='location', 16 | name='data', 17 | field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0048_auto_20220805_0616.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.28 on 2022-08-05 06:16 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0047_auto_20211111_0413'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='historicalprofilecategory', 15 | name='color', 16 | ), 17 | migrations.RemoveField( 18 | model_name='profilecategory', 19 | name='color', 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0049_auto_20220808_0720.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.28 on 2022-08-08 07:20 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0048_auto_20220805_0616'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='historicalprofilecategory', 15 | name='icon', 16 | ), 17 | migrations.RemoveField( 18 | model_name='profilecategory', 19 | name='icon', 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0002_auto_20200319_1956.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-19 19:56 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('profile', '0001_initial'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='logo', 16 | name='profile', 17 | field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='datasets.Profile'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0100_group_subindicators.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-31 19:41 2 | 3 | import django.contrib.postgres.fields.jsonb 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0099_auto_20200531_1941'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='group', 16 | name='subindicators', 17 | field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0040_auto_20200217_0337.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-17 03:37 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0039_indicator_subindicators'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='profilehighlight', 15 | name='universe', 16 | ), 17 | migrations.RemoveField( 18 | model_name='profileindicator', 19 | name='universe', 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0060_profilehighlight_is_key_metric.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-03 10:57 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0060_auto_20200404_0550'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='profilehighlight', 15 | name='is_key_metric', 16 | field=models.BooleanField(default=False, help_text='Enable this to display in the rich data view.'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0069_auto_20200410_2016.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-10 20:16 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0068_auto_20200410_1712'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='profilehighlight', 15 | name='as_percentage', 16 | ), 17 | migrations.RemoveField( 18 | model_name='profilehighlight', 19 | name='denominator', 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0024_auto_20200507_0306.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-07 03:06 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0023_auto_20200509_2036'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='profilecategory', 15 | name='permission_type', 16 | field=models.CharField(choices=[('private', 'Private'), ('public', 'Public')], default='public', max_length=32), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0027_auto_20200521_1201.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-21 12:01 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0026_auto_20200521_0800'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='profilecategory', 15 | name='permission_type', 16 | field=models.CharField(choices=[('private', 'Private'), ('public', 'Public')], default='private', max_length=32), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0021_auto_20200110_0628.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-10 06:28 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0020_auto_20200110_0626'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveIndex( 14 | model_name='geography', 15 | name='datasets_ge_content_32188b_gin', 16 | ), 17 | migrations.RemoveField( 18 | model_name='geography', 19 | name='content_search', 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0098_group_dataset.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-31 19:12 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0097_auto_20200531_1821'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='group', 16 | name='dataset', 17 | field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='datasets.Dataset'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0103_auto_20200610_1137.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-06-10 11:37 2 | 3 | import django.core.validators 4 | from django.db import migrations, models 5 | import wazimap_ng.datasets.models.upload 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('datasets', '0102_auto_20200601_0519'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='geographyhierarchy', 17 | name='description', 18 | field=models.TextField(blank=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0122_auto_20211008_0540.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.24 on 2021-10-08 05:40 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0121_auto_20211007_1056'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='dataset', 16 | name='version', 17 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='datasets.Version'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0035_auto_20200507_0306.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-07 03:06 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0034_profile_requires_authentication'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='profile', 15 | name='permission_type', 16 | field=models.CharField(choices=[('private', 'Private'), ('public', 'Public')], default='public', max_length=32), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0043_profile_configuration.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-07-25 11:49 2 | 3 | import django.contrib.postgres.fields.jsonb 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('profile', '0042_indicatorcategory_icon'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='profile', 16 | name='configuration', 17 | field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0118_remove_geography_version.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.21 on 2021-08-05 06:21 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0117_auto_20210804_0330'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveConstraint( 14 | model_name='geography', 15 | name='unique_geography_code_version', 16 | ), 17 | migrations.RemoveField( 18 | model_name='geography', 19 | name='version', 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0113_dataset_content_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.21 on 2021-07-02 08:23 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0112_auto_20210527_0541'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='dataset', 15 | name='content_type', 16 | field=models.CharField(choices=[('quantitative', 'quantitative'), ('qualitative', 'qualitative')], default='quantitative', max_length=32), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/profile/templates/admin/profile/indicatorsubcategory/change_form.html: -------------------------------------------------------------------------------- 1 | {% extends "admin/change_form.html" %} 2 | {% block content %} 3 | {{ block.super }} 4 |
5 |

Indicator Subcateogry Resources

6 |

Profile indicators

7 | 8 | {% for profileindicator in original.profileindicator_set.all %} 9 | 10 | 11 | 12 | 13 | {% endfor %} 14 |
{{ profileindicator.label }}{{ profileindicator.profile.name }}
15 |
16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0014_profileindicator_universe.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.9 on 2020-01-01 15:50 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0013_universe'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='profileindicator', 16 | name='universe', 17 | field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='datasets.Universe'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0032_auto_20200208_0544.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-08 05:44 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0031_merge_20200206_2350'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='indicatordata', 15 | options={'verbose_name_plural': 'Indicator Data items'}, 16 | ), 17 | migrations.RemoveField( 18 | model_name='universe', 19 | name='dataset', 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0102_auto_20200601_0519.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-06-01 05:19 2 | 3 | import django.core.validators 4 | from django.db import migrations, models 5 | import wazimap_ng.datasets.models.upload 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('datasets', '0101_auto_20200531_2327'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='datasetfile', 17 | name='dataset_id', 18 | field=models.PositiveSmallIntegerField(blank=True, null=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0048_profileindicator_content_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.21 on 2021-07-22 10:14 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0047_profileindicator_configuration'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='profileindicator', 15 | name='content_type', 16 | field=models.CharField(choices=[('indicator', 'indicator'), ('html', 'html')], default='indicator', max_length=32), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0023_geographyboundary_geom_cache.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-14 10:14 2 | 3 | from django.db import migrations 4 | import wazimap_ng.boundaries.fields 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('boundaries', '0022_auto_20200214_0946'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='geographyboundary', 16 | name='geom_cache', 17 | field=wazimap_ng.boundaries.fields.CachedMultiPolygonField(blank=True, null=True, srid=4326), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0099_auto_20200531_1941.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-31 19:41 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0098_group_dataset'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='group', 15 | options={'ordering': ('name',), 'verbose_name': 'SubindicatorsGroup'}, 16 | ), 17 | migrations.RemoveField( 18 | model_name='group', 19 | name='subindicators', 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0031_auto_20200717_1053.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-07-17 10:53 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('points', '0030_auto_20200624_0311'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='coordinatefile', 16 | name='task', 17 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='django_q.Task'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0047_profileindicator_configuration.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-09-10 09:49 2 | 3 | import django.contrib.postgres.fields.jsonb 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('profile', '0046_auto_20200822_0812'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='profileindicator', 16 | name='chart_configuration', 17 | field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0003_auto_20200110_2056.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-10 20:56 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('points', '0002_auto_20200110_1936'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='category', 16 | name='theme', 17 | field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='categories', to='points.Theme'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0044_auto_20210909_0748.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.24 on 2021-09-09 07:48 2 | 3 | import django.contrib.postgres.fields.jsonb 4 | from django.db import migrations 5 | import tinymce.models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('points', '0043_merge_20210514_0918'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='profilecategory', 17 | name='configuration', 18 | field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0025_auto_20200329_0551.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-29 05:51 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('boundaries', '0024_auto_20200329_0545'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='geographyboundary', 16 | name='geography', 17 | field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='datasets.Geography'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0086_dataset_dataset_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-17 08:00 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0085_auto_20200412_0533'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='dataset', 15 | name='dataset_type', 16 | field=models.CharField(choices=[('private', 'Private'), ('public', 'Public'), ('non_editable', 'Public But Non Editable')], default='public', max_length=32), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0124_auto_20211009_1012.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.24 on 2021-10-09 10:12 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0122_auto_20211008_0540'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='geographyhierarchy', 16 | name='root_geography', 17 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='datasets.Geography', unique=True), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0041_profilecategory_attributes.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.13 on 2021-03-02 20:06 2 | 3 | import django.contrib.postgres.fields.jsonb 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('points', '0040_merge_20210111_1807'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='profilecategory', 16 | name='visible_tooltip_attributes', 17 | field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0032_auto_20200417_0800.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-17 08:00 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0031_profile_profile_type'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='profile', 15 | name='profile_type', 16 | field=models.CharField(choices=[('private', 'Private'), ('public', 'Public'), ('non_editable', 'Public But Non Editable')], default='public', max_length=32), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0024_profilehighlight_value.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-24 18:46 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0023_profilehighlight'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='profilehighlight', 15 | name='value', 16 | field=models.CharField(blank=True, help_text='The value used for the highlight. Should be one of the possible valuess for the given indicator.', max_length=60), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0034_dataset_groups.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-09 07:39 2 | 3 | import django.contrib.postgres.fields 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0033_auto_20200210_1843'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='dataset', 16 | name='groups', 17 | field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=50), blank=True, default=list, size=None), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0035_auto_20200209_1315.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-09 13:15 2 | 3 | import django.contrib.postgres.fields 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0034_dataset_groups'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='indicator', 16 | name='groups', 17 | field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=50), blank=True, default=list, size=None), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0020_category_permission_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-29 06:55 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0019_auto_20200428_1549'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='category', 15 | name='permission_type', 16 | field=models.CharField(choices=[('private', 'Private'), ('public', 'Public'), ('non_editable', 'Public But Non Editable')], default='public', max_length=32), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0025_auto_20200125_1452.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-25 14:52 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0024_profilehighlight_value'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='profilehighlight', 15 | name='value', 16 | field=models.CharField(blank=True, help_text='The value used for the highlight. Should be one of the possible values for the given indicator.', max_length=60), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0037_auto_20200211_1929.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-11 19:29 2 | 3 | import django.contrib.postgres.fields 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0036_auto_20200209_1515'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='dataset', 16 | name='groups', 17 | field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=200), blank=True, default=list, size=None), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0084_auto_20200411_2129.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 21:29 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0083_auto_20200411_2133'), 10 | ('profile', '0015_auto_20200411_2129'), 11 | ('points', '0013_auto_20200411_2129'), 12 | ] 13 | 14 | state_operations = [ 15 | migrations.DeleteModel( 16 | name='Profile', 17 | ), 18 | ] 19 | 20 | operations = [ 21 | migrations.SeparateDatabaseAndState(state_operations=state_operations) 22 | ] 23 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/templates/custom/variable_task_errors.html: -------------------------------------------------------------------------------- 1 |
2 |

We got some issues while extracting data.

3 |

Sample Error:

4 | 11 |

For more info on errors by lines : Error Log File

12 |

To get all the incorrect rows please download : Incorrect Rows CSV

13 |
14 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0037_auto_20200521_1501.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-21 15:01 2 | 3 | from django.db import migrations 4 | 5 | def set_profile_to_private(apps, schema_editor): 6 | Profile = apps.get_model("profile", "Profile") 7 | for profile in Profile.objects.filter(requires_authentication=True): 8 | profile.permission_type = "private" 9 | profile.save() 10 | 11 | 12 | class Migration(migrations.Migration): 13 | 14 | dependencies = [ 15 | ('profile', '0036_auto_20200508_0751'), 16 | ] 17 | 18 | operations = [ 19 | migrations.RunPython(set_profile_to_private), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0034_auto_20200821_0613.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-08-21 06:13 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('points', '0033_profilecategory_theme'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='profilecategory', 16 | name='theme', 17 | field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='profile_categories', to='points.Theme'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /tests/datasets/models/test_groups.py: -------------------------------------------------------------------------------- 1 | from wazimap_ng.datasets.models import Indicator, Dataset, DatasetData, Group 2 | 3 | from unittest.mock import patch 4 | from unittest.mock import Mock 5 | 6 | class TestGroup: 7 | def test_create_group(self): 8 | dataset = Dataset(name="test dataset") 9 | g = Group(name="Hello", dataset=dataset) 10 | assert len(g.subindicators) == 0 11 | assert g.name == "Hello" 12 | assert g.dataset == dataset 13 | 14 | 15 | def test_str(self): 16 | d = Dataset(name="Test Dataset") 17 | g = Group(name="Hello", dataset=d) 18 | assert str(g) == f"Test Dataset|Hello" 19 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0058_auto_20200402_0804.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-02 08:04 2 | 3 | import django.contrib.postgres.fields 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0057_auto_20200402_0753'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='indicator', 16 | name='subindicators', 17 | field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, size=None), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0015_profilecategory_collection_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-17 08:00 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('points', '0014_auto_20200412_0533'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='profilecategory', 15 | name='collection_type', 16 | field=models.CharField(choices=[('private', 'Private'), ('public', 'Public'), ('non_editable', 'Public But Non Editable')], default='public', max_length=32), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0028_auto_20200420_1255.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-20 12:55 2 | 3 | from django.db import migrations 4 | 5 | def prepopulate_profile_keymetric_order(apps, schema_editor): 6 | ProfileKeyMetrics = apps.get_model("profile", "ProfileKeyMetrics") 7 | for idx, km in enumerate(ProfileKeyMetrics.objects.all()): 8 | km.order = idx 9 | km.save() 10 | 11 | class Migration(migrations.Migration): 12 | 13 | dependencies = [ 14 | ('profile', '0027_auto_20200420_1255'), 15 | ] 16 | 17 | operations = [ 18 | migrations.RunPython(prepopulate_profile_keymetric_order), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0027_auto_20200204_1340.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-04 13:40 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0026_auto_20200204_1338'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveIndex( 14 | model_name='geography', 15 | name='datasets_ge_code_0edced_idx', 16 | ), 17 | migrations.AddIndex( 18 | model_name='geography', 19 | index=models.Index(fields=['code'], name='idx_datasets_geography_code'), 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0059_auto_20200402_0808.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-02 08:08 2 | 3 | import django.contrib.postgres.fields 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0058_auto_20200402_0804'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='profileindicator', 16 | name='subindicators', 17 | field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, size=None), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0017_category_metadata.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-28 12:17 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('general', '0001_initial'), 10 | ('points', '0016_auto_20200422_0901'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='category', 16 | name='metadata', 17 | field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='general.MetaData'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0021_theme_profile.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-29 07:26 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('profile', '0033_auto_20200422_0901'), 11 | ('points', '0020_category_permission_type'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='theme', 17 | name='profile', 18 | field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='profile.Profile'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0026_auto_20200420_1248.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-20 12:48 2 | 3 | from django.db import migrations 4 | 5 | def prepopulate_profile_indicator_order(apps, schema_editor): 6 | ProfileIndicator = apps.get_model("profile", "ProfileIndicator") 7 | for idx, pi in enumerate(ProfileIndicator.objects.all()): 8 | pi.order = idx 9 | pi.save() 10 | 11 | 12 | class Migration(migrations.Migration): 13 | 14 | dependencies = [ 15 | ('profile', '0025_auto_20200420_1248'), 16 | ] 17 | 18 | operations = [ 19 | migrations.RunPython(prepopulate_profile_indicator_order), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0013_auto_20200411_2129.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 21:29 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('points', '0012_auto_20200331_1256'), 11 | ('profile', '0015_auto_20200411_2129'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='profilecategory', 17 | name='profile', 18 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='profile.Profile'), 19 | ), 20 | ] 21 | 22 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0018_profilekeymetrics_profile.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-13 14:44 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('profile', '0017_delete_licence'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='profilekeymetrics', 16 | name='profile', 17 | field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='profile.Profile'), 18 | preserve_default=False, 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0017_province_geography.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-25 15:55 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0025_auto_20200125_1452'), 11 | ('boundaries', '0016_country_area'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='province', 17 | name='geography', 18 | field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='datasets.Geography'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0020_auto_20200110_0626.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-10 06:26 2 | 3 | from django.db import migrations 4 | import wazimap_ng.datasets.models.geography 5 | from django.conf import settings 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('datasets', '0019_auto_20200110_0535'), 12 | ('extensions', '0001_initial'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AddIndex( 17 | model_name='geography', 18 | index=wazimap_ng.extensions.index.GinTrgmIndex(fields=['name'], name='datasets_ge_name_53e877_gin'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0036_auto_20200209_1515.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-09 15:15 2 | 3 | import django.contrib.postgres.fields 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('datasets', '0035_auto_20200209_1315'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='universe', 17 | name='dataset', 18 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='datasets.Dataset'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0038_profileindicator_subindicators.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-10 06:58 2 | 3 | import django.contrib.postgres.fields 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0037_auto_20200211_1929'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='profileindicator', 16 | name='subindicators', 17 | field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=50), blank=True, default=list, size=None), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0039_indicator_subindicators.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-14 07:37 2 | 3 | import django.contrib.postgres.fields 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0038_profileindicator_subindicators'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='indicator', 16 | name='subindicators', 17 | field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=50), blank=True, default=list, size=None), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0083_auto_20200411_2133.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 21:33 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0082_delete_indicatorsubcategory'), 10 | ] 11 | 12 | database_operations = [ 13 | migrations.AlterModelTable('Profile', 'profile_profile'), 14 | ] 15 | 16 | state_operations = [ 17 | 18 | ] 19 | 20 | operations = [ 21 | migrations.SeparateDatabaseAndState( 22 | database_operations=database_operations, 23 | state_operations=state_operations) 24 | ] 25 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0026_auto_20200329_0554.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-29 05:54 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('boundaries', '0025_auto_20200329_0551'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='geographyboundary', 16 | name='geography', 17 | field=models.OneToOneField(default=1, on_delete=django.db.models.deletion.PROTECT, to='datasets.Geography'), 18 | preserve_default=False, 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0046_datasetfile_task.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-23 17:58 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('django_q', '0009_auto_20171009_0915'), 11 | ('datasets', '0045_auto_20200319_1946'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='datasetfile', 17 | name='task', 18 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='django_q.Task'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0093_auto_20200520_2031.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-20 20:31 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('profile', '0036_auto_20200508_0751'), 11 | ('datasets', '0092_auto_20200520_1048'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='dataset', 17 | name='profile', 18 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='profile.Profile'), 19 | ) 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0009_coordinatefile_task.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-03-19 09:26 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('django_q', '0009_auto_20171009_0915'), 11 | ('points', '0008_auto_20200317_1955'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='coordinatefile', 17 | name='task', 18 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='django_q.Task'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0025_auto_20200420_1248.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-20 12:48 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0024_auto_20200420_1227'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='profileindicator', 15 | options={'ordering': ['order']}, 16 | ), 17 | migrations.AddField( 18 | model_name='profileindicator', 19 | name='order', 20 | field=models.PositiveIntegerField(default=0), 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0029_auto_20200420_1327.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-20 13:27 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0028_auto_20200420_1255'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='profilehighlight', 15 | options={'ordering': ['order']}, 16 | ), 17 | migrations.AddField( 18 | model_name='profilehighlight', 19 | name='order', 20 | field=models.PositiveIntegerField(default=0), 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0031_profile_profile_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-16 21:38 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0030_auto_20200420_1328'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='profile', 15 | name='profile_type', 16 | field=models.CharField(choices=[('private', 'Private'), ('public', 'Public'), ('non_editable', 'Public But Non Editable')], default='public', max_length=32), 17 | preserve_default=False, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0073_auto_20200411_1832.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 18:32 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0072_delete_profiledata'), 10 | ] 11 | 12 | database_operations = [ 13 | migrations.AlterModelTable('ProfileIndicator', 'profile_profileindicator'), 14 | ] 15 | 16 | state_operations = [ 17 | 18 | ] 19 | 20 | operations = [ 21 | migrations.SeparateDatabaseAndState( 22 | database_operations=database_operations, 23 | state_operations=state_operations) 24 | ] 25 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0077_auto_20200411_2044.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 20:44 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0076_auto_20200411_2035'), 10 | ] 11 | 12 | database_operations = [ 13 | migrations.AlterModelTable('IndicatorCategory', 'profile_indicatorcategory'), 14 | ] 15 | 16 | state_operations = [ 17 | 18 | ] 19 | 20 | operations = [ 21 | migrations.SeparateDatabaseAndState( 22 | database_operations=database_operations, 23 | state_operations=state_operations) 24 | ] 25 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0078_auto_20200411_2042.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 20:42 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0077_auto_20200411_2044'), 11 | ('profile', '0013_indicatorcategory'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='indicatorsubcategory', 17 | name='category', 18 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='profile.IndicatorCategory'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0090_auto_20200507_0306.py: -------------------------------------------------------------------------------- 1 | 2 | # Generated by Django 2.2.10 on 2020-05-07 03:06 3 | 4 | import django.core.validators 5 | from django.db import migrations, models 6 | import wazimap_ng.datasets.models.upload 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('datasets', '0089_auto_20200509_2036'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AlterField( 17 | model_name='dataset', 18 | name='permission_type', 19 | field=models.CharField(choices=[('private', 'Private'), ('public', 'Public')], default='public', max_length=32), 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/profile/admin/admins/logo_admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib.gis import admin 2 | 3 | from ... import models 4 | from wazimap_ng.general.services import permissions 5 | from wazimap_ng.general.admin.admin_base import BaseAdminModel, HistoryAdmin 6 | from wazimap_ng.general.admin import filters 7 | from wazimap_ng.general.admin.forms import HistoryAdminForm 8 | 9 | @admin.register(models.Logo) 10 | class LogoAdmin(BaseAdminModel, HistoryAdmin): 11 | list_display = ("profile",) 12 | list_filter = (filters.ProfileFilter,) 13 | fieldsets = ( 14 | ("", { 15 | 'fields': ('profile', 'logo', "url", ) 16 | }), 17 | ) 18 | form = HistoryAdminForm -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0052_profile_geography_hierarchy.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-29 07:52 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0051_geographyhierarchy'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='profile', 16 | name='geography_hierarchy', 17 | field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.PROTECT, to='datasets.GeographyHierarchy'), 18 | preserve_default=False, 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0080_auto_20200411_2108.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 21:08 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0079_delete_indicatorcategory'), 10 | ] 11 | 12 | database_operations = [ 13 | migrations.AlterModelTable('IndicatorSubcategory', 'profile_indicatorsubcategory'), 14 | ] 15 | 16 | state_operations = [ 17 | 18 | ] 19 | 20 | operations = [ 21 | migrations.SeparateDatabaseAndState( 22 | database_operations=database_operations, 23 | state_operations=state_operations) 24 | ] 25 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0111_auto_20210322_0740.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.13 on 2021-03-22 07:40 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0110_metadata_url'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='group', 15 | name='can_aggregate', 16 | field=models.BooleanField(default=True), 17 | ), 18 | migrations.AddField( 19 | model_name='group', 20 | name='can_filter', 21 | field=models.BooleanField(default=True), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0053_dataset_geography_hierarchy.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-30 07:21 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0052_profile_geography_hierarchy'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='dataset', 16 | name='geography_hierarchy', 17 | field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='datasets.GeographyHierarchy'), 18 | preserve_default=False, 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0062_auto_20200407_0642.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-07 06:42 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0062_auto_20200410_1242'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='profilehighlight', 15 | name='value', 16 | ), 17 | migrations.AddField( 18 | model_name='profilehighlight', 19 | name='subindicator', 20 | field=models.PositiveSmallIntegerField(blank=True, max_length=60, null=True), 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0043_auto_20200228_0912.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-28 09:12 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0042_auto_20200220_0614'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveField( 14 | model_name='indicator', 15 | name='label', 16 | ), 17 | migrations.RemoveField( 18 | model_name='profileindicator', 19 | name='name', 20 | ), 21 | migrations.RemoveField( 22 | model_name='universe', 23 | name='name', 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0014_country.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-21 14:40 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('boundaries', '0013_mainplace_subplace'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='Country', 15 | fields=[ 16 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('code', models.CharField(max_length=10)), 18 | ('name', models.CharField(max_length=50)), 19 | ], 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0044_auto_20200805_0530.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-08-05 05:30 2 | 3 | from django.db import migrations 4 | 5 | 6 | def create_choropleth_method(apps, schema_editor): 7 | 8 | ChoroplethMethod = apps.get_model("profile", "ChoroplethMethod") 9 | ChoroplethMethod.objects.create( 10 | name="absolute_value", 11 | description="This method displays the exact value as provided in the data." 12 | ) 13 | 14 | class Migration(migrations.Migration): 15 | 16 | dependencies = [ 17 | ('profile', '0043_profile_configuration'), 18 | ] 19 | 20 | operations = [ 21 | migrations.RunPython(create_choropleth_method), 22 | ] 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all test stop run 2 | 3 | all: 4 | docker-compose up -d 5 | 6 | test: 7 | docker-compose exec -e DJANGO_CONFIGURATION=Test web pytest /app/tests 8 | 9 | test_focus: 10 | docker-compose exec -e DJANGO_CONFIGURATION=Test web pytest -m focus /app/tests 11 | 12 | run: 13 | docker-compose up 14 | 15 | stop: 16 | docker-compose stop 17 | 18 | migrate: 19 | docker-compose exec web python3 manage.py migrate 20 | 21 | shell: 22 | docker-compose exec web bash 23 | 24 | pyshell: 25 | docker-compose exec web python3 manage.py shell 26 | 27 | dbshell: 28 | docker-compose exec web python3 manage.py dbshell 29 | 30 | requirements: 31 | docker-compose exec web pip3 install -r requirements.txt 32 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/static/css/admin-custom.css: -------------------------------------------------------------------------------- 1 | #datasetfile-group>.module>h2, #coordinatefile-group>.module>h2 { display: none } 2 | #datasetfile-group>.module>#datasetfile-0>h3 { display: none } 3 | .add-icon {background: url(../admin/img/icon-addlink.svg) 0 1px no-repeat; padding-left: 16px; font-size: 12px;} 4 | #coordinatefile_set-group>.module>#coordinatefile_set-0>h3 { visibility: hidden; } 5 | #coordinatefile_set-group>.module>h2 { display: none } 6 | #metadata-group>.module>#metadata-0>h3 { visibility: hidden; } 7 | .field-icon>div { display: flex; } 8 | #content> h1 { 9 | margin: 0 0 20px !important; 10 | font-weight: 300 !important; 11 | font-size: 20px !important; 12 | color: #666 !important; 13 | } -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0014_auto_20200412_0533.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-12 05:33 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('points', '0013_auto_20200411_2129'), 11 | ('datasets', '0085_auto_20200412_0533'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='metadata', 17 | name='licence', 18 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='points_licence', to='datasets.Licence'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0092_auto_20200520_1048.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-20 10:48 2 | 3 | import django.core.validators 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | import wazimap_ng.datasets.models.upload 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('datasets', '0091_auto_20200520_0449'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AlterField( 17 | model_name='dataset', 18 | name='permission_type', 19 | field=models.CharField(choices=[('private', 'Private'), ('public', 'Public')], default='private', max_length=32), 20 | ) 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/general/templates/emailTemplates/upload_task_notification.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{ subject }} 7 | 8 | 9 | Hello {{user.username}}, 10 | 11 | {% if task.success %} 12 |

Upload process for {{dataset.name}} is finished successfully.

13 | {% else %} 14 |

Upload process for {{dataset.name}} has failed.

15 | {% endif %} 16 |

Please checkout {{task.id}} for further details of the process.

17 | 18 |

Thanks,
Openup Team

19 | 20 | 21 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0054_profileindicator_choropleth_method.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-30 20:20 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('profile', '0005_auto_20200330_2005'), 11 | ('datasets', '0053_dataset_geography_hierarchy'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='profileindicator', 17 | name='choropleth_method', 18 | field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='profile.ChoroplethMethod'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/00064_licence.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-31 08:52 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0005_auto_20200330_2005'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='Licence', 15 | fields=[ 16 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('name', models.CharField(max_length=30)), 18 | ('url', models.URLField(blank=True, max_length=150, null=True)), 19 | ], 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0007_auto_20200331_1036.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-31 10:36 2 | 3 | from django.db import migrations 4 | 5 | 6 | def forwards(apps, schema_editor): 7 | """ 8 | create initial data for Licence model 9 | """ 10 | Licence = apps.get_model('profile', 'Licence') 11 | 12 | for name in ["creative commons", "other"]: 13 | Licence.objects.create(name=name) 14 | 15 | 16 | def backwards(apps, schema_editor): 17 | pass 18 | 19 | 20 | class Migration(migrations.Migration): 21 | 22 | dependencies = [ 23 | ('profile', '00065_logo_url'), 24 | ] 25 | 26 | operations = [ 27 | migrations.RunPython(forwards, backwards) 28 | ] 29 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0027_auto_20200420_1255.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-20 12:55 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0026_auto_20200420_1248'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='profilekeymetrics', 15 | options={'ordering': ['order'], 'verbose_name_plural': 'Profile key metrics'}, 16 | ), 17 | migrations.AddField( 18 | model_name='profilekeymetrics', 19 | name='order', 20 | field=models.PositiveIntegerField(default=0), 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0070_auto_20200411_0621.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 06:21 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0069_auto_20200410_2016'), 10 | ] 11 | 12 | database_operations = [ 13 | migrations.AlterModelTable('ProfileHighlight', 'profile_profilehighlight') 14 | ] 15 | 16 | state_operations = [ 17 | migrations.DeleteModel('ProfileHighlight') 18 | ] 19 | 20 | operations = [ 21 | migrations.SeparateDatabaseAndState( 22 | database_operations=database_operations, 23 | state_operations=state_operations) 24 | ] 25 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0003_choroplethmethod.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-30 19:58 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0002_auto_20200319_1956'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='ChoroplethMethod', 15 | fields=[ 16 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('name', models.CharField(max_length=30)), 18 | ('description', models.CharField(max_length=255)), 19 | ], 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0022_auto_20200420_0949.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-20 09:49 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0021_profilehighlight_denominator'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='indicatorcategory', 15 | options={'ordering': ['order'], 'verbose_name_plural': 'Indicator Categories'}, 16 | ), 17 | migrations.AddField( 18 | model_name='indicatorcategory', 19 | name='order', 20 | field=models.PositiveIntegerField(default=0), 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0023_auto_20200420_1211.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-20 12:11 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0022_auto_20200420_0949'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='indicatorsubcategory', 15 | options={'ordering': ['order'], 'verbose_name_plural': 'Indicator Subcategories'}, 16 | ), 17 | migrations.AddField( 18 | model_name='indicatorsubcategory', 19 | name='order', 20 | field=models.PositiveIntegerField(default=0), 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0075_auto_20200411_1843.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 18:43 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0074_auto_20200411_1830'), 10 | ] 11 | 12 | state_operations = [ 13 | # Pasted from auto-generated operations in previous step: 14 | migrations.DeleteModel( 15 | name='ProfileIndicator', 16 | ), 17 | ] 18 | 19 | operations = [ 20 | # After this state operation, the Django DB state should match the 21 | # actual database structure. 22 | migrations.SeparateDatabaseAndState(state_operations=state_operations) 23 | ] 24 | -------------------------------------------------------------------------------- /wazimap_ng/general/templates/emailTemplates/indicator_extraction_task_notification.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{ subject }} 7 | 8 | 9 | Hello {{user.username}}, 10 | 11 | {% if task.success %} 12 |

Data extraction process for {{indicator.name}} is finished successfully.

13 | {% else %} 14 |

Data extraction process {{indicator.name}} has failed.

15 | {% endif %} 16 |

Please checkout {{task.id}} for further details of the process.

17 | 18 |

Thanks,
Openup Team

19 | 20 | 21 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0054_auto_20220726_0553.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.28 on 2022-07-26 05:53 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0053_auto_20220719_1512'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='historicalprofileindicator', 15 | name='enable_linear_scrubber', 16 | field=models.BooleanField(default=False), 17 | ), 18 | migrations.AddField( 19 | model_name='profileindicator', 20 | name='enable_linear_scrubber', 21 | field=models.BooleanField(default=False), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0024_auto_20200329_0545.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-29 05:45 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('boundaries', '0023_geographyboundary_geom_cache'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RemoveIndex( 14 | model_name='geographyboundary', 15 | name='boundaries__code_8ea6f4_idx', 16 | ), 17 | migrations.RemoveField( 18 | model_name='geographyboundary', 19 | name='code', 20 | ), 21 | migrations.RemoveField( 22 | model_name='geographyboundary', 23 | name='name', 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /wazimap_ng/general/static/js/sortable-widget.js: -------------------------------------------------------------------------------- 1 | function sleep (time) { 2 | return new Promise((resolve) => setTimeout(resolve, time)); 3 | } 4 | 5 | django.jQuery(document).ready(function($) { 6 | $(".sortable" ).sortable({ 7 | out: function(event, ui) { 8 | $parent = ui.item.parent(); 9 | $input = ui.item.parents(".sortable_widget").find("input"); 10 | var reorderedSubindicators = []; 11 | sleep(1000).then(() => { $parent.find("li").each(function(){ 12 | reorderedSubindicators.push($(this).data('val')); 13 | $input.val(JSON.stringify(reorderedSubindicators)); 14 | }); 15 | }); 16 | }, 17 | }); 18 | 19 | $(".sortable" ).disableSelection(); 20 | 21 | } ); -------------------------------------------------------------------------------- /wazimap_ng/datasets/models/metadata.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from tinymce.models import HTMLField 3 | 4 | from .licence import Licence 5 | from .dataset import Dataset 6 | from wazimap_ng.general.models import BaseModel 7 | 8 | class MetaData(BaseModel): 9 | source = models.CharField(max_length=60, null=False, blank=True) 10 | url = models.URLField(null=True, blank=True) 11 | description = HTMLField(blank=True) 12 | licence = models.ForeignKey( 13 | Licence, null=True, blank=True, on_delete=models.SET_NULL, 14 | related_name="dataset_license" 15 | ) 16 | dataset = models.OneToOneField(Dataset, on_delete=models.CASCADE) 17 | 18 | def __str__(self): 19 | return "Meta->Dataset : %s" % (self.dataset.name) 20 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0016_auto_20200412_0544.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-12 05:44 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0015_auto_20200411_2129'), 10 | ('points', '0013_auto_20200411_2129'), 11 | ] 12 | 13 | operations = [ 14 | ] 15 | 16 | 17 | database_operations = [ 18 | migrations.AlterModelTable('Licence', 'datasets_licence'), 19 | ] 20 | 21 | state_operations = [ 22 | 23 | ] 24 | 25 | operations = [ 26 | migrations.SeparateDatabaseAndState( 27 | database_operations=database_operations, 28 | state_operations=state_operations) 29 | ] 30 | 31 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0062_auto_20200410_1242.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-10 12:42 2 | 3 | from django.db import migrations 4 | 5 | def create_metadata(apps, schema_editor): 6 | Dataset = apps.get_model('datasets', 'Dataset') 7 | MetaData = apps.get_model('datasets', 'MetaData') 8 | 9 | for dataset in Dataset.objects.all(): 10 | if MetaData.objects.filter(dataset=dataset).count() == 0: 11 | MetaData.objects.create(dataset=dataset, source="", licence=None, description="") 12 | 13 | 14 | class Migration(migrations.Migration): 15 | 16 | dependencies = [ 17 | ('datasets', '0061_auto_20200406_0255'), 18 | ] 19 | 20 | operations = [ 21 | migrations.RunPython(create_metadata), 22 | ] 23 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0114_create_versions_auto_20210818_0900.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.21 on 2021-08-18 09:00 2 | 3 | from django.db import migrations 4 | 5 | 6 | def create_versions(apps, schema_editor): 7 | Geography = apps.get_model("datasets", "Geography") 8 | Version = apps.get_model("datasets", "Version") 9 | 10 | for version in Geography.objects.all().values_list( 11 | "version", flat=True 12 | ).order_by("version").distinct("version"): 13 | Version.objects.create(name=version) 14 | 15 | class Migration(migrations.Migration): 16 | 17 | dependencies = [ 18 | ('datasets', '0114_auto_20210803_0721'), 19 | ] 20 | 21 | operations = [ 22 | migrations.RunPython(create_versions), 23 | ] 24 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0095_group.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-31 11:58 2 | 3 | import django.contrib.postgres.fields 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0094_auto_20200521_1509'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Group', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('subindicators', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=150), blank=True, default=list, size=None)), 19 | ], 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/general/templates/widgets/VariableFilterWidget.html: -------------------------------------------------------------------------------- 1 |
2 | {{ choice_field }} 3 |
4 | 21 | -------------------------------------------------------------------------------- /scripts/shapefiles/country.qmd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | dataset 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 0 17 | 0 18 | 19 | 20 | 21 | 22 | false 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0021_profilehighlight_denominator.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-19 14:57 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0020_auto_20200419_0559'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='profilehighlight', 15 | name='denominator', 16 | field=models.CharField(choices=[('absolute_value', 'Absolute value'), ('subindicators', 'Sub-indicators'), ('sibling', 'Sibling')], default='absolute_value', help_text='Method for calculating the denominator that will normalise this value.', max_length=32), 17 | preserve_default=False, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0074_auto_20200411_1830.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-11 18:30 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0073_auto_20200411_1832'), 10 | ('profile', '0012_profileindicator'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterModelOptions( 15 | name='indicatorsubcategory', 16 | options={'ordering': ['id']}, 17 | ), 18 | migrations.AlterField( 19 | model_name='profile', 20 | name='indicators', 21 | field=models.ManyToManyField(through='profile.ProfileIndicator', to='datasets.Indicator', verbose_name='variables'), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /wazimap_ng/general/migrations/0002_auto_20200624_0311.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-06-24 03:11 2 | 3 | from django.db import migrations, models 4 | import django.utils.timezone 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('general', '0001_initial'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='metadata', 16 | name='created', 17 | field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), 18 | preserve_default=False, 19 | ), 20 | migrations.AddField( 21 | model_name='metadata', 22 | name='updated', 23 | field=models.DateTimeField(auto_now=True), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0010_auto_20200328_1253.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-28 12:53 2 | 3 | import django.core.validators 4 | from django.db import migrations, models 5 | import wazimap_ng.points.models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('points', '0009_coordinatefile_task'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='coordinatefile', 17 | name='document', 18 | field=models.FileField(help_text='File Type required : CSV | Fields that are required: Name, Longitude, latitude', upload_to=wazimap_ng.points.models.get_file_path, validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['csv'])]), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0030_auto_20200420_1328.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-20 13:28 2 | 3 | from django.db import migrations 4 | 5 | def prepopulate_profile_highlight_order(apps, schema_editor): 6 | # We can't import the Person model directly as it may be a newer 7 | # version than this migration expects. We use the historical version. 8 | ProfileHighlight = apps.get_model("profile", "ProfileHighlight") 9 | for idx, ph in enumerate(ProfileHighlight.objects.all()): 10 | ph.order = idx 11 | ph.save() 12 | 13 | class Migration(migrations.Migration): 14 | 15 | dependencies = [ 16 | ('profile', '0029_auto_20200420_1327'), 17 | ] 18 | 19 | operations = [ 20 | migrations.RunPython(prepopulate_profile_highlight_order), 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0106_auto_20200624_0318.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-06-24 03:18 2 | 3 | from django.db import migrations, models 4 | import django.utils.timezone 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0105_auto_20200624_0311'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='dataset', 16 | name='created', 17 | field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), 18 | preserve_default=False, 19 | ), 20 | migrations.AddField( 21 | model_name='dataset', 22 | name='updated', 23 | field=models.DateTimeField(auto_now=True), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0010_auto_20191222_0916.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.9 on 2019-12-22 09:16 2 | 3 | import django.contrib.postgres.fields 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0009_indicator_label'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='profiledata', 16 | name='key_metric', 17 | field=models.BooleanField(default=False), 18 | ), 19 | migrations.AlterField( 20 | model_name='indicator', 21 | name='groups', 22 | field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=50), blank=True, size=None), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0051_geographyhierarchy.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-29 07:47 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0050_auto_20200329_0620'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='GeographyHierarchy', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('name', models.CharField(max_length=50)), 19 | ('root_geography', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='datasets.Geography')), 20 | ], 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0038_auto_20201202_1249.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.13 on 2020-12-02 12:49 2 | 3 | from django.db import migrations 4 | 5 | def update_point_data(apps, schema_editor): 6 | Location = apps.get_model('points', 'Location') 7 | for location in Location.objects.all(): 8 | data = location.data 9 | if type(data) == dict: 10 | data2 = [{"key": key, "value": value} for (key, value) in data.items()] 11 | location.data = data2 12 | location.save() 13 | 14 | 15 | class Migration(migrations.Migration): 16 | 17 | dependencies = [ 18 | ('points', '0037_auto_20200928_2309'), 19 | ] 20 | 21 | 22 | operations = [ 23 | migrations.RunPython(update_point_data, lambda apps, schema_editor: migrations.RunPython.noop), 24 | ] 25 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/admin/forms/indicator_admin_form.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from ... import models 3 | from wazimap_ng.general.admin.forms import HistoryAdminForm 4 | 5 | class IndicatorAdminForm(HistoryAdminForm): 6 | groups = forms.ChoiceField(required=True) 7 | class Meta: 8 | model = models.Indicator 9 | fields = '__all__' 10 | 11 | def __init__(self, *args, **kwargs): 12 | super().__init__(*args, **kwargs) 13 | if not self.instance.id: 14 | self.fields['groups'].choices = self.group_choices 15 | self.fields['universe'].queryset = self.universe_queryset 16 | 17 | def clean(self,*args,**kwargs): 18 | cleaned_data = super().clean(*args,**kwargs) 19 | cleaned_data['groups'] = [cleaned_data.get("groups")] 20 | return cleaned_data -------------------------------------------------------------------------------- /wazimap_ng/datasets/models/group.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.contrib.postgres.fields import JSONField 3 | from django.db.models.fields import BooleanField 4 | 5 | from .dataset import Dataset 6 | from wazimap_ng.general.models import BaseModel, SimpleHistory 7 | 8 | class Group(BaseModel, SimpleHistory): 9 | name = models.CharField(max_length=100, blank=False, null=False) 10 | dataset = models.ForeignKey(Dataset, null=True, on_delete=models.CASCADE) 11 | subindicators = JSONField(blank=True, default=list) 12 | can_aggregate = BooleanField(default=True) 13 | can_filter = BooleanField(default=True) 14 | 15 | def __str__(self): 16 | return f"{self.dataset.name}|{self.name}" 17 | 18 | class Meta: 19 | verbose_name = "SubindicatorsGroup" 20 | ordering = ("name",) 21 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-19 19:51 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | initial = True 10 | 11 | dependencies = [ 12 | ('datasets', '0045_auto_20200319_1946'), 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='Logo', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('logo', models.ImageField(upload_to='logos/')), 21 | ('profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='datasets.Profile')), 22 | ], 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v2.3.0 4 | hooks: 5 | - id: check-added-large-files 6 | - id: check-json 7 | - id: check-yaml 8 | - id: end-of-file-fixer 9 | exclude: (^.*\b(migrations)\b.*$|^.*\b(__init__)\b.*$) 10 | - id: pretty-format-json 11 | exclude: Pipfile.lock 12 | - id: trailing-whitespace 13 | exclude: (^.*\b(migrations)\b.*$|^.*\b(__init__)\b.*$) 14 | - repo: https://github.com/PyCQA/isort 15 | rev: 5.5.2 16 | hooks: 17 | - id: isort 18 | exclude: (^.*\b(migrations)\b.*$|^.*\b(__init__)\b.*$) 19 | - repo: https://gitlab.com/pycqa/flake8 20 | rev: '3.8.3' 21 | hooks: 22 | - id: flake8 23 | exclude: (^.*\b(migrations)\b.*$|^.*\b(__init__)\b.*$) 24 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0027_auto_20200624_0311.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-06-24 03:11 2 | 3 | from django.db import migrations, models 4 | import django.utils.timezone 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('boundaries', '0026_auto_20200329_0554'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='geographyboundary', 16 | name='created', 17 | field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), 18 | preserve_default=False, 19 | ), 20 | migrations.AddField( 21 | model_name='geographyboundary', 22 | name='updated', 23 | field=models.DateTimeField(auto_now=True), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0016_auto_20200101_2051.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.9 on 2020-01-01 20:51 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0015_profileindicator_label'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='profileindicator', 16 | name='name', 17 | field=models.CharField(blank=True, max_length=60), 18 | ), 19 | migrations.AlterField( 20 | model_name='profileindicator', 21 | name='universe', 22 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='datasets.Universe'), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0008_auto_20191220_2154.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.9 on 2019-12-20 21:54 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0007_auto_20191220_1323'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='geography', 15 | options={'verbose_name_plural': 'geographies'}, 16 | ), 17 | migrations.AlterModelOptions( 18 | name='indicatorcategory', 19 | options={'verbose_name_plural': 'Indicator Categories'}, 20 | ), 21 | migrations.AlterModelOptions( 22 | name='indicatorsubcategory', 23 | options={'verbose_name_plural': 'Indicator Subcategories'}, 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0056_auto_20200331_1256.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-31 12:56 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0055_metadata'), 11 | ] 12 | 13 | operations = [ 14 | migrations.RenameField( 15 | model_name='metadata', 16 | old_name='license', 17 | new_name='licence', 18 | ), 19 | migrations.AlterField( 20 | model_name='profileindicator', 21 | name='choropleth_method', 22 | field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='profile.ChoroplethMethod'), 23 | preserve_default=False, 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0046_auto_20200822_0812.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-08-22 08:12 2 | 3 | from django.db import migrations 4 | 5 | 6 | def add_decimal_places_to_profile_config(apps, schema_editor): 7 | 8 | Profile = apps.get_model("profile", "Profile") 9 | for profile in Profile.objects.all(): 10 | config = profile.configuration 11 | config["formatting"] = { 12 | 'percentage': '.1%', 13 | 'decimal': ',.2f', 14 | 'integer': ',.2d' 15 | } 16 | profile.configuration = config 17 | profile.save() 18 | 19 | class Migration(migrations.Migration): 20 | 21 | dependencies = [ 22 | ('profile', '0045_auto_20200821_0613'), 23 | ] 24 | 25 | operations = [ 26 | migrations.RunPython(add_decimal_places_to_profile_config), 27 | ] 28 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0018_auto_20200110_0533.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-10 05:33 2 | 3 | import django.contrib.postgres.indexes 4 | import django.contrib.postgres.search 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('datasets', '0017_auto_20200102_0938'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='geography', 17 | name='content_search', 18 | field=django.contrib.postgres.search.SearchVectorField(null=True), 19 | ), 20 | migrations.AddIndex( 21 | model_name='geography', 22 | index=django.contrib.postgres.indexes.GinIndex(fields=['content_search'], name='datasets_ge_content_32188b_gin'), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0004_coordinatefile.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-21 00:51 2 | 3 | import django.core.validators 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('points', '0003_auto_20200110_2056'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='CoordinateFile', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('title', models.CharField(max_length=255)), 19 | ('document', models.FileField(upload_to='points/', validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['csv'])])), 20 | ], 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0068_auto_20200410_1712.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-10 17:12 2 | 3 | from django.db import migrations 4 | 5 | 6 | def forwards(apps, schema_editor): 7 | """ 8 | copy data of Array field subindicator to json field subindicator 9 | """ 10 | profileHighlight = apps.get_model('datasets', 'profileHighlight') 11 | 12 | for highlight in profileHighlight.objects.all(): 13 | if highlight.indicator.subindicators: 14 | highlight.subindicator = 0 15 | highlight.save() 16 | 17 | def backwards(apps, schema_editor): 18 | pass 19 | 20 | class Migration(migrations.Migration): 21 | 22 | dependencies = [ 23 | ('datasets', '0067_auto_20200410_1633'), 24 | ] 25 | 26 | operations = [ 27 | #migrations.RunPython(forwards, backwards), 28 | ] 29 | -------------------------------------------------------------------------------- /wazimap_ng/constants.py: -------------------------------------------------------------------------------- 1 | DENOMINATOR_CHOICES = ( 2 | ('absolute_value', 'Absolute value'), 3 | ('subindicators', 'Sub-indicators'), 4 | ('sibling', 'Sibling'), 5 | ) 6 | 7 | PERMISSION_TYPES = ( 8 | ('private', 'Private'), 9 | ('public', 'Public'), 10 | ) 11 | 12 | 13 | QUANTITATIVE = "quantitative" 14 | QUALITATIVE = "qualitative" 15 | 16 | DATASET_CONTENT_TYPES = ( 17 | ('quantitative', 'Quantitative'), 18 | ('qualitative', 'Qualitative') 19 | ) 20 | 21 | PI_CONTENT_TYPE = ( 22 | ('indicator', 'Indicator'), 23 | ('html', 'HTML') 24 | ) 25 | 26 | PI_CHART_TYPE = ( 27 | ('bar', 'Bar Chart'), 28 | ('line', 'Line Chart') 29 | ) 30 | 31 | PI_CHOROPLETH_RANGE_TYPE = ( 32 | ('by_subindicator', 'By Subindicator'), 33 | ('by_indicator', 'By Indicator') 34 | ) 35 | 36 | STAFF_GROUPS = ["ProfileAdmin", "DataAdmin"] 37 | -------------------------------------------------------------------------------- /wazimap_ng/general/models.py: -------------------------------------------------------------------------------- 1 | from django.contrib.gis.db import models 2 | from simple_history.models import HistoricalRecords 3 | 4 | 5 | class BaseModel(models.Model): 6 | created = models.DateTimeField(auto_now_add=True) 7 | updated = models.DateTimeField(auto_now=True) 8 | 9 | class Meta: 10 | abstract = True 11 | 12 | class SimpleHistory(models.Model): 13 | history = HistoricalRecords( 14 | inherit=True, 15 | history_change_reason_field=models.TextField(null=True) 16 | ) 17 | 18 | class Meta: 19 | abstract = True 20 | 21 | 22 | class MetaData(BaseModel): 23 | source = models.CharField(max_length=60, null=False, blank=True) 24 | description = models.TextField(blank=True) 25 | licence = models.ForeignKey( 26 | 'datasets.Licence', null=True, blank=True, on_delete=models.SET_NULL, 27 | ) -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0032_auto_20200730_1120.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-07-30 11:20 2 | 3 | from django.db import migrations, models 4 | import wazimap_ng.points.models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('points', '0031_auto_20200717_1053'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='location', 16 | name='image', 17 | field=models.ImageField(help_text='Optional image for point', null=True, upload_to=wazimap_ng.points.models.get_file_path), 18 | ), 19 | migrations.AddField( 20 | model_name='location', 21 | name='url', 22 | field=models.CharField(blank=True, help_text='Optional url for this point', max_length=150, null=True), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-20 16:12 2 | 3 | import django.contrib.gis.db.models.fields 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | initial = True 10 | 11 | dependencies = [ 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='Province', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('code', models.CharField(max_length=5)), 20 | ('name', models.CharField(max_length=25)), 21 | ('area', models.FloatField()), 22 | ('geom', django.contrib.gis.db.models.fields.MultiPolygonField(srid=-1)), 23 | ], 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | from django.contrib.gis.db import models 4 | from ..datasets.models import Geography, Version 5 | from .fields import CachedMultiPolygonField 6 | from ..points.models import Location 7 | from django_q.tasks import async_task 8 | from wazimap_ng.general.models import BaseModel 9 | 10 | 11 | class GeographyBoundary(BaseModel): 12 | geography = models.ForeignKey(Geography, on_delete=models.PROTECT, null=False) 13 | version = models.ForeignKey(Version, on_delete=models.PROTECT) 14 | area = models.FloatField() 15 | geom = models.MultiPolygonField(srid=4326, null=True) 16 | geom_cache = CachedMultiPolygonField(field_name="geom") 17 | 18 | class Meta: 19 | constraints = [ 20 | models.UniqueConstraint(fields=["version", "geography"], name="unique_geography_version") 21 | ] 22 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0029_auto_20200206_1122.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-06 11:22 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0028_datasetfile'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='indicatorcategory', 15 | name='description', 16 | field=models.TextField(blank=True), 17 | ), 18 | migrations.AddField( 19 | model_name='indicatorsubcategory', 20 | name='description', 21 | field=models.TextField(blank=True), 22 | ), 23 | migrations.AddField( 24 | model_name='profileindicator', 25 | name='description', 26 | field=models.TextField(blank=True), 27 | ), 28 | ] 29 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0114_auto_20210803_0721.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.21 on 2021-08-03 07:21 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0113_dataset_content_type'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='Version', 15 | fields=[ 16 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('created', models.DateTimeField(auto_now_add=True)), 18 | ('updated', models.DateTimeField(auto_now=True)), 19 | ('name', models.CharField(max_length=255, unique=True)), 20 | ], 21 | options={ 22 | 'abstract': False, 23 | }, 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0005_ward.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-20 17:13 2 | 3 | import django.contrib.gis.db.models.fields 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('boundaries', '0004_municipality'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Ward', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('municipality_code', models.CharField(max_length=25)), 19 | ('wardno', models.CharField(max_length=8)), 20 | ('area', models.FloatField()), 21 | ('geom', django.contrib.gis.db.models.fields.MultiPolygonField(srid=-1)), 22 | ], 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0030_auto_20200206_1308.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-06 13:08 2 | 3 | import django.contrib.postgres.fields.jsonb 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('datasets', '0029_indicatordata'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='indicator', 17 | name='universe', 18 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='datasets.Universe'), 19 | ), 20 | migrations.AlterField( 21 | model_name='indicatordata', 22 | name='data', 23 | field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wazimap_ng.settings") 7 | 8 | try: 9 | from django.core.management import execute_from_command_line 10 | except ImportError: 11 | # The above import may fail for some other reason. Ensure that the 12 | # issue is really that Django is missing to avoid masking other 13 | # exceptions on Python 2. 14 | try: 15 | import django # noqa 16 | except ImportError: 17 | raise ImportError( 18 | "Couldn't import Django. Are you sure it's installed and " 19 | "available on your PYTHONPATH environment variable? Did you " 20 | "forget to activate a virtual environment?" 21 | ) 22 | raise 23 | execute_from_command_line(sys.argv) 24 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0033_auto_20200210_1843.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-10 18:43 2 | 3 | import django.core.validators 4 | from django.db import migrations, models 5 | import wazimap_ng.datasets.models.upload 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('datasets', '0032_auto_20200208_0544'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='datasetfile', 17 | name='document', 18 | field=models.FileField(help_text='\n Uploaded document should be less than 1000.0 MiB in size and \n file extensions should be one of xls, xlsx, csv.\n ', upload_to='datasets/', validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['xls', 'xlsx', 'csv']), wazimap_ng.datasets.models.upload.file_size]), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0045_auto_20200319_1946.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-19 19:46 2 | 3 | import django.core.validators 4 | from django.db import migrations, models 5 | import wazimap_ng.datasets.models.upload 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('datasets', '0044_auto_20200310_2150'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='datasetfile', 17 | name='document', 18 | field=models.FileField(help_text='\n Uploaded document should be less than 3000.0 MiB in size and \n file extensions should be one of xls, xlsx, csv.\n ', upload_to='datasets/', validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['xls', 'xlsx', 'csv']), wazimap_ng.datasets.models.upload.file_size]), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0036_auto_20200928_2255.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.13 on 2020-09-28 22:55 2 | 3 | import django.contrib.postgres.fields.jsonb 4 | from django.db import migrations, models 5 | import wazimap_ng.points.models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('points', '0035_remove_profilecategory_permission_type'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='location', 17 | name='data', 18 | field=django.contrib.postgres.fields.jsonb.JSONField(default=dict), 19 | ), 20 | migrations.AlterField( 21 | model_name='location', 22 | name='image', 23 | field=models.ImageField(blank=True, help_text='Optional image for point', null=True, upload_to=wazimap_ng.points.models.get_file_path), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /wazimap_ng/general/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-28 11:40 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | initial = True 10 | 11 | dependencies = [ 12 | ('datasets', '0087_auto_20200422_0901'), 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='MetaData', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('source', models.CharField(blank=True, max_length=60)), 21 | ('description', models.TextField(blank=True)), 22 | ('licence', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='datasets.Licence')), 23 | ], 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/templatetags/template_tags.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from django import template 4 | import json 5 | 6 | logger = logging.getLogger(__name__) 7 | 8 | register = template.Library() 9 | 10 | @register.filter(name='get_notifications') 11 | def get_messages(session): 12 | messages = session.pop("notifications", []) 13 | 14 | task_list = session.get("task_list", []) 15 | for message in messages: 16 | try: 17 | task_id = message["task_id"] 18 | task_list.remove(task_id) 19 | except (ValueError, KeyError) as e: 20 | logger.info("Error removed a message from the task list. Probably missing.") 21 | 22 | session["task_list"] = task_list 23 | return messages 24 | 25 | @register.filter(name='get_task_list') 26 | def get_task_list(session): 27 | task_list = session.get("task_list", []) 28 | if not task_list: 29 | return [] 30 | return task_list -------------------------------------------------------------------------------- /wazimap_ng/cms/migrations/0002_auto_20210113_1124.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.13 on 2021-01-13 11:24 2 | 3 | from django.db import migrations 4 | 5 | 6 | def collection_group_perms(apps, schema_editor): 7 | 8 | Group = apps.get_model("auth", "Group") 9 | Permission = apps.get_model("auth", "Permission") 10 | 11 | # get groups 12 | profile_admin = Group.objects.get(name="ProfileAdmin") 13 | 14 | # get collection permissions 15 | permissions = Permission.objects.filter( 16 | content_type__app_label="cms", content_type__model="content" 17 | ).values_list("id", flat=True) 18 | 19 | # Remove collection perms from ProfileAdmin group 20 | profile_admin.permissions.add(*permissions) 21 | 22 | class Migration(migrations.Migration): 23 | 24 | dependencies = [ 25 | ('cms', '0001_initial'), 26 | ] 27 | 28 | operations = [ 29 | migrations.RunPython(collection_group_perms), 30 | ] 31 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0048_auto_20200328_1253.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-28 12:53 2 | 3 | import django.core.validators 4 | from django.db import migrations, models 5 | import wazimap_ng.datasets.models.upload 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('datasets', '0047_auto_20200325_1657'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='datasetfile', 17 | name='document', 18 | field=models.FileField(help_text='\n Uploaded document should be less than 3000.0 MiB in size and \n file extensions should be one of xls, xlsx, csv.\n ', upload_to=wazimap_ng.datasets.models.upload.get_file_path, validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['xls', 'xlsx', 'csv']), wazimap_ng.datasets.models.upload.file_size]), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0088_auto_20200501_1258.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-05-01 12:58 2 | 3 | import django.core.validators 4 | from django.db import migrations, models 5 | import wazimap_ng.datasets.models.upload 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('datasets', '0087_auto_20200422_0901'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='datasetfile', 17 | name='document', 18 | field=models.FileField(help_text='\n Uploaded document should be less than 1000.0 MiB in size and \n file extensions should be one of xls, xlsx, csv.\n ', upload_to=wazimap_ng.datasets.models.upload.get_file_path, validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['xls', 'xlsx', 'csv']), wazimap_ng.datasets.models.upload.file_size]), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0109_auto_20200928_2255.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.13 on 2020-09-28 22:55 2 | 3 | import django.core.validators 4 | from django.db import migrations, models 5 | import wazimap_ng.datasets.models.upload 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('datasets', '0108_auto_20200805_1449'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='datasetfile', 17 | name='document', 18 | field=models.FileField(help_text='\n Uploaded document should be less than 3000.0 MiB in size and \n file extensions should be one of xls, xlsx, csv.\n ', upload_to=wazimap_ng.datasets.models.upload.get_file_path, validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['xls', 'xlsx', 'csv']), wazimap_ng.datasets.models.upload.file_size]), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /wazimap_ng/points/migrations/0042_auto_20210507_1117.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.13 on 2021-05-07 11:17 2 | 3 | from django.db import migrations, models 4 | 5 | def reorder_themes(apps, schema_editor): 6 | Theme = apps.get_model("points", "Theme") 7 | order = 0 8 | for item in Theme.objects.all(): 9 | order += 1 10 | item.order = order 11 | item.save() 12 | 13 | def reorder_cateogories(apps, schema_editor): 14 | Category = apps.get_model("points", "ProfileCategory") 15 | order = 0 16 | for item in Category.objects.all(): 17 | order += 1 18 | item.order = order 19 | item.save() 20 | 21 | class Migration(migrations.Migration): 22 | 23 | dependencies = [ 24 | ('points', '0041_profilecategory_attributes'), 25 | ] 26 | 27 | operations = [ 28 | migrations.RunPython(reorder_themes), 29 | migrations.RunPython(reorder_cateogories), 30 | ] 31 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0020_auto_20200419_0559.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-19 05:59 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0019_profilekeymetrics_label'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='profilekeymetrics', 15 | name='denominator', 16 | field=models.CharField(choices=[('absolute_value', 'Absolute value'), ('subindicators', 'Sub-indicators'), ('sibling', 'Sibling')], help_text='Method for calculating the denominator that will normalise this value.', max_length=32), 17 | ), 18 | migrations.AlterField( 19 | model_name='profilekeymetrics', 20 | name='label', 21 | field=models.CharField(help_text='Text used for display to users.', max_length=100), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0053_auto_20220719_1512.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.28 on 2022-07-19 15:12 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('profile', '0052_auto_20220711_0723'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='historicalprofileindicator', 15 | name='choropleth_range', 16 | field=models.CharField(choices=[('by_subindicator', 'By Subindicator'), ('by_indicator', 'By Indicator')], default='by_subindicator', max_length=32), 17 | ), 18 | migrations.AddField( 19 | model_name='profileindicator', 20 | name='choropleth_range', 21 | field=models.CharField(choices=[('by_subindicator', 'By Subindicator'), ('by_indicator', 'By Indicator')], default='by_subindicator', max_length=32), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | 3 | 4 | ## Related Issue 5 | 6 | ## How to test it locally 7 | 8 | ## Changelog 9 | 10 | ### Added 11 | 12 | ### Updated 13 | 14 | ### Removed 15 | 16 | 17 | ## Checklist 18 | 19 | - [ ] 🚀 is the code ready to be merged and go live? 20 | - [ ] 🛠 does it work (build) locally 21 | 22 | ### Pull Request 23 | 24 | - [ ] 📰 good title 25 | - [ ] 📝good description 26 | - [ ] 🔖 issue linked 27 | - [ ] 📖 changelog filled out 28 | 29 | ### Commits 30 | 31 | - [ ] commits are clean 32 | - [ ] commit messages are clean 33 | 34 | ### Code Quality 35 | 36 | - [ ] 🚧 no commented out code 37 | - [ ] 🖨 no unnecessary logging 38 | - [ ] 🎱 no magic numbers 39 | - [ ] black was run locally (as part of the pre-commit hook) 40 | 41 | ### Testing 42 | 43 | - [ ] ✅ added (appropriate) unit tests 44 | - [ ] 💢 edge cases in tests were considered 45 | - [ ] ✅ ran tests locally & are passing 46 | -------------------------------------------------------------------------------- /wazimap_ng/points/services/locations.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from wazimap_ng.points.models import Location, Category, ProfileCategory 4 | from wazimap_ng.profile.models import Profile 5 | from wazimap_ng.datasets.models import Geography, Version 6 | from wazimap_ng.boundaries.models import GeographyBoundary 7 | 8 | logger = logging.getLogger(__name__) 9 | 10 | def get_locations( 11 | queryset, profile, category=None, geography_code=None, version_name=None 12 | ): 13 | geography = None 14 | 15 | if category is not None: 16 | queryset = queryset.filter(category=category) 17 | 18 | if geography_code is not None: 19 | version = Version.objects.get(name=version_name) 20 | boundary = GeographyBoundary.objects.get(geography__code=geography_code, version=version) 21 | geography = boundary.geography 22 | 23 | queryset = queryset.filter(coordinates__within=boundary.geom) 24 | return queryset 25 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/models/indicatordata.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.contrib.postgres.fields import JSONField 3 | 4 | from .indicator import Indicator 5 | from .geography import Geography 6 | from wazimap_ng.general.models import BaseModel 7 | 8 | 9 | class IndicatorData(BaseModel): 10 | """ 11 | Indicator Data for caching results of indicator group according to 12 | geography. 13 | """ 14 | 15 | indicator = models.ForeignKey( 16 | Indicator, on_delete=models.CASCADE, verbose_name="variable" 17 | ) 18 | geography = models.ForeignKey(Geography, on_delete=models.CASCADE) 19 | data = JSONField(default=dict, null=True, blank=True) 20 | 21 | def __str__(self): 22 | return f"{self.geography} - {self.indicator.name}" 23 | 24 | class Meta: 25 | verbose_name_plural = "Indicator Data items" 26 | unique_together = ( 27 | "indicator", 28 | "geography", 29 | ) 30 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0116_auto_20210803_2049.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.21 on 2021-08-03 20:49 2 | 3 | import django.contrib.postgres.fields.jsonb 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('datasets', '0114_create_versions_auto_20210818_0900'), 12 | ] 13 | #run_before = [('boundaries', '0028_auto_20210803_2050'),] 14 | 15 | operations = [ 16 | migrations.AddField( 17 | model_name='geographyhierarchy', 18 | name='configuration', 19 | field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict), 20 | ), 21 | migrations.AddField( 22 | model_name='dataset', 23 | name='version', 24 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='datasets.Version', null=True), 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /tests/points/factoryboy.py: -------------------------------------------------------------------------------- 1 | import factory 2 | 3 | from tests.profile.factoryboy import ProfileFactory 4 | from wazimap_ng.points import models 5 | 6 | 7 | class ThemeFactory(factory.django.DjangoModelFactory): 8 | class Meta: 9 | model = models.Theme 10 | 11 | profile = factory.SubFactory(ProfileFactory) 12 | 13 | class CategoryFactory(factory.django.DjangoModelFactory): 14 | class Meta: 15 | model = models.Category 16 | 17 | profile = factory.SubFactory(ProfileFactory) 18 | 19 | 20 | class LocationFactory(factory.django.DjangoModelFactory): 21 | class Meta: 22 | model = models.Location 23 | 24 | category = factory.SubFactory(CategoryFactory) 25 | 26 | class ProfileCategory(factory.django.DjangoModelFactory): 27 | class Meta: 28 | model = models.ProfileCategory 29 | 30 | theme = factory.SubFactory(ThemeFactory) 31 | category = factory.SubFactory(CategoryFactory) 32 | profile = factory.SubFactory(ProfileFactory) 33 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "dokku": { 4 | "predeploy": "/app/scripts/django/predeploy.sh" 5 | } 6 | }, 7 | "stack": "container", 8 | "environments": { 9 | "review": { 10 | "addons": ["heroku-postgresql:mini"], 11 | "env": { 12 | "DJANGO_CONFIGURATION": "Production", 13 | "DJANGO_DEBUG": "False", 14 | "DJANGO_SECRET_KEY": "not-so-secret-in-review", 15 | "RUN_COLLECTSTATIC": "Yes", 16 | "RUN_GUNICORN": "Yes", 17 | "RUN_MIGRATIONS": "Yes", 18 | "RUN_QCLUSTER": "Yes", 19 | "SERVER_INSTANCE": "review" 20 | }, 21 | "formation": { 22 | "web": { 23 | "quantity": 1, 24 | "size": "eco" 25 | }, 26 | "worker": { 27 | "quantity": 1, 28 | "size": "eco" 29 | } 30 | }, 31 | "scripts": { 32 | "postdeploy": "python manage.py migrate && python manage.py loaddata demodata" 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0009_auto_20200406_1849.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-06 12:48 2 | 3 | from django.db import migrations 4 | 5 | 6 | def forwards(apps, schema_editor): 7 | """ 8 | create initial data for Licence model 9 | """ 10 | ProfileIndicator = apps.get_model('datasets', 'profileIndicator') 11 | ProfileKeyMetrics = apps.get_model('profile', 'ProfileKeyMetrics') 12 | 13 | for pi in ProfileIndicator.objects.filter(key_metric=True): 14 | ProfileKeyMetrics.objects.create( 15 | variable=pi.indicator, 16 | subcategory=pi.subcategory, 17 | subindicator=0, 18 | denominator='absolute_value' 19 | ) 20 | 21 | 22 | def backwards(apps, schema_editor): 23 | pass 24 | 25 | 26 | class Migration(migrations.Migration): 27 | 28 | dependencies = [ 29 | ('profile', '0008_profilekeymetrics'), 30 | ] 31 | 32 | operations = [ 33 | migrations.RunPython(forwards, backwards) 34 | ] -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0013_universe.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.9 on 2020-01-01 15:36 2 | 3 | import django.contrib.postgres.fields.jsonb 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('datasets', '0012_profileindicator_key_metric'), 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='Universe', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('filters', django.contrib.postgres.fields.jsonb.JSONField()), 20 | ('name', models.CharField(max_length=50)), 21 | ('label', models.CharField(max_length=100)), 22 | ('dataset', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='datasets.Dataset')), 23 | ], 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0029_indicatordata.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-02-05 11:05 2 | 3 | import django.contrib.postgres.fields.jsonb 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('datasets', '0028_datasetfile'), 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='IndicatorData', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('data', django.contrib.postgres.fields.jsonb.JSONField(default=dict)), 20 | ('geography', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='datasets.Geography')), 21 | ('indicator', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='datasets.Indicator')), 22 | ], 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0010_auto_20200121_1041.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-21 10:41 2 | 3 | import django.contrib.gis.db.models.fields 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('boundaries', '0009_auto_20200121_0954'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='district', 16 | name='geom', 17 | field=django.contrib.gis.db.models.fields.MultiPolygonField(srid=-4326), 18 | ), 19 | migrations.AlterField( 20 | model_name='municipality', 21 | name='geom', 22 | field=django.contrib.gis.db.models.fields.MultiPolygonField(srid=-4326), 23 | ), 24 | migrations.AlterField( 25 | model_name='ward', 26 | name='geom', 27 | field=django.contrib.gis.db.models.fields.MultiPolygonField(srid=-4326), 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /wazimap_ng/boundaries/migrations/0011_auto_20200121_1152.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-21 11:52 2 | 3 | import django.contrib.gis.db.models.fields 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('boundaries', '0010_auto_20200121_1041'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='district', 16 | name='geom', 17 | field=django.contrib.gis.db.models.fields.MultiPolygonField(srid=4326), 18 | ), 19 | migrations.AlterField( 20 | model_name='municipality', 21 | name='geom', 22 | field=django.contrib.gis.db.models.fields.MultiPolygonField(srid=4326), 23 | ), 24 | migrations.AlterField( 25 | model_name='ward', 26 | name='geom', 27 | field=django.contrib.gis.db.models.fields.MultiPolygonField(srid=4326), 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0019_auto_20200110_0535.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.8 on 2020-01-10 05:35 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('datasets', '0018_auto_20200110_0533'), 10 | ] 11 | 12 | migration = ''' 13 | CREATE TRIGGER geography_content_search_update BEFORE INSERT OR UPDATE 14 | ON datasets_geography FOR EACH ROW EXECUTE PROCEDURE 15 | tsvector_update_trigger( 16 | content_search, 'pg_catalog.english', 17 | name, code 18 | ); 19 | 20 | -- Force triggers to run and populate the text_search column. 21 | UPDATE datasets_geography set ID = ID; 22 | ''' 23 | 24 | reverse_migration = ''' 25 | DROP TRIGGER content_search ON datasets_geography; 26 | ''' 27 | 28 | operations = [ 29 | # No longer being used 30 | 31 | #migrations.RunSQL(migration, reverse_migration) 32 | ] 33 | 34 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0005_auto_20200330_2005.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-03-30 20:05 2 | 3 | from django.db import migrations 4 | 5 | def create_choropleth_methods(apps, schema_editor): 6 | choropleth_method = apps.get_model('profile', 'ChoroplethMethod') 7 | methods = [ 8 | ("sibling", "Choropleths are calculated using the sum of values of sibling geographies as the denominator. This is useful when comparing one geography with its siblings."), 9 | ("subindicator", "Calculated using the sum of values of subindicators as the denominator. This is useful for presenting a per capita value.") 10 | ] 11 | 12 | for (name, description) in methods: 13 | choropleth_method.objects.create(name=name, description=description) 14 | 15 | class Migration(migrations.Migration): 16 | 17 | dependencies = [ 18 | ('profile', '0004_auto_20200330_2004'), 19 | ] 20 | 21 | operations = [ 22 | migrations.RunPython(create_choropleth_methods) 23 | ] 24 | -------------------------------------------------------------------------------- /wazimap_ng/profile/migrations/0024_auto_20200420_1227.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2020-04-20 12:27 2 | 3 | from django.db import migrations 4 | 5 | def prepopulate_category_order(apps, schema_editor): 6 | IndicatorCategory = apps.get_model("profile", "IndicatorCategory") 7 | for idx, category in enumerate(IndicatorCategory.objects.all()): 8 | category.order = idx 9 | category.save() 10 | 11 | def prepopulate_subcategory_order(apps, schema_editor): 12 | IndicatorSubcategory = apps.get_model("profile", "IndicatorSubcategory") 13 | for idx, subcategory in enumerate(IndicatorSubcategory.objects.all()): 14 | subcategory.order = idx 15 | subcategory.save() 16 | 17 | class Migration(migrations.Migration): 18 | 19 | dependencies = [ 20 | ('profile', '0023_auto_20200420_1211'), 21 | ] 22 | 23 | operations = [ 24 | migrations.RunPython(prepopulate_category_order), 25 | migrations.RunPython(prepopulate_subcategory_order), 26 | ] 27 | -------------------------------------------------------------------------------- /wazimap_ng/datasets/migrations/0121_auto_20211007_1056.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.24 on 2021-10-07 10:56 2 | 3 | from django.db import migrations, models 4 | import tinymce.models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('datasets', '0120_auto_20210817_1005'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='dataset', 16 | name='content_type', 17 | field=models.CharField(choices=[('quantitative', 'Quantitative'), ('qualitative', 'Qualitative')], default='quantitative', max_length=32), 18 | ), 19 | migrations.AlterField( 20 | model_name='geographyhierarchy', 21 | name='description', 22 | field=tinymce.models.HTMLField(blank=True), 23 | ), 24 | migrations.AlterField( 25 | model_name='metadata', 26 | name='description', 27 | field=tinymce.models.HTMLField(blank=True), 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /tests/datasets/management/test_reprocess_indicators.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from django.core.management import call_command 3 | from django_q.models import Task 4 | from wazimap_ng.datasets.models import Indicator 5 | from wazimap_ng.datasets.management.commands import reprocess_indicators 6 | 7 | @pytest.mark.django_db 8 | @pytest.mark.usefixtures("indicator") 9 | class TestReprocessIndicators: 10 | 11 | def test_reprocess_indicators(self): 12 | args = [] 13 | opts = {} 14 | assert Task.objects.filter(success=True).count() == 0 15 | assert Indicator.objects.count() == 1 16 | indicator_obj = Indicator.objects.first() 17 | 18 | reprocess_indicators.input = lambda x: 'yes' 19 | call_command('reprocess_indicators', *args, **opts) 20 | 21 | assert Task.objects.filter(success=True).count() == 1 22 | task = Task.objects.filter(success=True).first() 23 | assert task.args[0] == indicator_obj 24 | assert task.kwargs["type"] == "data_extraction" 25 | 26 | 27 | --------------------------------------------------------------------------------