Module trase.tools.pcs.traders.clean

Functions

def combine_traders_by_pattern(pattern, clean_name, dryrun=True, autocommit=True, cnx=None, cur=None)

:param pattern: PostgreSQL-style pattern, e.g. 'TRADE%INC' :param clean_name: name of trader the labels matching "pattern" are merged into

def combine_traders_by_suffix(suffix_1, suffix_2, dryrun=True, autocommit=True, cnx=None, cur=None)

Find traders that have the same name except for suffixes suffix_1 and suffix_2. If dryrun is false, change trader of label suffix with suffix_2 to trader suffix with suffix_1, except when trader suffix with suffix_2 has a trase_id, in which case label suffix with suffix_1 is moved to trader suffix with suffix_2, except if trader suffix with suffix_1 also has a trase_id, in which case trader with suffix_2 is moved to group of trader with suffix_1.

def get_prefixes(end, cur=None)

Return dictionary of {prefix: node_id} for all trader labels with name ending in end