Module trase.tools.pcs.traders.match
Functions
def get_known_matches(names, cnx=None, cur=None)-
Retrieved known synonyms from database and user-suggested matches in s3 bucket.
def get_rejected_matches(names, cur=None)-
Retrieve rejected matches from s3 bucket.
def get_trader_names_dictionary_from_file(filename, cur=None)def import_trader_names_from_file(filename)def match_trader_name(name, names, known_matches, rejected_matches, filename, country, commodity, traders_type, cutoff)-
Suggest possible matches for
namein listnames def run_trader_names_matching(names, filename, country, commodity, traders_type, cutoff)def run_trader_names_matching_from_db(ref_id=None, country=None, commodity=None, traders_type=None, cutoff=0.8, cur=None)def run_trader_names_matching_from_file(filename, cutoff=0.8)-
Performs trader name matching based off a csv file. Expects a csv file with a single column that contains raw trader names.
:param filename: the path or name of a csv file with raw trader names :param cutoff: a parameter (0 to 1) that determines how strict the string matching algorithm will be
def write_match_to_s3(match, filename, country, commodity, traders_type)def write_rejection_to_s3(match, filename, country, commodity, traders_type)