Пример #1
0
import regions
import special_chars
import ISO_countries
from collections import OrderedDict

csv_2013_target = '../output/2013/extra/master_data_from_XL.csv'
xml_2013_target = '../output/2013/extra/master_data_from_XL.xml'
json_2013_target = '../output/2013/extra/master_data_from_XL.json'

csv_2014_target = '../output/2014/extra/master_data_from_XL.csv'
xml_2014_target = '../output/2014/extra/master_data_from_XL.xml'
json_2014_target = '../output/2014/extra/master_data_from_XL.json'

cur_year = 2014

regs = regions.build(cur_year)
csl = ISO_countries.build()
sp_chars = special_chars.build()

mappings = [
    "Country_Name", "Assessment", "C_138_Ratified", "C_182_Ratified",
    "Convention_on_the_Rights_of_the_Child_Ratified",
    "CRC_Commercial_Sexual_Exploitation_of_Children_Ratified",
    "CRC_Armed_Conflict_Ratified", "Palermo_Ratified",
    "Minimum_Age_for_Work_Estabslished", "Minimum_Age_for_Work",
    "Minimum_Age_for_Hazardous_Work_Estabslished",
    "Minimum_Age_for_Hazardous_Work", "Compulsory_Education_Age_Established",
    "Minimum_Age_for_Compulsory_Education",
    "Free_Public_Education_Estabslished"
]
Пример #2
0
def set_regions(yr):
    regs = regions.build(yr)
    return
Пример #3
0
def set_regions(yr):
	regs = regions.build(yr)
	return
Пример #4
0
from collections import OrderedDict

source_json_file = "../source_data/country_profile_2014.json"

json_target = "../output/2014/countries.json"
xml_target = "../output/2014/countries.xml"
json_for_app_target = "../output/2014/countries_for_app.json"
xml_for_app_target = "../output/2014/countries_for_app.xml"

suggested_actions_text = "Suggested Government Actions"

mds = master_data.build(2014)
sts = stats.build_ordered(2014)
gds = goods.build(2014)
csl = ISO_countries.build()
regs = regions.build(2014)
cps = utility.get_json_data(source_json_file)
sp_chars = special_chars.build()


def build():
    countries = merge(cps, gds, sts, mds)
    return countries


def add_to_country_profiles(profiles):
    results = []
    cpkeys = profiles[0].keys()
    for profile in profiles:
        newrec = OrderedDict()
        cn = profile['country'].encode('utf8')
Пример #5
0
csv_2013_target = '../output/2013/extra/country_stats_from_XL.csv' 
xml_2013_target = '../output/2013/extra/country_stats_from_XL.xml' 
json_2013_target = '../output/2013/extra/country_stats_from_XL.json' 

csv_2014_target = '../output/2014/extra/country_stats_from_XL.csv' 
xml_2014_target = '../output/2014/extra/country_stats_from_XL.xml' 
json_2014_target = '../output/2014/extra/country_stats_from_XL.json' 

CWS = "Children_Work_Statistics"
ESAS = "Education_Statistics_Attendance_Statistics"
CWAS = "Children_Working_and_Studying_7-14_yrs_old"
UPCR = "UNESCO_Primary_Completion_Rate"

current_year = 2013
regs = regions.build(current_year)
csl = ISO_countries.build()
sp_chars = special_chars.build()

mappings = [ 'Country_Name', 
              CWS+'_Age_Range', CWS+'_Total_Percentage_of_Working_Children',
              CWS+'_Total_Working_Population', 
              CWS+'_Agriculture', CWS+'_Services', CWS+'_Industry', 
              ESAS+'_Year', ESAS+'_Age_Range', ESAS+'_Percentage', 
              CWAS+'_Year', CWAS+'_Age_Range', CWAS+'_Total', 
              UPCR+'_Year', UPCR+'_Rate' 
              ]

def get_current_year():
	return current_year
Пример #6
0
csv_2013_target = '../output/2013/extra/country_stats_from_XL.csv'
xml_2013_target = '../output/2013/extra/country_stats_from_XL.xml'
json_2013_target = '../output/2013/extra/country_stats_from_XL.json'

