예제 #1
0
def api_get_document(project_id):  # noqa: F401
    """Retrieve documents in order of review.

    After these documents were retrieved, the queue on the client side is
    updated.
    This resuest can get triggered after each document classification.
    Although it might be better to call this function after 20 requests on the
    client side.
    """

    new_instance = get_instance(project_id)

    if new_instance is None:  # don't use 'if not new_instance:'

        item = None
        pool_empty = True
    else:

        item = get_paper_data(project_id,
                              new_instance,
                              return_debug_label=True)
        item["doc_id"] = new_instance
        pool_empty = False

    response = jsonify({"result": item, "pool_empty": pool_empty})
    response.headers.add('Access-Control-Allow-Origin', '*')
    return response
예제 #2
0
def api_get_document(project_id):  # noqa: F401
    """Retrieve documents in order of review.

    After these documents were retrieved, the queue on the client side is
    updated.
    This resuest can get triggered after each document classification.
    Although it might be better to call this function after 20 requests on the
    client side.
    """

    new_instance = get_instance(project_id)
    payload = get_paper_data(project_id, new_instance, return_debug_label=True)
    payload["doc_id"] = new_instance

    response = jsonify(payload)
    response.headers.add('Access-Control-Allow-Origin', '*')
    return response