mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Update for new cqi package
This commit is contained in:
parent
e000324e8e
commit
4f8ba7cb3e
@ -7,7 +7,6 @@ from ..events import connected_sessions
|
||||
from ..models import Corpus, User
|
||||
import cqi
|
||||
import math
|
||||
from app import logger
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
@ -67,7 +66,8 @@ def corpus_analysis_get_meta_data(corpus_id):
|
||||
|
||||
# emit data
|
||||
payload = metadata
|
||||
response = {'code': 200, 'desc': 'Corpus meta data', 'msg': 'OK', 'payload': payload}
|
||||
response = {'code': 200, 'desc': 'Corpus meta data', 'msg': 'OK',
|
||||
'payload': payload}
|
||||
socketio.emit('corpus_analysis_send_meta_data', response, room=request.sid)
|
||||
|
||||
|
||||
@ -94,7 +94,9 @@ def corpus_analysis_query(query):
|
||||
'payload': payload}
|
||||
socketio.emit('corpus_analysis_query', response, room=request.sid)
|
||||
return
|
||||
payload = {**query_status, 'match_count': results.attrs['size']}
|
||||
payload = {'status': query_status,
|
||||
'msg': cqi.api.specification.lookup[query_status],
|
||||
'match_count': results.attrs['size']}
|
||||
response = {'code': 200, 'desc': None, 'msg': 'OK', 'payload': payload}
|
||||
socketio.emit('corpus_analysis_query', response, room=request.sid)
|
||||
# TODO: Stop here and add a new method for transmission
|
||||
@ -130,12 +132,14 @@ def corpus_analysis_inspect_match(payload):
|
||||
if client is None:
|
||||
response = {'code': 424, 'desc': 'No client found for this session',
|
||||
'msg': 'Failed Dependency'}
|
||||
socketio.emit('corpus_analysis_inspect_match', response, room=request.sid)
|
||||
socketio.emit('corpus_analysis_inspect_match', response,
|
||||
room=request.sid)
|
||||
return
|
||||
try:
|
||||
corpus = client.corpora.get('CORPUS')
|
||||
s = corpus.structural_attributes.get('s')
|
||||
payload = s.export(payload['first_cpos'], payload['last_cpos'], context=10)
|
||||
payload = s.export(payload['first_cpos'], payload['last_cpos'],
|
||||
context=10)
|
||||
payload['cpos_ranges'] = True
|
||||
except cqi.errors.CQiException as e:
|
||||
payload = {'code': e.code, 'desc': e.description, 'msg': e.name}
|
||||
@ -169,7 +173,9 @@ def corpus_analysis_session_handler(app, corpus_id, user_id, session_id):
|
||||
socketio.sleep(3)
|
||||
client = cqi.CQiClient('cqpserver_{}'.format(corpus_id))
|
||||
try:
|
||||
payload = client.connect()
|
||||
connect_status = client.connect()
|
||||
payload = {'code': connect_status,
|
||||
'msg': cqi.api.specification.lookup[connect_status]}
|
||||
except cqi.errors.CQiException as e:
|
||||
payload = {'code': e.code, 'desc': e.description, 'msg': e.name}
|
||||
response = {'code': 500, 'desc': None,
|
||||
|
Loading…
Reference in New Issue
Block a user