Beispiel #1
0
def datasetreader(handle, config):
    coder = {}
    maindata = []
    apiroot = config['apiroot'] + "/api/datasets?handle=" + handle
    datasets = loadjson(apiroot)
    for item in datasets:
        maindata = item['data']
    return maindata
Beispiel #2
0
def simplesearch(root, qurl, apiroot):
    # Load topics
    #topicurl = apiroot + "/collabs/static/data/dataframe100_0.json"
    topicurl = apiroot + "/api/datasets?handle=Panel[%27hdl:10622/0PCZX5%27]"
    topicsframe = loadjson(topicurl)
    for item in topicsframe:
	topics = item['data']

    # Input
    IDS = getindicators(qurl)

    datasets = dataset_search(root, IDS, topics)
    return datasets
Beispiel #3
0
def simplesearch(root, qurl, apiroot):
    # Load topics
    #topicurl = apiroot + "/collabs/static/data/dataframe100_0.json"
    topicurl = apiroot + "/api/datasets?handle=Panel[%27hdl:10622/0PCZX5%27]"
    topicsframe = loadjson(topicurl)
    for item in topicsframe:
        topics = item['data']

    # Input
    IDS = getindicators(qurl)

    datasets = dataset_search(root, IDS, topics)
    return datasets
Beispiel #4
0
def search(qurl):
    # Global settings
    config = configuration()
    root = config['dataverseroot']

    # Load topics
    topicurl = config['apiroot'] + "/collabs/static/data/dataframe100_0.json"
    topics = loadjson(topicurl)

    # Input
    IDS = getindicators(qurl)

    datasets = dataset_search(root, IDS, topics)
    return datasets
Beispiel #5
0
def search(qurl):
    # Global settings
    config = configuration()
    root = config['dataverseroot']

    # Load topics
    topicurl = config['apiroot'] + "/collabs/static/data/dataframe100_0.json"
    topics = loadjson(topicurl)

    # Input
    IDS = getindicators(qurl)

    datasets = dataset_search(root, IDS, topics)
    return datasets
Beispiel #6
0
def produce_historicaldata(config, fullfilepath, clioframe, codes, maincode,
                           limityear):
    clioframe.index = clioframe[maincode]
    (countryinfo, line, geoexcel, yearscolumns) = get_info(clioframe)
    # Filter data from dataframe
    (totaldf, navicolumns, result, ycodes,
     emptyrow) = dataframe_filter(codes, maincode, clioframe)
    # Geocoder
    geocoderapi = config['geocoderapi']
    tmpgeocoder = loadjson(geocoderapi)
    geocoder = match_geocoders(maincode, tmpgeocoder, geoexcel, countryinfo,
                               limityear)
    # Save as Excel file
    datafile = save_historical_dataset(fullfilepath, geocoder, countryinfo,
                                       yearscolumns, result)
    return fullfilepath
Beispiel #7
0
def get_iishvisitors_frame(thisyear):
    if thisyear:
        years = [thisyear]
    else:
        years = [2015, 2016]
    finaldata = pd.DataFrame()
    for year in years:    
        url = "http://visitors.collections.iisg.org/api/statistics/maps.php?year=" + str(year)
        data = loadjson(url)
        clioframe = pd.DataFrame(data['data'])
	clioframe = clioframe.convert_objects(convert_numeric=True)
	clioframe.columns = [u'coordinates', u'country', u'Webmapper numeric code', u'iso_code', u'total']        
	clioframe.index = clioframe['Webmapper numeric code']
        if 'coordinates' in clioframe.columns:
            clioframe = clioframe.drop('coordinates', axis=1)
        xdata = pd.DataFrame(clioframe['total'])
        xdata.columns = [year]    
        finaldata = pd.concat([finaldata, xdata], axis=1)
    return finaldata
Beispiel #8
0
def get_iishvisitors_frame(thisyear):
    if thisyear:
        years = [thisyear]
    else:
        years = [2015, 2016]
    finaldata = pd.DataFrame()
    for year in years:
        url = "http://visitors.collections.iisg.org/api/statistics/maps.php?year=" + str(
            year)
        data = loadjson(url)
        clioframe = pd.DataFrame(data['data'])
        clioframe = clioframe.convert_objects(convert_numeric=True)
        clioframe.columns = [
            u'coordinates', u'country', u'Webmapper numeric code', u'iso_code',
            u'total'
        ]
        clioframe.index = clioframe['Webmapper numeric code']
        if 'coordinates' in clioframe.columns:
            clioframe = clioframe.drop('coordinates', axis=1)
        xdata = pd.DataFrame(clioframe['total'])
        xdata.columns = [year]
        finaldata = pd.concat([finaldata, xdata], axis=1)
    return finaldata