Ejemplo n.º 1
0
def providers_datasets_list(provider):
    provider_doc = queries.get_provider(provider)
    query = {'provider_name': provider_doc["name"]}
    projection = {
        "_id": False,
        "tags": False,
        "enable": False,
        "lock": False,
        "concepts": False,
        "codelists": False
    }
    #docs = [doc for doc in queries.col_datasets().find(query, projection)]
    docs = queries.col_datasets().find(query, projection)

    page = request.args.get('page', default=1, type=int)
    per_page = request.args.get('per_page', default=10, type=int)
    if per_page > 50:
        per_page = 50
    pagination = queries.Pagination(docs, page, per_page)
    meta = {
        "page": pagination.page,
        "pages": pagination.pages,
        "per_page": pagination.per_page,
        "total": pagination.total,
    }
    _docs = [doc for doc in pagination.items]
    #return json_tools.json_response(_docs, meta=meta)
    return json_tools.json_response_async(_docs, meta=meta)
Ejemplo n.º 2
0
def categories_view(provider):
    provider_doc = queries.get_provider(provider)
    docs = queries.col_categories().find(
        {
            "provider_name": provider_doc["name"],
            "enable": True
        }, {"_id": False})
    return json_response(json_util.dumps(docs, default=json_util.default))
Ejemplo n.º 3
0
def datasets_view(provider):
    provider_doc = queries.get_provider(provider)
    query = {'provider_name': provider_doc["name"]}
    projection = {"_id": False, "tags": False,
                  "enable": False, "lock": False,
                  "dimension_list": False, "attribute_list": False,
                  "concepts": False, "codelists": False}
    docs = queries.col_datasets().find(query, projection)
    return json_response(json_util.dumps(docs, default=json_util.default))
Ejemplo n.º 4
0
def providers_datasets_list(provider):
    provider_doc = queries.get_provider(provider)
    query = {'provider_name': provider_doc["name"]}
    projection = {"_id": False, "tags": False,
                  "enable": False, "lock": False,
                  "concepts": False, "codelists": False}
    #docs = [doc for doc in queries.col_datasets().find(query, projection)]
    docs = [doc for doc in queries.col_datasets().find(query, projection)]
    return json_tools.json_response(docs)
Ejemplo n.º 5
0
def providers_unit(provider):
    projection = {
        "_id": False,
        "lock": False,
        "metadata": False,
        "enable": False,
        "version": False
    }
    provider_doc = queries.get_provider(provider, projection=projection)
    return json_tools.json_response(provider_doc)
Ejemplo n.º 6
0
def providers_datasets_list(provider):
    provider_doc = queries.get_provider(provider)
    query = {'provider_name': provider_doc["name"]}
    projection = {
        "_id": False,
        "tags": False,
        "enable": False,
        "lock": False,
        "concepts": False,
        "codelists": False
    }
    #docs = [doc for doc in queries.col_datasets().find(query, projection)]
    docs = [doc for doc in queries.col_datasets().find(query, projection)]
    return json_tools.json_response(docs)
Ejemplo n.º 7
0
def datasets_view(provider):
    provider_doc = queries.get_provider(provider)
    query = {'provider_name': provider_doc["name"]}
    projection = {
        "_id": False,
        "tags": False,
        "enable": False,
        "lock": False,
        "dimension_list": False,
        "attribute_list": False,
        "concepts": False,
        "codelists": False
    }
    docs = queries.col_datasets().find(query, projection)
    return json_response(json_util.dumps(docs, default=json_util.default))
Ejemplo n.º 8
0
def providers_datasets_list(provider):
    provider_doc = queries.get_provider(provider)
    query = {'provider_name': provider_doc["name"]}
    projection = {"_id": False, "tags": False,
                  "enable": False, "lock": False,
                  "concepts": False, "codelists": False}
    #docs = [doc for doc in queries.col_datasets().find(query, projection)]
    docs = queries.col_datasets().find(query, projection)
    
    page = request.args.get('page', default=1, type=int)
    per_page = request.args.get('per_page', default=10, type=int)
    if per_page > 50:
        per_page = 50
    pagination = queries.Pagination(docs, page, per_page)
    meta = {
        "page": pagination.page,
        "pages": pagination.pages,
        "per_page": pagination.per_page,
        "total": pagination.total,
    }
    _docs = [doc for doc in pagination.items]
    #return json_tools.json_response(_docs, meta=meta)
    return json_tools.json_response_async(_docs, meta=meta)
Ejemplo n.º 9
0
def datasets_list_keys(provider):
    provider_doc = queries.get_provider(provider)
    query = {'provider_name': provider_doc["name"]}
    docs = queries.col_datasets().distinct("slug", filter=query)
    return json_tools.json_response(docs)
Ejemplo n.º 10
0
def provider_view(slug):
    provider_doc = queries.get_provider(slug)
    return json_response(
        json_util.dumps(provider_doc, default=json_util.default))
Ejemplo n.º 11
0
def datasets_list_keys(provider):
    provider_doc = queries.get_provider(provider)
    query = {'provider_name': provider_doc["name"]}
    docs = queries.col_datasets().distinct("slug", filter=query)
    return json_tools.json_response(docs)
Ejemplo n.º 12
0
def providers_unit(provider):
    provider_doc = queries.get_provider(provider)
    return json_tools.json_response(provider_doc)
Ejemplo n.º 13
0
def providers_unit(provider):
    provider_doc = queries.get_provider(provider)
    return json_tools.json_response(provider_doc)
Ejemplo n.º 14
0
def providers_unit(provider):
    projection = {"_id": False, "lock": False, "metadata": False, 
                  "enable": False, "version": False}
    provider_doc = queries.get_provider(provider, projection=projection)
    return json_tools.json_response(provider_doc)
Ejemplo n.º 15
0
def provider_view(slug):
    provider_doc = queries.get_provider(slug)
    return json_response(json_util.dumps(provider_doc, default=json_util.default))
Ejemplo n.º 16
0
def categories_view(provider):
    provider_doc = queries.get_provider(provider)
    docs = queries.col_categories().find({"provider_name": provider_doc["name"],
                                          "enable": True},
                                         {"_id": False})
    return json_response(json_util.dumps(docs, default=json_util.default))