def index(collection_id): """ --- get: summary: Fetch cross-reference results description: >- Fetch cross-reference matches for entities in the collection with id `collection_id` parameters: - in: path name: collection_id required: true schema: type: integer responses: '200': description: OK content: application/json: schema: type: object allOf: - $ref: '#/components/schemas/QueryResponse' properties: results: type: array items: $ref: '#/components/schemas/XrefResponse' tags: - Xref - Collection """ get_index_collection(collection_id) result = XrefQuery.handle(request, collection_id=collection_id) return XrefSerializer.jsonify_result(result)
def index(collection_id): """ --- get: summary: Fetch cross-reference results description: >- Fetch cross-reference matches for entities in the collection with id `collection_id` parameters: - in: path name: collection_id required: true schema: type: integer - in: query name: evaluation_mode required: false schema: type: bool default: false responses: '200': description: OK content: application/json: schema: type: object allOf: - $ref: '#/components/schemas/QueryResponse' properties: results: type: array items: $ref: '#/components/schemas/XrefResponse' tags: - Xref - Collection """ get_index_collection(collection_id, request.authz.READ) result = XrefQuery.handle(request, collection_id=collection_id) pairs = [] for xref in result.results: pairs.append((xref.get("entity_id"), xref.get("match_id"))) judgements = pairwise_judgements(pairs, collection_id) for xref in result.results: key = (xref.get("entity_id"), xref.get("match_id")) xref["judgement"] = judgements.get(key) return XrefSerializer.jsonify_result(result)
def index(collection_id): """ --- get: summary: Fetch cross-reference results description: >- Fetch cross-reference matches for entities in the collection with id `collection_id` parameters: - in: path name: collection_id required: true schema: type: integer responses: '200': description: OK content: application/json: schema: type: object allOf: - $ref: '#/components/schemas/QueryResponse' properties: results: type: array items: $ref: '#/components/schemas/XrefResponse' tags: - Xref - Collection """ get_index_collection(collection_id) result = XrefQuery.handle(request, collection_id=collection_id) context_id = result.parser.getint('context_id', request.authz.id) if context_id is not None: require(request.authz.can_read_role(context_id)) pairs = [] for xref in result.results: pairs.append((xref.get('entity_id'), xref.get('match_id'))) decisions = Linkage.decisions(pairs, context_id) for xref in result.results: key = (xref.get('entity_id'), xref.get('match_id')) xref['decision'] = decisions.get(key) return XrefSerializer.jsonify_result(result)