Skip to content

Commit a6ed4a9

Browse files
Merge pull request #226 from CodeForAfrica/fix-nav
[TZ][Bug] Fix Navigation (Profile) Tabs
2 parents 838f6f7 + 35550f7 commit a6ed4a9

File tree

2 files changed

+260
-294
lines changed

2 files changed

+260
-294
lines changed

hurumap_tz/profiles/census.py

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,15 @@ def get_households_profile(geo, session):
349349
# construction materials
350350
roofing_dist, _ = get_stat_data(
351351
'main type of roofing material', geo=geo, session=session,
352-
order_by='-total')
352+
order_by='total')
353353

354354
wall_dist, _ = get_stat_data(
355355
'main type of wall material', geo=geo, session=session,
356-
order_by='-total')
356+
order_by='total')
357357

358358
floor_dist, _ = get_stat_data(
359359
'main type of floor material', geo=geo, session=session,
360-
order_by='-total')
360+
order_by='total')
361361
except Exception:
362362
pass
363363

@@ -852,22 +852,37 @@ def get_causes_of_death_profile(geo, session):
852852
try:
853853
causes_of_death_under_five_data, _ = get_stat_data(
854854
'causes of death under five', geo=geo, session=session,
855-
order_by='-total')
855+
order_by='total')
856+
except Exception:
857+
pass
858+
try:
856859
causes_of_death_over_five_data, _ = get_stat_data(
857860
'causes of death over five', geo=geo, session=session,
858-
order_by='-total')
861+
order_by='total')
862+
except Exception:
863+
pass
864+
try:
859865
inpatient_diagnosis_over_five_data, _ = get_stat_data(
860866
'inpatient diagnosis over five', geo=geo, session=session,
861-
order_by='-total')
867+
order_by='total')
868+
except Exception:
869+
pass
870+
try:
862871
outpatient_diagnosis_over_five_data, _ = get_stat_data(
863872
'outpatient diagnosis over five', geo=geo, session=session,
864-
order_by='-total')
873+
order_by='total')
874+
except Exception:
875+
pass
876+
try:
865877
inpatient_diagnosis_under_five_data, _ = get_stat_data(
866878
'inpatient diagnosis under five', geo=geo, session=session,
867-
order_by='-total')
879+
order_by='total')
880+
except Exception:
881+
pass
882+
try:
868883
outpatient_diagnosis_under_five_data, _ = get_stat_data(
869884
'outpatient diagnosis under five', geo=geo, session=session,
870-
order_by='-total')
885+
order_by='total')
871886
except Exception:
872887
pass
873888

@@ -905,7 +920,7 @@ def get_family_planning_clients_profile(geo, session):
905920
try:
906921
family_planning_clients_data, _ = get_stat_data(
907922
'family planning clients', geo=geo, session=session,
908-
order_by='-total')
923+
order_by='total')
909924
total = family_planning_clients_data['Total']['numerators']['this']
910925
rate = \
911926
family_planning_clients_data['New client rate']['numerators'][
@@ -963,7 +978,7 @@ def get_place_of_delivery_profile(geo, session):
963978
try:
964979
delivery_data, _ = get_stat_data(
965980
'place of delivery', geo=geo, session=session,
966-
order_by='-total')
981+
order_by='total')
967982
anc_projection = delivery_data['ANC projection']['numerators'][
968983
'this']
969984
facility_birth_rate = \
@@ -999,7 +1014,7 @@ def get_health_workers_distribution_profile(geo, session):
9991014
with dataset_context(year='2015'):
10001015
try:
10011016
hw_data, total = get_stat_data(
1002-
'health workers', geo=geo, session=session, order_by='-total')
1017+
'health workers', geo=geo, session=session, order_by='total')
10031018

10041019
hrh_patient_ratio = hw_data['HRH patient ratio']['numerators'][
10051020
'this']
@@ -1039,7 +1054,7 @@ def get_health_centers_distribution_profile(geo, session):
10391054
with dataset_context(year='2015'):
10401055
try:
10411056
hc_data, total = get_stat_data(
1042-
'health centers', geo=geo, session=session, order_by='-total')
1057+
'health centers', geo=geo, session=session, order_by='total')
10431058
ho_data, _ = get_stat_data(
10441059
'health center ownership', geo, session)
10451060
hiv_centers_data, hiv_c = get_stat_data(
@@ -1078,7 +1093,7 @@ def get_tetanus_vaccine_profile(geo, session):
10781093
with dataset_context(year='2015'):
10791094
try:
10801095
tetanus_vaccine_data, _ = get_stat_data(
1081-
'tetanus vaccine', geo=geo, session=session, order_by='-total')
1096+
'tetanus vaccine', geo=geo, session=session, order_by='total')
10821097
number_vaccinated = \
10831098
tetanus_vaccine_data['Vaccinated']['numerators'][
10841099
'this']
@@ -1171,7 +1186,7 @@ def get_traffic_and_crimes_profile(geo, session):
11711186
traffic_and_crimes, _total_tc = get_stat_data('traffic and crimes',
11721187
geo=geo,
11731188
session=session,
1174-
order_by='-total')
1189+
order_by='total')
11751190

11761191
# total accidents
11771192

@@ -1209,7 +1224,7 @@ def get_traffic_and_crimes_profile(geo, session):
12091224
only=person_offences, \
12101225
geo=geo,
12111226
session=session,
1212-
order_by='-total')
1227+
order_by='total')
12131228

12141229
# cattle theft
12151230
cattle_theft_only = ["Cattle Thieves", "Murdered Cattle Owners"]
@@ -1243,7 +1258,7 @@ def recoder(f, x):
12431258
only=cattle_theft_only, \
12441259
geo=geo,
12451260
session=session,
1246-
order_by='-total', \
1261+
order_by='total', \
12471262
recode=recoder)
12481263

12491264
robbery_only = ['Robbery Victims', 'Robbery Thieves']
@@ -1252,7 +1267,7 @@ def recoder(f, x):
12521267
only=robbery_only, \
12531268
geo=geo,
12541269
session=session,
1255-
order_by='-total',
1270+
order_by='total',
12561271
recode=recoder)
12571272

12581273
superstitious_only = ["Superstitious Beliefs Albino",
@@ -1263,7 +1278,7 @@ def recoder(f, x):
12631278
only=superstitious_only, \
12641279
geo=geo,
12651280
session=session,
1266-
order_by='-total',
1281+
order_by='total',
12671282
recode=recoder)
12681283

12691284
total_cattletheft_robbery = _total_rf + _total_ct
@@ -1278,7 +1293,7 @@ def recoder(f, x):
12781293
only=public_fighting_only, \
12791294
geo=geo,
12801295
session=session,
1281-
order_by='-total',
1296+
order_by='total',
12821297
recode=recoder)
12831298

12841299
except Exception:
@@ -1372,7 +1387,7 @@ def get_primary_school_teachers_profile(geo, session):
13721387

13731388
ps_teachers, n_teachers = get_stat_data('primary school teachers', \
13741389
geo=geo, session=session,
1375-
order_by='-total')
1390+
order_by='total')
13761391

13771392
except Exception:
13781393
pass
@@ -1477,7 +1492,7 @@ def get_airport_types_profile(geo, session):
14771492

14781493
airports_dist, n_airports = get_stat_data('airport types', \
14791494
geo=geo, session=session,
1480-
order_by='-total')
1495+
order_by='total')
14811496

14821497
except Exception as e:
14831498
pass

0 commit comments

Comments
 (0)