csv_2014_target = '../output/2014/extra/country_stats_from_XL.csv'
xml_2014_target = '../output/2014/extra/country_stats_from_XL.xml'
json_2014_target = '../output/2014/extra/country_stats_from_XL.json'

CWS = "Children_Work_Statistics"
ESAS = "Education_Statistics_Attendance_Statistics"
CWAS = "Children_Working_and_Studying_7-14_yrs_old"
UPCR = "UNESCO_Primary_Completion_Rate"

current_year = 2013
regs = regions.build(current_year)
csl = ISO_countries.build()
sp_chars = special_chars.build()

mappings = [
    'Country_Name', CWS + '_Age_Range',
    CWS + '_Total_Percentage_of_Working_Children',
    CWS + '_Total_Working_Population', CWS + '_Agriculture', CWS + '_Services',
    CWS + '_Industry', ESAS + '_Year', ESAS + '_Age_Range',
    ESAS + '_Percentage', CWAS + '_Year', CWAS + '_Age_Range', CWAS + '_Total',
    UPCR + '_Year', UPCR + '_Rate'
]


def get_current_year():
    return current_year
Пример #7
0
source_json_file = "../source_data/country_profile_2014.json"

json_target = "../output/2014/countries.json"
xml_target = "../output/2014/countries.xml"
json_for_app_target = "../output/2014/countries_for_app.json"
xml_for_app_target = "../output/2014/countries_for_app.xml"

suggested_actions_text = "Suggested Government Actions"


mds = master_data.build(2014)
sts = stats.build_ordered(2014)
gds = goods.build(2014)
csl = ISO_countries.build()
regs = regions.build(2014)
cps = utility.get_json_data(source_json_file)
sp_chars = special_chars.build()

def build():
	countries = merge(cps, gds, sts, mds)
	return countries

def add_to_country_profiles(profiles):
	results = []
	cpkeys = profiles[0].keys()
	for profile in profiles:
		newrec = OrderedDict()
		cn = profile['country'].encode('utf8')
		newrec['Country_ISO3'] = ISO_countries.ISO3_from_name(cn, csl)
		if ( newrec['Country_ISO3'] == utility.get_default_error() ):
Пример #8
0
xml_2014_target_by_good = '../output/2014/extra/goods_by_good_from_XL.xml' 
json_2014_target_by_country = '../output/2014/extra/goods_by_country_from_XL.json' 
json_2014_target_by_good = '../output/2014/extra/goods_by_good_from_XL.json'

present = "X"
sp_chars = special_chars.build()

mappings = ["Country_Name", 
            "Good_Name", 
            "Child_Labor", 
            "Forced_Labor", 
            "Forced_Child_Labor"]    

csl = ISO_countries.build()   
base_year = 2013
regs = regions.build(base_year)         
secs = sectors.build(base_year)

def get_base_year():
	return base_year

def set_base_year(yr):
	base_year = yr
	return

def  build(year):
	goods = utility.from_excelsheet(utility.get_source_filename(year), 2, 1, mappings)
	results = include_extra(goods, year)
	return results

def set_regions(year):
Пример #9
0
xml_2014_target_by_country = '../output/2014/extra/goods_by_country_from_XL.xml'
xml_2014_target_by_good = '../output/2014/extra/goods_by_good_from_XL.xml'
json_2014_target_by_country = '../output/2014/extra/goods_by_country_from_XL.json'
json_2014_target_by_good = '../output/2014/extra/goods_by_good_from_XL.json'

present = "X"
sp_chars = special_chars.build()

mappings = [
    "Country_Name", "Good_Name", "Child_Labor", "Forced_Labor",
    "Forced_Child_Labor"
]

csl = ISO_countries.build()
base_year = 2013
regs = regions.build(base_year)
secs = sectors.build(base_year)


def get_base_year():
    return base_year


def set_base_year(yr):
    base_year = yr
    return


def build(year):
    goods = utility.from_excelsheet(utility.get_source_filename(year), 2, 1,
                                    mappings)