-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add validation for tagging type #23
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smaller suggestions
|
||
EXPECTED_COLUMNS_MAPPING = { | ||
"conversation_tagging": ['scenario', 'scenario_category', 'situation_str', 'call', 'data_label'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works for now but ideally even field type will be checked in the future. So something like:
"conversation_tagging": {'scenario':[str], 'scenario_category':[int], 'situation_str':, 'call':, 'data_label':}
But this is good for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will add this in the next iteration, when I add the changes for the download functions.
skit_labels/utils.py
Outdated
logger.info(f"Is match: {is_match}") | ||
|
||
if not is_match: | ||
mismatch_headers_set =set(column_headers).symmetric_difference(set(expected_headers)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead lets just remove non-required columns and ensure that the required ones are there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have added that change
skit_labels/utils.py
Outdated
is_valid = True | ||
error = '' | ||
if tagging_type == const.CONVERSATION_TAGGING: | ||
is_match, mismatch_headers = validate_headers(input_file, tagging_type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General nitpick: These functions can work with just one return value. Instead of passing is_match checking that mismatch_headers has values should suffice and make the code more readable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have fixed this
No description provided.