I've a mapping_table.
xlsx file which contains correct mapping of family attributes
pg_rollup(string), gl_product_group(float), gl_product_group_desc and
product_type(string) and an input file with asin (unique identifier) and the family
attributes mapping. There are 3 unique values for pg_rollup. Each pg_rollup
contains several gl info and each gl info contains several product_types. Write a
python code to check inconsistency.
There will be defects for 4 columns: pg_rollup, gl_product_group,
gl_product_group_desc, and product_type. There can be all possible combinations
where one or more columns might have missing or incorrect values. The number of
combinations can get quite large. Create columns "product_type message",
"gl_product_group_desc message", "gl_product_group message", "pg_rollup message",
"Expected Value PT", "Expected Value GL", "Expected Value GL desc", "Expected Value
pg rollup".
Write consistency messages "Defect : Value Missing", "Defect : Value Incorrect" or
"No Defect" in attribute message columns. Return suggested values in Expected
Attribute column. If product_type in input_data, doesn't have a corresponding
mapping in the mapping table that means the value has some spelling errors/case
errros. Use fuzzy wuzzy to get closest match and suggest the value.
Write a python code that will follow below steps:
Step 1: Check product type for any blank value and incorrect value Defects.
If blank value, then return "Defect : Value Missing" in "product_type message"
column and move to next row.
If incorrect value like case sensitive error, spelling mistake, then return "Defect
: Value Incorrect" in "product_type message" column and suggest correct value in
"Expected Value PT" column.
If value is correct then return "No Defect" in "product_type message" column move
to Step 2.
Step 2: Take existing product_type value if correct or "Expected Value PT" if
Defect as reference and lookup gl_product_group and desc info. Compare them with
existing value and write consistency messages in "Expected Value GL" column.
If blank value then return "Defect : Value Missing" and suggest correct one in
"Expected Value GL" column.
If incorrect value like case sensitive error, spelling mistake, then return "Defect
: Value Incorrect" and suggest correct value in Expected g"Expected Value GL desc"
column.
If value is correct then "No Defect" and move to Step 3.
Step 3: Repeat the same process for pg_rollup
Step 4 : Create a column of "Overall Defect" and return Defect or No Defect.
Now when I say "if incorrect, suggest correct one" for the attributes incorrect can
be classified into follwoing - 1. Incorrect mapped value, Case sensitive errors and
Missing values.