Skip to content
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

Merged
merged 8 commits into from
Dec 27, 2023
Merged

Conversation

d-shree
Copy link
Contributor

@d-shree d-shree commented Dec 26, 2023

No description provided.

@d-shree d-shree changed the title Draft: Add validation for tagging type Add validation for tagging type Dec 27, 2023
Copy link
Contributor

@harshithere harshithere left a 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']
Copy link
Contributor

@harshithere harshithere Dec 27, 2023

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

Copy link
Contributor Author

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.

logger.info(f"Is match: {is_match}")

if not is_match:
mismatch_headers_set =set(column_headers).symmetric_difference(set(expected_headers))
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have added that change

is_valid = True
error = ''
if tagging_type == const.CONVERSATION_TAGGING:
is_match, mismatch_headers = validate_headers(input_file, tagging_type)
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have fixed this

@d-shree d-shree merged commit 5094419 into master Dec 27, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants