Skip to content

Commit 10e8120

Browse files
re arrage form charts
1 parent 966c23a commit 10e8120

File tree

2 files changed

+136
-122
lines changed

2 files changed

+136
-122
lines changed

hurumap_ng/profiles.py

Lines changed: 72 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -73,59 +73,6 @@ def get_profile(geo, profile_name, request):
7373
table_fields=None, table_name=None, **kwargs
7474
"""
7575

76-
def get_nbs_2018(geo, session, year):
77-
mobile_subscription = LOCATIONNOTFOUND
78-
mineral_production = LOCATIONNOTFOUND
79-
hiv_patients = LOCATIONNOTFOUND
80-
telecom_subscription = LOCATIONNOTFOUND
81-
faac = LOCATIONNOTFOUND
82-
jamb = LOCATIONNOTFOUND
83-
debt_data = LOCATIONNOTFOUND
84-
85-
86-
with dataset_context(year='2018'):
87-
try:
88-
debt_data, _ = get_stat_data(fields=['year', 'debt_type'], geo=geo,
89-
session=session,
90-
percent=False, order_by='debt_type')
91-
mobile_subscription, _ = get_stat_data(fields=['network', 'subscription_type'], geo=geo,
92-
session=session,
93-
table_name='mobile_subscription', percent=False)
94-
mineral_production, _ = get_stat_data(fields=['year'], geo=geo,
95-
session=session,
96-
table_name='mineral_production', percent=False, order_by='year')
97-
telecom_subscription, _ = get_stat_data(fields=['period', 'subscription_type'], geo=geo,
98-
session=session,
99-
table_name='telecom_subscription', percent=False)
100-
faac, _ = get_stat_data(fields=['allocation'], geo=geo,
101-
session=session,
102-
table_name='faac', percent=False)
103-
jamb, _ = get_stat_data(fields=['year', 'gender'], geo=geo,
104-
session=session,
105-
table_name='jamb', percent=False)
106-
107-
except Exception as e:
108-
print(str(e))
109-
110-
is_missing = mobile_subscription.get('is_missing') and \
111-
mineral_production.get('is_missing') and \
112-
telecom_subscription.get('is_missing') and \
113-
faac.get('is_missing') and jamb.get('is_missing') and \
114-
debt_data.get('is_missing')
115-
116-
final_data = {
117-
'is_missing': is_missing,
118-
'mobile_subscription': mobile_subscription,
119-
'mineral_production': mineral_production,
120-
'telecom_subscription': telecom_subscription,
121-
'debt_data': debt_data,
122-
'faac': faac,
123-
'jamb': jamb
124-
125-
}
126-
return final_data
127-
128-
12976
def get_demographics_profile(geo, session):
13077
compiled_indeces = LOCATIONNOTFOUND
13178
birth_registration = LOCATIONNOTFOUND
@@ -470,6 +417,7 @@ def get_health_profile(geo, session):
470417
contraceptive_use = LOCATIONNOTFOUND
471418
vaccine_coverage = LOCATIONNOTFOUND
472419
hiv_arvs = LOCATIONNOTFOUND
420+
fertility_rate = LOCATIONNOTFOUND
473421

474422
with dataset_context(year='2016'):
475423
try:
@@ -534,7 +482,8 @@ def get_health_profile(geo, session):
534482
adolescent_fertility.get('is_missing') and \
535483
contraceptive_use.get('is_missing') and \
536484
vaccine_coverage.get('is_missing') and \
537-
hiv_arvs.get('is_missing')
485+
hiv_arvs.get('is_missing') and \
486+
fertility_rate.get('is_missing')
538487

539488
final_data = {
540489
'is_missing': is_missing,
@@ -544,7 +493,8 @@ def get_health_profile(geo, session):
544493
'adolescent_fertility': adolescent_fertility,
545494
'contraceptive_use': contraceptive_use,
546495
'vaccine_coverage': vaccine_coverage,
547-
'hiv_arvs': hiv_arvs
496+
'hiv_arvs': hiv_arvs,
497+
'fertility_rate': fertility_rate
548498
}
549499
return final_data
550500

@@ -565,6 +515,10 @@ def get_others_profile(geo, session):
565515
air_transportation_international = LOCATIONNOTFOUND
566516
diesel_year = LOCATIONNOTFOUND
567517
driver_licences_processed = LOCATIONNOTFOUND
518+
mobile_subscription = LOCATIONNOTFOUND
519+
mineral_production = LOCATIONNOTFOUND
520+
telecom_subscription = LOCATIONNOTFOUND
521+
jamb = LOCATIONNOTFOUND
568522

569523
with dataset_context(year='2018'):
570524
try:
@@ -683,6 +637,38 @@ def get_others_profile(geo, session):
683637
print(str(e))
684638
pass
685639

640+
try:
641+
mobile_subscription, _ = get_stat_data(fields=['network', 'subscription_type'], geo=geo,
642+
session=session,
643+
table_name='mobile_subscription', percent=False)
644+
except Exception as e:
645+
print(str(e))
646+
pass
647+
648+
try:
649+
mineral_production, _ = get_stat_data(fields=['year'], geo=geo,
650+
session=session,
651+
table_name='mineral_production', percent=False, order_by='year')
652+
except Exception as e:
653+
print(str(e))
654+
pass
655+
656+
try:
657+
telecom_subscription, _ = get_stat_data(fields=['period', 'subscription_type'], geo=geo,
658+
session=session,
659+
table_name='telecom_subscription', percent=False)
660+
except Exception as e:
661+
print(str(e))
662+
pass
663+
664+
try:
665+
jamb, _ = get_stat_data(fields=['year', 'gender'], geo=geo,
666+
session=session,
667+
table_name='jamb', percent=False)
668+
except Exception as e:
669+
print(str(e))
670+
pass
671+
686672
diesel_price = {
687673
'is_missing': diesel_price_2019.get('is_missing') and \
688674
diesel_price_2018.get('is_missing') and \
@@ -721,14 +707,20 @@ def get_others_profile(geo, session):
721707
'air_transportation_domestic': air_transportation_domestic,
722708
'air_transportation_international': air_transportation_international,
723709
'diesel_year': diesel_year,
724-
'driver_licences_processed': driver_licences_processed
710+
'driver_licences_processed': driver_licences_processed,
711+
'mobile_subscription': mobile_subscription,
712+
'mineral_production': mineral_production,
713+
'telecom_subscription': telecom_subscription,
714+
'jamb': jamb
725715
}
726716
return final_data
727717

728718

729719
def get_finance_profile(geo, session):
730720
bank_credit = LOCATIONNOTFOUND
731721
bank_deposit = LOCATIONNOTFOUND
722+
debt_data = LOCATIONNOTFOUND
723+
faac = LOCATIONNOTFOUND
732724

733725
with dataset_context(year='2018'):
734726
try:
@@ -747,13 +739,35 @@ def get_finance_profile(geo, session):
747739
print(str(e))
748740
pass
749741

742+
try:
743+
debt_data, _ = get_stat_data(fields=['year', 'debt_type'], geo=geo,
744+
session=session,
745+
percent=False, order_by='debt_type')
746+
except Exception as e:
747+
print(str(e))
748+
pass
749+
750+
try:
751+
faac, _ = get_stat_data(fields=['allocation'], geo=geo,
752+
session=session,
753+
table_name='faac', percent=False)
754+
except Exception as e:
755+
print(str(e))
756+
pass
757+
758+
759+
750760
is_missing = bank_deposit.get('is_missing') and \
751-
bank_credit.get('is_missing')
761+
bank_credit.get('is_missing') and \
762+
debt_data.get('is_missing') and \
763+
faac.get('is_missing')
752764

753765
final_data = {
754766
'is_missing': is_missing,
755767
'bank_credit': bank_credit,
756-
'bank_deposit': bank_deposit
768+
'bank_deposit': bank_deposit,
769+
'debt_data': debt_data,
770+
'faac': faac
757771
}
758772

759773
return final_data

hurumap_ng/templates/profile/profile_detail.html

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -367,69 +367,6 @@ <h3 class="chart-header">Corruption Index</h3>
367367
</div>
368368
</section>
369369
{% endif %}
370-
<!-- {% if not nbs_2018.mineral_production.is_missing %}
371-
<section class="clearfix stat-row">
372-
<div class="column-full">
373-
<div id="chart-column-nbs_2018-mineral_production"
374-
data-chart-title="Mineral Production 2016 - 2018"
375-
data-stat-type="number"
376-
data-source-title="National Bureau of Statistics, 2018"
377-
data-source-link="https://nigerianstat.gov.ng/download/614"></div>
378-
</div>
379-
</section>
380-
{% endif %}
381-
{% if not nbs_2018.mobile_subscription.is_missing %}
382-
<section class="clearfix stat-row">
383-
<div class="column-full">
384-
<div id="chart-grouped_column-nbs_2018-mobile_subscription"
385-
data-chart-title="Telecoms Subscriptions by Mobile GSM and State Q4 2018"
386-
data-stat-type="number"
387-
data-source-title="National Bureau of Statistics, 2018"
388-
data-source-link="https://nigerianstat.gov.ng/download/614"></div>
389-
</div>
390-
</section>
391-
{% endif %}
392-
{% if not nbs_2018.debt_data.is_missing %}
393-
<section class="clearfix stat-row">
394-
<div class="column-full">
395-
<div id="chart-grouped_column-nbs_2018-debt_data"
396-
data-chart-title="External and Domestic Debt 2011 - June 2018 in ₦" data-stat-type="number"></div>
397-
</div>
398-
</section>
399-
{% endif %}
400-
{% if not nbs_2018.faac.is_missing %}
401-
<section class="clearfix stat-row">
402-
<div class="column-full">
403-
<div id="chart-column-nbs_2018-faac"
404-
data-chart-title="Federation Account Allocation Committee (FAAC) Allocation for January 2019 in Million ₦"
405-
data-stat-type="number"
406-
data-source-title="National Bureau of Statistics, 2019"
407-
data-source-link="https://nigerianstat.gov.ng/download/614"></div>
408-
</div>
409-
</section>
410-
{% endif %}
411-
{% if not nbs_2018.telecom_subscription.is_missing %}
412-
<section class="clearfix stat-row">
413-
<div class="column-full">
414-
<div id="chart-grouped_column-nbs_2018-telecom_subscription"
415-
data-chart-title="Telecoms Subscriptions 2018"
416-
data-stat-type="number"
417-
data-source-title="National Bureau of Statistics, 2018"
418-
data-source-link="https://nigerianstat.gov.ng/download/614"></div>
419-
</div>
420-
</section>
421-
{% endif %}
422-
{% if not nbs_2018.jamb.is_missing %}
423-
<section class="clearfix stat-row">
424-
<div class="column-full">
425-
<div id="chart-grouped_column-nbs_2018-jamb"
426-
data-chart-title="Telecoms Subscriptions 2018"
427-
data-stat-type="number"
428-
data-source-title="National Bureau of Statistics, 2018"
429-
data-source-link="https://nigerianstat.gov.ng/download/614"></div>
430-
</div>
431-
</section>
432-
{% endif %} -->
433370
</div>
434371
</article>
435372
{% endif %}
@@ -557,14 +494,77 @@ <h3 class="chart-header">Corruption Index</h3>
557494
{% endif %}
558495
</section>
559496
{% endif %}
497+
{% if not finance.debt_data.is_missing %}
498+
<section class="clearfix stat-row">
499+
<div class="column-full">
500+
<div id="chart-grouped_column-finance-debt_data"
501+
data-chart-title="External and Domestic Debt 2011 - June 2018 in ₦" data-stat-type="number"></div>
502+
</div>
503+
</section>
504+
{% endif %}
505+
{% if not finance.faac.is_missing %}
506+
<section class="clearfix stat-row">
507+
<div class="column-full">
508+
<div id="chart-column-finance-faac"
509+
data-chart-title="Federation Account Allocation Committee (FAAC) Allocation for January 2019 in Million ₦"
510+
data-stat-type="number"
511+
data-source-title="National Bureau of Statistics, 2019"
512+
data-source-link="https://nigerianstat.gov.ng/download/614"></div>
513+
</div>
514+
</section>
515+
{% endif %}
560516
</div>
561517
</article>
562518
{% endif %}
563519
{% if not others.is_missing %}
564520
<article id="transportation" class="clearfix">
565521
<header class="section-contents"><h1>Others</h1></header>
566522
<div class="section-container">
567-
{% if not false %}
523+
{% if not others.mineral_production.is_missing %}
524+
<section class="clearfix stat-row">
525+
<div class="column-full">
526+
<div id="chart-column-others-mineral_production"
527+
data-chart-title="Mineral Production 2016 - 2018"
528+
data-stat-type="number"
529+
data-source-title="National Bureau of Statistics, 2018"
530+
data-source-link="https://nigerianstat.gov.ng/download/614"></div>
531+
</div>
532+
</section>
533+
{% endif %}
534+
{% if not others.mobile_subscription.is_missing %}
535+
<section class="clearfix stat-row">
536+
<div class="column-full">
537+
<div id="chart-grouped_column-others-mobile_subscription"
538+
data-chart-title="Telecoms Subscriptions by Mobile GSM and State Q4 2018"
539+
data-stat-type="number"
540+
data-source-title="National Bureau of Statistics, 2018"
541+
data-source-link="https://nigerianstat.gov.ng/download/614"></div>
542+
</div>
543+
</section>
544+
{% endif %}
545+
{% if not others.telecom_subscription.is_missing %}
546+
<section class="clearfix stat-row">
547+
<div class="column-full">
548+
<div id="chart-grouped_column-others-telecom_subscription"
549+
data-chart-title="Telecoms Subscriptions 2018"
550+
data-stat-type="number"
551+
data-source-title="National Bureau of Statistics, 2018"
552+
data-source-link="https://nigerianstat.gov.ng/download/614"></div>
553+
</div>
554+
</section>
555+
{% endif %}
556+
{% if not others.jamb.is_missing %}
557+
<section class="clearfix stat-row">
558+
<div class="column-full">
559+
<div id="chart-grouped_column-others-jamb"
560+
data-chart-title="Telecoms Subscriptions 2018"
561+
data-stat-type="number"
562+
data-source-title="National Bureau of Statistics, 2018"
563+
data-source-link="https://nigerianstat.gov.ng/download/614"></div>
564+
</div>
565+
</section>
566+
{% endif %}
567+
{% if not others.driver_licences_processed %}
568568
<section class="clearfix stat-row">
569569
<div class="column-full">
570570
<div id="chart-column-others-driver_licences_processed"

0 commit comments

Comments
 (0)