Exemple #1
0
def cache_tracker_synset_history():
    # tasks called by celery beat are unfortunatelly outside of app context, so it needs to be added manually
    with create_app_celery().app_context():
        paginated_synsets = models.TrackerSynsetsHistory.query.filter(
            models.TrackerSynsetsHistory.search_by_form_filter('', '', '', ''))
        cache_key = "sh-count-{}_{}_{}_{}".format('', '', '', '')
        paginate(paginated_synsets,
                 1,
                 50,
                 total_cache_key=cache_key,
                 update=True)
Exemple #2
0
def senses_relations_history(page):
    filter_form = SenseRelationsHistoryForm()

    users = get_user_name_list()
    relations = get_sense_relation_list()

    cache_key = 'lurh-count-{}_{}_{}_{}_{}'.format(
        request.args.get('date_from', ''),
        request.args.get('date_to', ''),
        request.args.get('sense_id', ''),
        request.args.get('user', ''),
        request.args.get('relation_type', '')
    )

    paginated_senses = TrackerSenseRelationsHistory.query.filter(
        TrackerSenseRelationsHistory.search_by_form_filter(
            request.args.get('date_from', ''),
            request.args.get('date_to', ''),
            request.args.get('sense_id', ''),
            request.args.get('user', ''),
            request.args.get('relation_type', '')
        )
    )

    pagination = paginate(paginated_senses, page, 50, cache_key)

    return render_template(
        'sense/sense-relations-history.html',
        form=filter_form,
        users=users,
        relations=relations,
        history=pagination,
        keycloak=KeycloakServiceClient()
    )
Exemple #3
0
def annotator_disagreement(page):
    filter_form = EmotionDisagreementForm()

    users = get_user_emotion_list()

    cache_key = 'emo_dis-count-' + \
                request.args.get('sense_id', '') + "_" + \
                request.args.get('user', '')

    paginated_emotions = EmotionDisagreement.query.filter(
        EmotionDisagreement.search_by_form_filter(
            request.args.get('sense_id', ''), request.args.get('user', '')))

    pagination = paginate(paginated_emotions, page, 50, cache_key)

    return render_template('/emotion/annotator-disagreement.html',
                           form=filter_form,
                           users=users,
                           emotions=pagination)
Exemple #4
0
def synsets_history(page):
    filter_form = SynsetHistoryForm()

    users = get_user_name_list()

    paginated_synsets = TrackerSynsetsHistory.query.filter(
        TrackerSynsetsHistory.search_by_form_filter(
            request.args.get('date_from', ''), request.args.get('date_to', ''),
            request.args.get('synset_id', ''), request.args.get('user', '')))
    cache_key = "sh-count-{}_{}_{}_{}".format(
        request.args.get('date_from', ''),
        request.args.get('date_to', ''),
        request.args.get('synset_id', ''),
        request.args.get('user', ''),
    )

    pagination = paginate(paginated_synsets, page, 50, cache_key)

    return render_template('synset/synset-history.html',
                           form=filter_form,
                           users=users,
                           synsets=pagination)
Exemple #5
0
def senses_history(page):

    filter_form = SenseHistoryForm()
    users = get_user_name_list()

    paginated_senses = TrackerSenseHistory.query.filter(
        TrackerSenseHistory.search_by_form_filter(
            request.args.get('date_from', ''),
            request.args.get('date_to', ''),
            request.args.get('sense_id', ''),
            request.args.get('user', ''),
            request.args.get('pos', ''),
            request.args.get('status', '')
        )
    )
    cache_key = 'luh-count-{}_{}_{}_{}_{}_{}'.format(
        request.args.get('date_from', ''),
        request.args.get('date_to', ''),
        request.args.get('sense_id', ''),
        request.args.get('pos', ''),
        request.args.get('status', ''),
        request.args.get('user', '')
    )

    pagination = paginate(paginated_senses, page, 50, cache_key)

    return render_template(
        'sense/sense-history.html',
        form=filter_form,
        users=users,
        sense_history=pagination,
        status=status(),
        pos=parts_of_speech(),
        domain=domain(),
        keycloak=KeycloakServiceClient()
    )
Exemple #6
0
def synsets_relations_history(page):
    filter_form = SynsetRelationsHistoryForm()

    users = get_user_name_list()
    relations = get_synset_relation_list()

    cache_key = 'srh-count-{}_{}_{}_{}_{}'.format(
        request.args.get('date_from', ''), request.args.get('date_to', ''),
        request.args.get('synset_id', ''), request.args.get('user', ''),
        request.args.get('relation_type', ''))

    paginated_synsets = TrackerSynsetsRelationsHistory.query.filter(
        TrackerSynsetsRelationsHistory.search_by_form_filter(
            request.args.get('date_from', ''), request.args.get('date_to', ''),
            request.args.get('synset_id', ''), request.args.get('user', ''),
            request.args.get('relation_type', '')))

    pagination = paginate(paginated_synsets, page, 50, cache_key)

    return render_template('synset/synset-relations-history.html',
                           form=filter_form,
                           users=users,
                           relations=relations,
                           history=pagination)