示例#1
0
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"
]


def get_cur_year():
示例#2
0
import utility
import special_chars

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

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

mappings = ["Good_Sector", "Good_Name"]   #The attributes to be extracted from the spreadsheet

sp_chars = special_chars.build()

# Function that returns the sector associated with a good name (otherwise it returns -1)
def find_sector_from_name(goodname, slist):
	result = utility.get_default_error()
	ig = utility.canonical_good(goodname).upper().strip()
	for s in slist:
		cg = utility.canonical_good(s['Good_Name']).upper().strip()
		if (utility.goods_equal(ig, cg)):
			result = s['Good_Sector']
			break
	return result

# Function that returns a sorted list of the goods in a particular sector
def find_goods_in_sector(sector, slist):
	result = utility.get_default_error()
	searchstring = sector.upper().strip()