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

Capture column names and Regex column name matching #135

Merged
merged 10 commits into from
Dec 3, 2024

Conversation

ollietulloch
Copy link
Contributor

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.

@ollietulloch ollietulloch changed the title Capture column names and Regex column names Capture column names and Regex column name matching Nov 28, 2024
test 'should mutate regexp column names' do
lines = [
%w[1234 STRING_HEADING ABC123],
%w[NUMRIC_ONLY STRING_VALUE ALPHA_NUMBERIC]
Copy link
Contributor

Choose a reason for hiding this comment

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

NUMRIC typo?

Copy link
Contributor

Choose a reason for hiding this comment

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

ALPHA_NUMBERIC too? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

test/table_test.rb Outdated Show resolved Hide resolved
Copy link
Contributor

@kenny-lee-1 kenny-lee-1 left a comment

Choose a reason for hiding this comment

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

LGTM

@ollietulloch ollietulloch merged commit f07c39e into main Dec 3, 2024
19 of 20 checks passed
@ollietulloch ollietulloch deleted the feature/map-column-names branch December 3, 2024 16:33
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