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" ]
import ISO_countries import special_chars from collections import OrderedDict json_2013_target = '../output/2013/extra/country_region_mappings.json' csv_2013_target = '../output/2013/extra/country_region_mappings.csv' xml_2013_target = '../output/2013/extra/country_region_mappings.xml' json_2014_target = '../output/2014/extra/country_region_mappings.json' csv_2014_target = '../output/2014/extra/country_region_mappings.csv' xml_2014_target = '../output/2014/extra/country_region_mappings.xml' mappings = ["Country_Name", "Country_Region"] # Info to be extracted from spreadsheet isocountries = ISO_countries.build() sp_chars = special_chars.build() def include_ISO(rlist): result = [] for r in rlist: row = OrderedDict() cn = r['Country_Name'] row['Country_Name'] = cn row['Country_ISO2'] = ISO_countries.ISO2_from_name(cn, isocountries) row['Country_ISO3'] = ISO_countries.ISO3_from_name(cn, isocountries) row['Country_Region'] = r['Country_Region'] result.append(row) return result
import utility import ISO_countries import special_chars from collections import OrderedDict json_2013_target = '../output/2013/extra/country_region_mappings.json' csv_2013_target = '../output/2013/extra/country_region_mappings.csv' xml_2013_target = '../output/2013/extra/country_region_mappings.xml' json_2014_target = '../output/2014/extra/country_region_mappings.json' csv_2014_target = '../output/2014/extra/country_region_mappings.csv' xml_2014_target = '../output/2014/extra/country_region_mappings.xml' mappings = ["Country_Name", "Country_Region"] # Info to be extracted from spreadsheet isocountries = ISO_countries.build() sp_chars = special_chars.build() def include_ISO(rlist): result = [] for r in rlist: row = OrderedDict() cn = r['Country_Name'] row['Country_Name'] = cn row['Country_ISO2'] = ISO_countries.ISO2_from_name(cn, isocountries) row['Country_ISO3'] = ISO_countries.ISO3_from_name(cn, isocountries) row['Country_Region'] = r['Country_Region'] result.append(row) return result def build(year):
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 def set_current_year(yr):