Esempio n. 1
0
    def test_get_stat_data_nulls_with_denominator_key(self):
        table = FieldTable(['household goods'],
                           universe='Households',
                           denominator_key='total households')
        self.load_data(
            table, """
lev,code,fridge,10
lev,code,computer,5
lev,code,total households,
""")
        data, total = get_stat_data(['household goods'], self.geo, self.s)
        self.assertEqual(total, None)
        self.assertEqual(data['Fridge']['numerators']['this'], 10)
        self.assertIsNone(data['Fridge']['values']['this'])
        self.assertEqual(data['Computer']['numerators']['this'], 5)
        self.assertIsNone(data['Computer']['values']['this'])
Esempio n. 2
0
from wazimap.data.tables import FieldTable

# Define our tables so the data API can discover them.
# TODO: Add comments so that we can quickly see categories/topics
# TODO: Rework format to a standard

FieldTable(
    ['rural or urban', 'sex', 'age in completed years'],
    year='2009'
)
FieldTable(
    ['employment activity status', 'sex'],
    universe='People aged 5 years and older',
    year='2009'
)
FieldTable(
    ['school attendance', 'sex'],
    universe='People aged 3 years and older',
    year='2009'
)
FieldTable(
    ['highest education level reached'],
    universe='People aged 3 years and older',
    year='2009'
)
FieldTable(
    ['main mode of human waste disposal'],
    universe='Households',
    year='2009'
)
FieldTable(
Esempio n. 3
0
from django.conf import settings
from wazimap.data.tables import FieldTable, SimpleTable

# Define our tables for each profile so the data API can discover them.

# All profiles

# Census tables
if settings.WAZIMAP['default_profile'] == 'census':
    FieldTable(['age groups in 5 years'])
    FieldTable(['age in completed years'])
    FieldTable([
        'electricity for cooking', 'electricity for heating',
        'electricity for lighting'
    ])
    FieldTable(['energy or fuel for cooking'])
    FieldTable(['energy or fuel for heating'])
    FieldTable(['energy or fuel for lighting'])
    FieldTable(['gender'])
    FieldTable(['gender', 'marital status'])
    FieldTable(['gender', 'population group'])
    FieldTable(['gender', 'age groups in 5 years'])
    FieldTable(['highest educational level'])
    FieldTable(['highest educational level'],
               id="highesteducationallevel20",
               universe='Individuals 20 and older')
    FieldTable(['language'],
               description='Population by primary language spoken at home')
    FieldTable(['employed individual monthly income'],
               universe='Employed individuals')
    FieldTable(['employed individual annual income'],
Esempio n. 4
0
from wazimap.data.tables import FieldTable

# Define our tables so the data API can discover them.
FieldTable(['main type of cooking fuel'],
           universe='Households',
           table_per_level=False)
Esempio n. 5
0
from wazimap.data.tables import FieldTable

# Define our tables so the data API can discover them.
# TODO: Add comments so that we can quickly see categories/topics
# TODO: Rework format to a standard
# FieldTable(['code', 'name', 'region', 'district', 'ward', 'ownership', 'latitude', 'longitude',
#     'pass_rate', 'change_previous_year_pass_rate', 'avg_gpa', 'chane_previous_year_gpa', 'rank',
#     'year_of_result', 'more_than_40', 'national_rank_all', 'regional_rank_all',
#     'district_rank_all'], id='secondary_school', dataset="School's League", year='2017')

FieldTable([
    'code', 'name', 'region', 'district', 'ward', 'ownership', 'gender',
    'latitude', 'longitude', 'avg_gpa', 'year_of_result', 'more_than_40',
    'national_rank_all', 'regional_rank_all'
],
           id='secondary_school',
           dataset="School's League",
           year='2017')
Esempio n. 6
0
from wazimap.data.tables import FieldTable

FieldTable(['rural or urban'], year='2014')
FieldTable(['sex'], year='2014')
FieldTable(['household'], year='2014')
FieldTable(['household distribution by energy source'], year='2014')
FieldTable(['household distribution by light source'], year='2014')
FieldTable(['household percentage by permanency'], year='2014')
FieldTable(['presidential candidate'], year='2014')
FieldTable(['disability'], year='2014')
FieldTable(['disabled or not'], year='2014')
Esempio n. 7
0
from wazimap.data.tables import FieldTable

FieldTable(['rural or urban'], table_per_level=False)
FieldTable(['sex'], table_per_level=False)
FieldTable(['household'], table_per_level=False)
FieldTable(['household distribution by energy source'], table_per_level=False)
FieldTable(['household distribution by light source'], table_per_level=False)
FieldTable(['presidential candidate'], table_per_level=False)
FieldTable(['disability'], table_per_level=False)
FieldTable(['disabled or not'], table_per_level=False)
Esempio n. 8
0
from wazimap.data.tables import FieldTable

# Define our tables so the data API can discover them.
FieldTable(['rural or urban', 'sex', 'age in completed years'],
           table_per_level=False)
FieldTable(['employment activity status', 'sex'],
           universe='People aged 5 years and older',
           table_per_level=False)
FieldTable(['school attendance', 'sex'],
           universe='People aged 3 years and older',
           table_per_level=False)
FieldTable(['highest education level reached'],
           universe='People aged 3 years and older',
           table_per_level=False)
FieldTable(['main mode of human waste disposal'],
           universe='Households',
           table_per_level=False)
FieldTable(['main source of water'],
           universe='Households',
           table_per_level=False)
FieldTable(['main type of lighting fuel'],
           universe='Households',
           table_per_level=False)
FieldTable(['main type of floor material'],
           universe='Households',
           table_per_level=False)
FieldTable(['main type of wall material'],
           universe='Households',
           table_per_level=False)
FieldTable(['main type of roofing material'],
           universe='Households',
Esempio n. 9
0
from wazimap.data.tables import FieldTable


# Define our tables so the data API can discover them.
# Household tables
FieldTable(['rural population'], universe='Population', table_per_level=False)

FieldTable(['area', 'sex'], universe='Population', table_per_level=False)
FieldTable(['census_year', 'measure'], universe='A2-Decadal Variation', table_per_level=False)
FieldTable(['census_year', 'sex_vis'], universe='VISUAL', table_per_level=False)
FieldTable(['area', 'sex', 'literacy'], universe='Population', table_per_level=False)
FieldTable(['area','village_town_comparison'], universe='A3APPENDIX', table_per_level=False)
FieldTable(['religion', 'area', 'sex'], universe='Religion', table_per_level=False)

FieldTable(['age', 'area', 'sex'], universe='Age', table_per_level=False)
FieldTable(['village_town_measures','area'], universe='A1-', table_per_level=False)

FieldTable(['education', 'area', 'sex'], universe='Education', table_per_level=False)
FieldTable(['houseless_population','area', 'sex'], universe='A7-Houseless', table_per_level=False)
FieldTable(['sc_houseless_population','area', 'sex'], universe='A8-SC_Houseless', table_per_level=False)
FieldTable(['st_houseless_population','area', 'sex'], universe='A9-ST_Houseless', table_per_level=False)

FieldTable(['village_measures','population_range'], universe='A3-Inhabited Villages', table_per_level=False)

FieldTable(['maritalstatus', 'area', 'sex'], universe='Relation', table_per_level=False)
FieldTable(['workertype','age_group','area','sex'], universe='B1-Workerstype', table_per_level=False)
FieldTable(['sc_workertype','age_group','area','sex'], universe='B1SC-Workerstype', table_per_level=False)
FieldTable(['st_workertype','age_group','area','sex'], universe='B1ST-Workerstype', table_per_level=False)
FieldTable(['workers', 'area', 'workerssex'], universe='Workers', table_per_level=False)
FieldTable(['workertype','education_level', 'area', 'sex'], universe='B3', table_per_level=False)
FieldTable(['education_level', 'area', 'sex_vis'], universe='VISUAL', table_per_level=False)
Esempio n. 10
0
from wazimap.data.tables import FieldTable, SimpleTable

# Define our tables so the data API can discover them.
# Household tables
FieldTable(['main type of cooking fuel'],
           universe='Households',
           description='Main type of cooking fuel',
           dataset='National Population and Housing Census 2011',
           year='2011',
           table_per_level=False)

FieldTable(['drinking water source'],
           universe='Households',
           description='Drinking water source',
           dataset='National Population and Housing Census 2011',
           year='2011',
           table_per_level=False)

FieldTable(['lighting fuel'],
           universe='Households',
           description='Main type of lighting fuel',
           dataset='National Population and Housing Census 2011',
           year='2011',
           table_per_level=False)

FieldTable(['foundation type'],
           universe='Households',
           description='Building foundation',
           dataset='National Population and Housing Census 2011',
           year='2011',
           table_per_level=False)
Esempio n. 11
0
from wazimap.data.tables import FieldTable

# Census data tables

FieldTable(['area', 'sex', 'year'],
           id='population_2001',
           universe='Population')
FieldTable(['area', 'sex', 'year'],
           id='population_2011',
           universe='Population')
FieldTable(['area', 'sex', 'year'],
           id='population_default',
           universe='Population')

FieldTable(['area', 'literacy', 'sex', 'year'],
           id='literacy_2001',
           universe='Literacy')
FieldTable(['area', 'literacy', 'sex', 'year'],
           id='literacy_2011',
           universe='Literacy')
FieldTable(['area', 'literacy', 'sex', 'year'],
           id='literacy_default',
           universe='Literacy')

FieldTable(['religion', 'year'], id='religion_2011', universe='Religion')
FieldTable(['religion', 'year'], id='religion_default', universe='Religion')

FieldTable(['area', 'sex', 'education', 'year'],
           id='education_2011',
           universe='Education')
FieldTable(['area', 'sex', 'education', 'year'],
Esempio n. 12
0
from wazimap.data.tables import FieldTable

# Define our tables so the data API can discover them.
# Household tables
FieldTable(['rural population'], universe='Population', table_per_level=False)

FieldTable(['area', 'sex'], universe='Population', table_per_level=False)

FieldTable(['area', 'sex', 'literacy'],
           universe='Population',
           table_per_level=False)

FieldTable(['religion', 'area', 'sex'],
           universe='Religion',
           table_per_level=False)

FieldTable(['age', 'area', 'sex'], universe='Age', table_per_level=False)

FieldTable(['education', 'area', 'sex'],
           universe='Education',
           table_per_level=False)

FieldTable(['maritalstatus', 'area', 'sex'],
           universe='Relation',
           table_per_level=False)

FieldTable(['workers', 'area', 'workerssex'],
           universe='Workers',
           table_per_level=False)
Esempio n. 13
0
from wazimap.data.tables import FieldTable

# Define our tables so the data API can discover them.
# TODO: Add comments so that we can quickly see categories/topics
# TODO: Rework format to a standard

FieldTable(['rural or urban', 'sex', 'age in completed years'],
           year='2009',
           dataset='Census')
FieldTable(['employment activity status', 'sex'],
           universe='People aged 5 years and older',
           year='2009',
           dataset='Census')
FieldTable(['school attendance', 'sex'],
           universe='People aged 3 years and older',
           year='2009',
           dataset='Census')
FieldTable(['highest education level reached'],
           universe='People aged 3 years and older',
           year='2009',
           dataset='Census')
FieldTable(['main mode of human waste disposal'],
           universe='Households',
           year='2009',
           dataset='Census')
FieldTable(id='religion', fields=['religion'], year=2009, dataset='Census')

FieldTable(id='household_heads',
           fields=['Household_Heads'],
           year=2009,
           dataset='Census')
Esempio n. 14
0
from wazimap.data.tables import FieldTable, SimpleTable

# Define our tables so the data API can discover them.
FieldTable(['rural or urban', 'sex', 'age in completed years'])
#tz wards do not have population breakdown by age so they have a separate table
FieldTable(['rural or urban', 'sex'])
FieldTable(['employment activity status', 'sex'],
           universe='People aged 5 years and older')
FieldTable(['school attendance', 'sex'],
           universe='People aged 3 years and older')
FieldTable(['highest education level reached'],
           universe='People aged 3 years and older')
FieldTable(['main mode of human waste disposal'], universe='Households')
FieldTable(['main source of water'], universe='Households')
FieldTable(['main type of lighting fuel'], universe='Households')
FieldTable(['main type of floor material'], universe='Households')
FieldTable(['main type of wall material'], universe='Households')
FieldTable(['main type of roofing material'], universe='Households')
FieldTable(['literacy test'])
FieldTable(['pepfar'])
FieldTable(['school attendance'])
FieldTable(['pupil teacher ratios'])
FieldTable(['school amenity'])
FieldTable(['causes of death under five'])
FieldTable(['causes of death over five'])
FieldTable(['inpatient diagnosis over five'])
FieldTable(['inpatient diagnosis under five'])
FieldTable(['outpatient diagnosis over five'])
FieldTable(['outpatient diagnosis under five'])
FieldTable(['family planning clients'])
FieldTable(['place of delivery'])
Esempio n. 15
0
from wazimap.data.tables import FieldTable

# Define our tables so the data API can discover them.
# Household tables
FieldTable(['main type of cooking fuel'],
           universe='Households',
           table_per_level=False)

FieldTable(['drinking water source'],
           universe='Households',
           table_per_level=False)

FieldTable(['lighting fuel'], universe='Households', table_per_level=False)

FieldTable(['foundation type'], universe='Households', table_per_level=False)

FieldTable(['outer wall type'], universe='Households', table_per_level=False)

FieldTable(['roof type'], universe='Households', table_per_level=False)

FieldTable(['toilet type'], universe='Households', table_per_level=False)

FieldTable(['home ownership'], universe='Households', table_per_level=False)

# Education tables
FieldTable(['education level passed', 'sex'],
           universe='People aged 5 years and older',
           table_per_level=False)

FieldTable(['literacy', 'sex'],
           universe='People aged 5 years and older',
Esempio n. 16
0
from wazimap.data.tables import FieldTable

FieldTable(['GNI_Year'])
FieldTable(['Life_Expectancy_Year'])
FieldTable(['Population_Year'])
FieldTable(['Crop_Production_Year'])
FieldTable(['GDP_Year'], value_type='Float')
FieldTable(['Rank', 'year'])
# Percentage of population ages 15-49
FieldTable(['HIV_Prevalence_Year'], value_type='Float')
# literate Percentage of population above 15 years
FieldTable(['Literacy_Year'])

FieldTable(['Indicator'], id='hd_landscape', value_type='Float')
Esempio n. 17
0
from wazimap.data.tables import FieldTable, SimpleTable

FieldTable(['population group'], id='populationgroup_2016', year='2016', dataset='Census')
Esempio n. 18
0
from wazimap.data.tables import FieldTable, SimpleTable

# Ipv4

FieldTable(['users_or_not'],
		id='users_in_country',
		universe='Internet users',
        value_type='BIGINT',
		description='What percentage of a country are internet users',
		dataset='Stats from stats.labs.apnic.net',
		year='2017')



FieldTable(['country_or_world'],
        id='users_in_world',
        universe='Internet users',
        value_type='BIGINT',
        description='How much of the worlds internet users does this country make make up of',
        dataset='Stats from stats.labs.apnic.net',
        year='2017')




FieldTable(['asn'],
        id='market_share',
        universe='Internet users',
        value_type='BIGINT',
        description='The market share in a given country.',
        dataset='Stats from stats.labs.apnic.net',
Esempio n. 19
0
from wazimap.data.tables import FieldTable

# Define our tables so the data API can discover them.
FieldTable(['rural or urban', 'sex', 'age in completed years'],
           table_per_level=False)
#FieldTable(['employment activity status', 'sex'], universe='People aged 5 years and older', table_per_level=False)
#FieldTable(['school attendance', 'sex'], universe='People aged 3 years and older', table_per_level=False)
#FieldTable(['highest education level reached'], universe='People aged 3 years and older', table_per_level=False)
#FieldTable(['main mode of human waste disposal'], universe='Households', table_per_level=False)
#FieldTable(['main source of water'], universe='Households', table_per_level=False)
#FieldTable(['main type of lighting fuel'], universe='Households', table_per_level=False)
#FieldTable(['main type of floor material'], universe='Households', table_per_level=False)
#FieldTable(['main type of wall material'], universe='Households', table_per_level=False)
#FieldTable(['main type of roofing material'], universe='Households', table_per_level=False)
Esempio n. 20
0
from wazimap.data.tables import FieldTable

FieldTable(['population_sex_2006'],
           id='population_sex_2006',
           year='2006',
           dataset='Census')
FieldTable(['population_sex_2007'],
           id='population_sex_2007',
           year='2007',
           dataset='Census')
FieldTable(['population_sex_2009'],
           id='population_sex_2009',
           year='2009',
           dataset='Census')
FieldTable(['population_sex_2011'],
           id='population_sex_2011',
           year='2011',
           dataset='Census')
FieldTable(['population_sex_2012'],
           id='population_sex_2012',
           year='2012',
           dataset='Census')
FieldTable(['population_sex_2013'],
           id='population_sex_2013',
           year='2013',
           dataset='Census')

FieldTable(['population_residence_2009'],
           id='population_residence_2009',
           year='2006',
           dataset='Census')
Esempio n. 21
0
from wazimap.data.tables import FieldTable

# Define our tables so the data API can discover them.
# TODO: Add comments so that we can quickly see categories/topics
# TODO: Rework format to a standard
FieldTable([
    'code', 'name', 'region', 'district', 'ward', 'ownership', 'latitude',
    'longitude', 'pass_rate', 'change_previous_year_pass_rate', 'avg_gpa',
    'chane_previous_year_gpa', 'rank', 'year_of_result', 'more_than_40',
    'national_rank_all', 'regional_rank_all', 'district_rank_all'
],
           id='secondary_schools')

FieldTable([
    'code', 'name', 'region', 'district', 'ward', 'ownership', 'gender',
    'latitude', 'longitude', 'avg_gpa', 'year_of_result', 'more_than_40',
    'national_rank_all', 'regional_rank_all'
],
           id='secondary_school')

#FieldTable(['university_name', 'course_name', 'general_major', 'cumpulsory_subjects_ar', 'other_subjects_ar'], id='universityfinder')
#
# FieldTable([], id='olevel_subject_performance')
# FieldTable([], id='alevel_subject_performance')
# FieldTable([], id='olevel_student_performance')
# FieldTable([], id='alevel_student_performance')
# FieldTable([], id='olevel_overall_performance')
# FieldTable([], id='alevel_overall_performance')
Esempio n. 22
0
from wazimap.data.tables import FieldTable

# Define our tables so the data API can discover them.
FieldTable(['gender', 'age group'])
FieldTable(['gender', 'rural or urban'])

# FieldTable(['rural or urban', 'sex', 'age in completed years'], table_per_level=False)
# FieldTable(['employment activity status', 'sex'], universe='People aged 5 years and older', table_per_level=False)
# FieldTable(['school attendance', 'sex'], universe='People aged 3 years and older', table_per_level=False)
# FieldTable(['highest education level reached'], universe='People aged 3 years and older', table_per_level=False)
# FieldTable(['main mode of human waste disposal'], universe='Households', table_per_level=False)
# FieldTable(['main source of water'], universe='Households', table_per_level=False)
# FieldTable(['main type of lighting fuel'], universe='Households', table_per_level=False)
# FieldTable(['main type of floor material'], universe='Households', table_per_level=False)
# FieldTable(['main type of wall material'], universe='Households', table_per_level=False)
# FieldTable(['main type of roofing material'], universe='Households', table_per_level=False)
Esempio n. 23
0
 def field_table(self, fields, data_str):
     table = FieldTable(fields)
     self.load_data(table, data_str)
Esempio n. 24
0
from django.conf import settings
from wazimap.data.tables import SimpleTable, FieldTable

FieldTable(
    ['gender', 'population group'],
    id='youth_gender_population_group',
    universe='Youth',
    year='2011')
FieldTable(
    ['population group', 'gender'],
    id='youth_population_group_gender',
    universe='Youth',
    year='2011',
    db_table='youth_gender_population_group')
FieldTable(
    ['age groups in 10 years'],
    id='youth_age_groups_in_10_years',
    universe='Population',
    year='2011')
FieldTable(['language'], id='youth_language', universe='Youth', year='2011')
FieldTable(
    ['province of birth'],
    id='youth_province_of_birth',
    universe='Youth',
    year='2011')
FieldTable(
    ['region of birth'],
    id='youth_region_of_birth',
    universe='Youth',
    year='2011')
FieldTable(
Esempio n. 25
0
from wazimap.data.tables import FieldTable, SimpleTable

# Define our tables so the data API can discover them.
# Household tables
FieldTable(['main type of cooking fuel'],
           universe='Households',
           description='Main type of cooking fuel',
           dataset='National Population and Housing Census 2011',
           year='2011')

FieldTable(['drinking water source'],
           universe='Households',
           description='Drinking water source',
           dataset='National Population and Housing Census 2011',
           year='2011')

FieldTable(['lighting fuel'],
           universe='Households',
           description='Main type of lighting fuel',
           dataset='National Population and Housing Census 2011',
           year='2011')

FieldTable(['foundation type'],
           universe='Households',
           description='Building foundation',
           dataset='National Population and Housing Census 2011',
           year='2011')

FieldTable(['outer wall type'],
           universe='Households',
           description='Outer wall of building',
Esempio n. 26
0
from wazimap.data.tables import FieldTable

FieldTable(['financial_year'], value_type='Float')

FieldTable(['expenditure', 'year'], value_type='Float')

FieldTable(['conditional_fund'], value_type='Float')