API Documentation

ExactMatch

ExactMatch
Inheritance diagram of goma.exactmatch
class goma.exactmatch.ExactMatch[source]

Bases: goma.basematch.BaseMatch

match(match_details, mapping_list)[source]
matching based on exact entries of all columns of the
mapping list
Parameters:
  • match_details (list) – holds the information based on which the mapping should be conducted, a row entry is structured as [‘Detail’, ‘Value’]
  • mapping_list (list) – holds the mapping information, the first row describes the properties on which mapping should be conducted and a column named target
  • start_col (int) – starting column for the matching algorithms of the mapping_list

The exact match uses a given mapping_list, e.g

Property1 | Property2 Property3 Target
Value1_1 Value2_1 Value3_1 Target1
Value1_2 Value2_2 Value3_2 Target2

Given the above tables, the matching searches row by row, if all criteria in the matching list of a given list of details (match_details) are met.

For a given list of match_details, e.g.

Property1 Value1_2
Property2 Value2_2
Property3 Value3_2

the match returns in a Target 2. If one matching criteria is not met, the match returns None.

PriorityMatch

PriorityMatch Priority Match class
Inheritance diagram of goma.prioritymatch
class goma.prioritymatch.PriorityMatch[source]

Bases: goma.basematch.BaseMatch

Priority Match class

match(match_details, mapping_list, start_col=0)[source]
matching based on prioritizing entries in the right column of the
mapping list
Parameters:
  • match_details (list) – holds the information based on which the mapping should be conducted, a row entry is structured as [Detail ,Value]
  • mapping_list (list) – hold the mapping information, the first row describes the properties on which mapping should be conducted and a column named target
  • start_col (int) – starting column for the matching algorithms of the mapping_list
Returns:

target value which has been matched

Return type:

string

The priority match uses a given mapping_list, e.g

Property1 | Property2 Property3 Target
Value1_1   Value3_1 Target1
Value1_1   Value3_2 Target2
  Value2_1 Value3_3 Target3
  Value2_1 Value3_4 Target4

Given the above tables, the matching searches column by column, starting on the left hand side (highest priority columns), for the respective mapping list.

For a given list of match_details, e.g.

Property1 Value1_2
Property2 Value2_1
Property3 Value3_3

the match returns in a first step a 2x4 matrix

  Value2_1 Value3_3 Target3
  Value2_1 Value3_4 Target4

As a second step, the empty columns are removed and the exact match algorithm is applied to the remaining properties to find the target, which for the given example yields Target3.

If for column no matching is found it continues recursively at the next column and searches for the respective property, i.e Property3.