<commit_before># -*- coding: utf-8 -*-
from __future__ import unicode_literals

import logging

# from flask.ext.script import Command, Option

from udata.commands import manager
from udata.search import es

log = logging.getLogger(__name__)


@manager.command
def init():
    '''Initialize or update data and indexes'''
    print 'Initialize or update ElasticSearch mappings'
    es.initialize()

    print 'TODO: Apply DB migrations if needed'
    print 'TODO: Feed initial data if needed'
    print 'TODO: create an user if needed'<commit_msg>Record migrations on initialize<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals

import logging

# from flask.ext.script import Command, Option

from udata.commands import manager, yellow
from udata.search import es

from .db import migrate

log = logging.getLogger(__name__)


@manager.command
def init():
    '''Initialize or update data and indexes'''
    log.info('Apply DB migrations if needed')
    migrate(record=True)

    log.info('Initialize or update ElasticSearch mappings')
    es.initialize()

    log.info('%s: Feed initial data if needed', yellow('TODO'))
    log.info('%s: Create an administrator', yellow('TODO'))
{'fraction_non_alphanumeric': 0.1011608623548922, 'fraction_numerical': 0.001658374792703151, 'mean_word_length': 4.247826086956522, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6850821', 'n_tokens_mistral': 348, 'n_tokens_neox': 338, 'n_words': 125}