def reconcile_op(dataset, query):
    try:
        limit = max(1, min(100, int(query.get('limit'))))
    except:
        limit = 5

    matches = find_matches(dataset, query.get('query', ''))
    matches = matches.limit(limit)

    results = []
    for match in matches:
        results.append({
            'name': match['entity'].name,
            'score': match['score'],
            'type': [{
                'id': '/' + dataset.name,
                'name': dataset.label
                }],
            'id': match['entity'].id,
            'uri': url_for('entities.view', id=match['entity'].id, _external=True),
            'match': match['score']==100
        })
    return {
        'result': results, 
        'num': len(results)
        }
def match():
    dataset_arg = request.args.get('dataset')
    dataset = Dataset.find(dataset_arg)
    matches = find_matches(dataset,
                           request.args.get('name'),
                           filter=request.args.get('filter'),
                           exclude=arg_int('exclude'))
    return query_pager(matches)
def match():
    dataset_arg = request.args.get('dataset')
    dataset = Dataset.find(dataset_arg)
    matches = find_matches(dataset,
        request.args.get('name'),
        filter=request.args.get('filter'),
        exclude=arg_int('exclude'))
    return query_pager(matches)
Exemple #4
0
def match():
    dataset_arg = request.args.get('dataset')
    dataset = Dataset.find(dataset_arg)
    matches = find_matches(dataset,
                           request.args.get('name'),
                           filter=request.args.get('filter'),
                           exclude=arg_int('exclude'))
    pager = Pager(matches)
    return jsonify(pager.to_dict())
Exemple #5
0
def match():
    dataset_arg = request.args.get('dataset')
    dataset = Dataset.find(dataset_arg)
    matches = find_matches(dataset,
                           request.args.get('name'),
                           filter=request.args.get('filter'),
                           exclude=arg_int('exclude'))
    pager = Pager(matches)
    return jsonify(pager.to_dict())
Exemple #6
0
def reconcile_op(dataset, query):
    try:
        limit = max(1, min(100, int(query.get("limit"))))
    except:
        limit = 5

    matches = find_matches(dataset, query.get("query", ""))
    matches = matches.limit(limit)

    results = []
    for match in matches:
        results.append(
            {
                "name": match["entity"].name,
                "score": match["score"],
                "type": [{"id": "/" + dataset.name, "name": dataset.label}],
                "id": match["entity"].id,
                "uri": url_for("entities.view", id=match["entity"].id, _external=True),
                "match": match["score"] == 100,
            }
        )
    return {"result": results, "num": len(results)}