mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 02:44:18 +00:00
Add corpus analysis stuff
This commit is contained in:
parent
7757c12dc4
commit
08aafb8f99
@ -54,12 +54,14 @@ def corpus(corpus_id):
|
|||||||
def corpus_analysis(corpus_id):
|
def corpus_analysis(corpus_id):
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
corpus = Corpus.query.get_or_404(corpus_id)
|
corpus = Corpus.query.get_or_404(corpus_id)
|
||||||
|
corpus.status = 'start analysis'
|
||||||
query = request.args.get('query')
|
query = request.args.get('query')
|
||||||
logger.warning('Query first: {}'.format(query))
|
logger.warning('Query first: {}'.format(query))
|
||||||
hits_per_page = request.args.get('hits_per_page', 30)
|
hits_per_page = request.args.get('hits_per_page', 30)
|
||||||
context = request.args.get('context', 10)
|
context = request.args.get('context', 10)
|
||||||
dl_form = QueryDownloadForm()
|
dl_form = QueryDownloadForm()
|
||||||
form = QueryForm(hits_per_page=hits_per_page, context=context, query=query)
|
form = QueryForm(hits_per_page=hits_per_page, context=context, query=query)
|
||||||
|
db.session.commit()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logger.warning('Data has been sent!')
|
logger.warning('Data has been sent!')
|
||||||
|
@ -452,6 +452,7 @@ class Corpus(db.Model):
|
|||||||
status = db.Column(db.String(16))
|
status = db.Column(db.String(16))
|
||||||
title = db.Column(db.String(32))
|
title = db.Column(db.String(32))
|
||||||
user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
|
user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
|
||||||
|
analysis_ip = db.Column(db.String(16))
|
||||||
# Relationships
|
# Relationships
|
||||||
files = db.relationship('CorpusFile',
|
files = db.relationship('CorpusFile',
|
||||||
backref='corpus',
|
backref='corpus',
|
||||||
|
@ -83,4 +83,6 @@ CorpusList.STATUS_COLORS = {"unprepared": "grey",
|
|||||||
"preparable": "orange",
|
"preparable": "orange",
|
||||||
"preparing": "yellow",
|
"preparing": "yellow",
|
||||||
"prepared": "green",
|
"prepared": "green",
|
||||||
"default": "red"};
|
"start analysis": "yellow",
|
||||||
|
"analysing": "green",
|
||||||
|
"stop analysis": "red", "default": "red"};
|
||||||
|
@ -61,11 +61,13 @@
|
|||||||
statusElement.classList.remove(...Object.values(CorpusList.STATUS_COLORS));
|
statusElement.classList.remove(...Object.values(CorpusList.STATUS_COLORS));
|
||||||
statusElement.classList.add(CorpusList.STATUS_COLORS[status] || CorpusList.STATUS_COLORS['default']);
|
statusElement.classList.add(CorpusList.STATUS_COLORS[status] || CorpusList.STATUS_COLORS['default']);
|
||||||
statusElement.innerText = status;
|
statusElement.innerText = status;
|
||||||
if (status === 'prepared') {
|
if (status === 'prepared' || status === 'start analysis' || status === 'analysing') {
|
||||||
var analyseBtn = document.getElementById('analyse');
|
var analyseBtn = document.getElementById('analyse');
|
||||||
analyseBtn.classList.remove('hide');
|
analyseBtn.classList.remove('hide');
|
||||||
|
}
|
||||||
|
if (status === 'prepared' || status === 'start analysis' || status === 'analysing') {
|
||||||
var prepareBtn = document.getElementById('prepare');
|
var prepareBtn = document.getElementById('prepare');
|
||||||
prepareBtn.classList.add('hide')
|
prepareBtn.classList.add('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
28
migrations/versions/0aa38a7973c5_.py
Normal file
28
migrations/versions/0aa38a7973c5_.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 0aa38a7973c5
|
||||||
|
Revises: 1210adfe1e34
|
||||||
|
Create Date: 2019-11-06 09:33:46.296653
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '0aa38a7973c5'
|
||||||
|
down_revision = '1210adfe1e34'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('corpora', sa.Column('analysis_ip', sa.String(length=16), nullable=True))
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_column('corpora', 'analysis_ip')
|
||||||
|
# ### end Alembic commands ###
|
Loading…
Reference in New Issue
Block a user