Ejemplo n.º 1
0
def view(catalog):
    catalog = get_catalog(catalog)
    statistics = statistic_table.find(order_by='title_de')
    dimensions = []
    for dimension in dimension_table.find(order_by='title_de'):
        dimension['measure_type_name'] = dimension_type_text(dimension['measure_type'])
        dimensions.append(dimension)

    return render_template('catalog/index.html',
                           catalog=catalog,
                           statistics=statistics,
                           dimensions=dimensions)
Ejemplo n.º 2
0
def view(catalog):
    catalog = get_catalog(catalog)
    statistics = statistic_table.find(order_by='title_de')
    dimensions = []
    for dimension in dimension_table.find(order_by='title_de'):
        dimension['measure_type_name'] = dimension_type_text(
            dimension['measure_type'])
        dimensions.append(dimension)

    return render_template('catalog/index.html',
                           catalog=catalog,
                           statistics=statistics,
                           dimensions=dimensions)
Ejemplo n.º 3
0
def view(catalog, slug, name):
    catalog = get_catalog(catalog)
    statistic = statistic_table.find_one(name=name)
    desc = parse_description(statistic['description_de'] or '')
    cubes = []
    dims = defaultdict(int)
    titles = set([statistic['title_de']])
    for cube in get_cubes(name):
        cube['dimensions'] = get_dimensions(cube['name'])
        for dim in cube['dimensions']:
            dim['show'] = True
            dims[dim['dim_name']] += 1
            titles.add(dim['dim_title_de'])
            dim['type_text'] = dimension_type_text(dim['dim_measure_type'])
            if dim['dim_measure_type'].startswith('K-REG'):
                cube['admlevel'] = (ADM_RANKS[dim['dim_name']],
                                    dim['dim_title_de'], dim['dim_name'])
                dim['show'] = False
        cube['stand'] = cube['provenance'].split('hat am')[-1].split(
            'um')[0].strip()
        cubes.append(cube)
    common = [d for d, i in list(dims.items()) if i == len(cubes)]
    commons = {}
    for cube in cubes:
        for dim in cube['dimensions']:
            if dim['dim_name'] in common and dim['show']:
                #dim['show'] = False
                commons[dim['dim_name']] = dim

    keywords = make_keywords(titles)
    description = desc.get('method', '')[:150]
    return render_template('statistic/view.html',
                           catalog=catalog,
                           desc=desc,
                           cubes=cubes,
                           keywords_text=keywords,
                           description_text=description,
                           common=list(commons.values()),
                           has_common=len(common) > 0,
                           statistic=statistic)
Ejemplo n.º 4
0
def view(catalog, slug, name):
    catalog = get_catalog(catalog)
    statistic = statistic_table.find_one(name=name)
    desc = parse_description(statistic['description_de'] or '')
    cubes = []
    dims = defaultdict(int)
    titles = set([statistic['title_de']])
    for cube in get_cubes(name):
      cube['dimensions'] = get_dimensions(cube['name'])
      for dim in cube['dimensions']:
        dim['show'] = True
        dims[dim['dim_name']] += 1
        titles.add(dim['dim_title_de'])
        dim['type_text'] = dimension_type_text(dim['dim_measure_type'])
        if dim['dim_measure_type'].startswith('K-REG'):
            cube['admlevel'] = (ADM_RANKS[dim['dim_name']], dim['dim_title_de'], dim['dim_name'])
            dim['show'] = False
      cube['stand'] = cube['provenance'].split('hat am')[-1].split('um')[0].strip()
      cubes.append(cube)
    common = [d for d, i in dims.items() if i == len(cubes)]
    commons = {}
    for cube in cubes:
        for dim in cube['dimensions']:
            if dim['dim_name'] in common and dim['show']:
                #dim['show'] = False
                commons[dim['dim_name']] = dim

    keywords = make_keywords(titles)
    description = desc.get('method', '')[:150]
    return render_template('statistic/view.html',
                           catalog=catalog,
                           desc=desc,
                           cubes=cubes,
                           keywords_text=keywords,
                           description_text=description,
                           common=commons.values(),
                           has_common=len(common) > 0,
                           statistic=statistic)