예제 #1
0
def _infer_restriction(project_id, _, module_params):
    '''
    Runs the training data and infers possible restrictions that can be made
    on the referential.
    
    ARGUMENTS (GET):
        project_id: ID for "link" project

    ARGUMENTS (POST):
        - data_params: none
        - module_params: {#TODO: fill with params from restrict}
    '''
    if module_params is None:
        module_params = dict()

    proj = ESLinker(project_id=project_id)
    training = proj.read_config_data('dedupe_linker', 'training.json')
    if not training:
        raise Exception('No training file was found in this project')
    module_params['training'] = training

    result = proj.infer('infer_restriction', module_params)

    # Write log
    proj._write_log_buffer(False)
    return result
def _link_results_analyzer(project_id, data_params, *argv):
    '''
    Runs the link results analyzer module
    
    wrapper around ESNormalizer.infer ?
    
    ARGUMENTS (GET):
        project_id: ID for "normalize" project

    ARGUMENTS (POST):
        - data_params: {
                "module_name": module to fetch from
                "file_name": file to fetch
                }    
    '''
    proj = ESLinker(project_id=project_id)
    proj.load_data(data_params['module_name'], data_params['file_name'])
    result = proj.infer('link_results_analyzer', {})

    # Write log
    proj._write_log_buffer(False)
    return result