-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from amitness/dev
Present total population and population by gender
- Loading branch information
Showing
8 changed files
with
1,797 additions
and
11 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from collections import OrderedDict | ||
|
||
|
||
from wazimap.data.tables import get_datatable, get_model_from_fields | ||
from wazimap.data.utils import get_stat_data, get_objects_by_geo, \ | ||
calculate_median | ||
|
||
|
||
def get_demographics_profile(geo_code, geo_level, session): | ||
demographic_data = { | ||
"is_vdc": True, | ||
"has_data": True | ||
} | ||
pop_data, total_pop = get_stat_data( | ||
'sex', geo_level, geo_code, session, | ||
table_fields=['sex'], | ||
table_name='population') | ||
demographic_data['pop_dist'] = pop_data | ||
demographic_data['total_population'] = { | ||
"name": "People", | ||
"values": {"this": total_pop} | ||
} | ||
return demographic_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from wazimap.data.tables import FieldTable, SimpleTable | ||
|
||
FieldTable(['sex'], | ||
id='population', | ||
universe='Population', | ||
description='Total Population', | ||
dataset='National Population and Housing Census 2011', | ||
year='2011', | ||
table_per_level=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<article id="demographics" class="clearfix"> | ||
{% if demographics.area_has_data == False %} | ||
<h2>No data available for this area</h2> | ||
{% else %} | ||
<header class="section-contents"> | ||
<h1>Demographics</h1> | ||
</header> | ||
<div class="section-container"> | ||
<section class="clearfix stat-row"> | ||
<h2><a class="permalink" href="#demographics">Population <i | ||
class="fa fa-link"></i></a></h2> | ||
<div class="column-quarter"> | ||
{% include 'profile/_blocks/_stat_list.html' with stat=demographics.total_population stat_type='number' %} | ||
</div> | ||
<div class="column-three-quarters" id="chart-pie-demographics-pop_dist" data-stat-type="percentage" data-chart-title="Sex"></div> | ||
</section> | ||
|
||
</div> | ||
{% endif %} | ||
</article> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from wazimap.urls import urlpatterns, STANDARD_CACHE_TIME | ||
from django.conf.urls import url | ||
from wazimap.views import GeographyDetailView | ||
from django.views.decorators.cache import cache_page | ||
|
||
profile_url_index = 3 | ||
|
||
urlpatterns.pop(profile_url_index) | ||
|
||
urlpatterns.append( | ||
url( | ||
regex = '^profiles/(?P<geography_id>\w+-\w+-\w+)(-(?P<slug>[\w-]+))?/$', | ||
view = cache_page(STANDARD_CACHE_TIME)(GeographyDetailView.as_view()), | ||
kwargs = {}, | ||
name = 'geography_detail_country', | ||
) | ||
) |