-
Notifications
You must be signed in to change notification settings - Fork 7
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
Capture column names and Regex column name matching #135
Conversation
test/table_test.rb
Outdated
test 'should mutate regexp column names' do | ||
lines = [ | ||
%w[1234 STRING_HEADING ABC123], | ||
%w[NUMRIC_ONLY STRING_VALUE ALPHA_NUMBERIC] |
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.
NUMRIC typo?
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.
ALPHA_NUMBERIC too? 😄
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.
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.
LGTM
This PR adds two pieces of funtionality.
Regex column names:
This allows regex matching of column names where column name(s) may change slightly between files. If the regex matches the column header, the data will be mapped as usual. If the regex doesn't match, an invalid header error will be raised.
Capturing column names as data
Column names may contain data themselves, configuring
map_columname_to
at the column level will add the column name to each row of mapped data. It does not include any of the more sophisticated mapping functionality that other fields have, e.g. joining fields, cleaning values etc.vcf/table_test.rb
includes a test that combines both of these.