merge_machine/linker.py
def add_col_matches(self, column_matches):
        '''
        Adds a configuration file with the column matches between source and
        referential.
        
        INPUT:
            - column_matches: json file as dict
        '''
        
        # Remove labeller if it exists
        if self._has_labeller():
            self._remove_labeller()
        
        # TODO: add checks on file
        if (self.source is None) or (self.ref is None):
            raise RuntimeError('source or referential were not loaded (add_selected_project) and/or (load_project_to_merge)')
        
        # Remove duplicates from columns matches
        column_matches = [{'source': list(set(match['source'])), 
                           'ref': list(set(match['ref'])),
                           'exact_only': match.get('exact_only', False)} \
                            for match in column_matches]
        
        # Remove matches with missing columns on one side or the othre
        column_matches = [match for match in column_matches \
                          if match['source'] and match['ref']]

        if not column_matches:
            raise ValueError("You have to specify at least one pair of columns" \
                             + " in column matches.")
        
        # Add matches
        self.upload_config_data(column_matches, 'es_linker', 'column_matches.json')
        
        # Select these columns for normalization in source and ref
        
        # TODO: this will cover add_certain_col_matches
        # Add to log
        for file_name in self.metadata['log']:
            self.metadata['log'][file_name]['add_selected_columns']['completed'] = True        
        self._write_metadata()

        Adds a configuration file with the column matches between source and
        referential.
        
        INPUT:
            - column_matches: json file as dict
        
Adds a configuration file with the column matches between source and
referential.

json file as dict
Adds a configuration file with the column matches between source and referential . json file as dict
def add_col_matches(self, column_matches):
        if self._has_labeller():
            self._remove_labeller()
        if (self.source is None) or (self.ref is None):
            raise RuntimeError('source or referential were not loaded (add_selected_project) and/or (load_project_to_merge)')
        column_matches = [{'source': list(set(match['source'])), 
                           'ref': list(set(match['ref'])),
                           'exact_only': match.get('exact_only', False)} \
                            for match in column_matches]
        column_matches = [match for match in column_matches \
                          if match['source'] and match['ref']]
        if not column_matches:
            raise ValueError("You have to specify at least one pair of columns" \
                             + " in column matches.")
        self.upload_config_data(column_matches, 'es_linker', 'column_matches.json')
        for file_name in self.metadata['log']:
            self.metadata['log'][file_name]['add_selected_columns']['completed'] = True        
        self._write_metadata()
def add_col_matches ( self , column_matches ) : if self . _has_labeller ( ) : self . _remove_labeller ( ) if ( self . source is None ) or ( self . ref is None ) : raise RuntimeError ( 'source or referential were not loaded (add_selected_project) and/or (load_project_to_merge)' ) column_matches = [ { 'source' : list ( set ( match [ 'source' ] ) ) , 'ref' : list ( set ( match [ 'ref' ] ) ) , 'exact_only' : match . get ( 'exact_only' , False ) } for match in column_matches ] column_matches = [ match for match in column_matches if match [ 'source' ] and match [ 'ref' ] ] if not column_matches : raise ValueError ( "You have to specify at least one pair of columns" + " in column matches." ) self . upload_config_data ( column_matches , 'es_linker' , 'column_matches.json' ) for file_name in self . metadata [ 'log' ] : self . metadata [ 'log' ] [ file_name ] [ 'add_selected_columns' ] [ 'completed' ] = True self . _write_metadata ( )
Adds a configuration file with the column matches between source and
referential.
Adds a configuration file with the column matches between source and referential .
'''
        Adds a configuration file with the column matches between source and
        referential.
        
        INPUT:
            - column_matches: json file as dict
        ''' # Remove labeller if it exists # TODO: add checks on file # Remove duplicates from columns matches # Remove matches with missing columns on one side or the othre # Add matches # Select these columns for normalization in source and ref # TODO: this will cover add_certain_col_matches # Add to log
self
column_matches