Ejemplo n.º 1
0
def get_context(project, columns=None):
    ctx = {'project': project}
    client = load_client()
    prov = client.projects.get_entry(project=project).response().result
    for k in ['id', 'project', 'other']:
        prov.pop(k)
    ctx['title'] = prov.pop('title')
    ctx['provenance'] = RecursiveDict(prov).render()
    data = client.projects.get_table(project=project,
                                     columns=columns,
                                     per_page=3).response().result
    if data['items']:
        columns = list(data['items'][0].keys())
        table = Table(data['items'], columns=columns)
        ctx['table'] = table.render(project=project)
    return ctx
Ejemplo n.º 2
0
def index(request):
    ctx = RequestContext(request)
    try:
        ctx['project'] = project
        prov = client.projects.get_entry(project=project).response().result
        prov.pop('id')
        ctx['title'] = prov.pop('title')
        ctx['provenance'] = RecursiveDict(prov).render()
        columns = ['phase', 'ΔH', 'ΔH|hyd', 'GS?', 'CIF']
        data = client.contributions.get_table(
            project=project, columns=columns, per_page=3
        ).response().result
        columns = list(data['items'][0].keys())
        table = Table(data['items'], columns=columns)
        ctx['table'] = table.render(project=project)
    except Exception as ex:
        ctx['alert'] = str(ex)
    return render(request, "explorer_index.html", ctx.flatten())
Ejemplo n.º 3
0
def index(request):
    ctx = RequestContext(request)
    try:
        ctx['project'] = project
        prov = client.projects.get_entry(project=project).response().result
        prov.pop('id')
        ctx['title'] = prov.pop('title')
        ctx['provenance'] = RecursiveDict(prov).render()
        columns = ['phase', 'ΔH', 'ΔH|hyd', 'GS?', 'CIF']
        data = client.contributions.get_table(project=project,
                                              columns=columns,
                                              per_page=3).response().result
        columns = list(data['items'][0].keys())
        table = Table(data['items'], columns=columns)
        ctx['table'] = table.render(project=project)
    except Exception as ex:
        ctx['alert'] = str(ex)
    return render(request, "explorer_index.html", ctx.flatten())
Ejemplo n.º 4
0
def index(request):
    ctx = RequestContext(request)
    try:
        ctx['project'] = project
        prov = client.projects.get_entry(project=project).response().result
        prov.pop('id')
        ctx['title'] = prov.pop('title')
        ctx['provenance'] = RecursiveDict(prov).render()
        keys, subkeys = ['NUS', 'JARVIS'], ['id', 'Eₓ', 'CIF']
        columns = ['##'.join([k, sk]) for k in keys for sk in subkeys]
        # columns_jarvis = ['id', 'E', 'ΔE|optB88vdW', 'ΔE|mbj', 'CIF']
        data = client.contributions.get_table(
            project=project, columns=columns, per_page=3
        ).response().result
        columns = list(data['items'][0].keys())
        table = Table(data['items'], columns=columns)
        ctx['table'] = table.render(project=project)
    except Exception as ex:
        ctx['alert'] = str(ex)
    return render(request, "explorer_index.html", ctx.flatten())
Ejemplo n.º 5
0
def index(request):
    ctx = RequestContext(request)
    try:
        ctx['project'] = project
        prov = client.projects.get_entry(project=project).response().result
        prov.pop('id')
        ctx['title'] = prov.pop('title')
        ctx['provenance'] = RecursiveDict(prov).render()
        keys, subkeys = ['NUS', 'JARVIS'], ['id', 'Eₓ', 'CIF']
        columns = ['##'.join([k, sk]) for k in keys for sk in subkeys]
        # columns_jarvis = ['id', 'E', 'ΔE|optB88vdW', 'ΔE|mbj', 'CIF']
        data = client.contributions.get_table(project=project,
                                              columns=columns,
                                              per_page=3).response().result
        columns = list(data['items'][0].keys())
        table = Table(data['items'], columns=columns)
        ctx['table'] = table.render(project=project)
    except Exception as ex:
        ctx['alert'] = str(ex)
    return render(request, "explorer_index.html", ctx.flatten())