Module trase.tools.pcs.diff

Functions

def get_datasets_diff(new_ref_id, old_ref_id, year=None, cnx=None, cur=None)
def get_traders_hierarchies_diff(hierarchy, other_hierarchy, mode='plaintext', cur=None)

Return differences between 2 traders hierarchies.

The following output modes are available: - plaintext; - csv; - json.

def get_traders_hierarchies_diff_data_vs_db(data, mode='plaintext', cur=None)

Return differences between the traders hierarchy currently in the database and a traders hierarchy specified as external data.

Example of data:

data = [
    {"label": "BUNGE IBERICA SA", "trader": "BUNGE IBERICA", "group": "BUNGE"},
    {"label": "ADM DO BRASIL LTDA", "trader": "ADM DO BRASIL"},
    {"trader": "CARGILL AGRICOLA SA", "group": "CARGILL"},
]
def get_traders_hierarchies_diff_dataset_vs_dataset(ref_id, other_ref_id, mode='plaintext', cur=None)

Return differences between the traders hierarchies of two datasets.

def get_traders_hierarchies_diff_dataset_vs_db(ref_id, mode='plaintext', cur=None)

Return differences between the traders hierarchy of a dataset and the traders hierarchy currently in the database for the dataset traders.

def get_traders_trase_ids_diff_data_vs_db(data, cur=None)

Return differences between trader trase ids currently in the database and a trader trase ids specified as external data.

Example of data:

data = [{'trader': 'AMAGGI', 'trase_id': 'BR-TRADER-03908754'}]