Skip to content

feat(converter): add by_extension and tsv formats - #145

Open
Ankur Gupta (ankur-pattern) wants to merge 2 commits into
mainfrom
DATA-12008-converter-by-extension
Open

Ankur Gupta (ankur-pattern) wants to merge 2 commits into
mainfrom
DATA-12008-converter-by-extension

Conversation

@ankur-pattern

@ankur-pattern Ankur Gupta (ankur-pattern) commented Dec 2, 2026 •

Copy link
Copy Markdown

Summary

  • Adds format: by_extension to the converter task. Each record is converted with the converter listed under extensions for the extension of the file it was read from (CATERPILLAR_FILE_NAME_WRITE, set by the file and sftp tasks), so one pipeline can handle a source that arrives as either .xlsx or .tsv. A record whose extension is not listed is an error.
  • Adds a tsv format that converts a whole tab-separated file into one CSV record.
  • Existing formats are unchanged.

Test plan

  • go build ./..., go vet -copylocks=false ./..., go test -race ./...
  • A glob matching an .xlsx and a .tsv through one by_extension converter: the workbook gives one CSV record per sheet, and the TSV gives one CSV record with quotes, commas and CRLF line endings handled
  • A .csv with only tsv listed fails with no converter configured for file "report.csv"
  • test/pipelines/converter/convert_xls.yaml behaves as on main

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the per-file format routing and TSV conversion changes.

No open issues 🎉

What changed in this PR

Adds per-file format selection to converter tasks, allowing one pipeline to process reports arriving as XLSX or TSV.

Changes:

  • Adds by_extension routing with per-format configuration and validation.
  • Adds whole-file TSV-to-CSV conversion.
  • Documents the options and adds unit tests and a mixed-format example pipeline.
File Description
test/​pipelines/​converter/​by_extension.yaml Demonstrates XLSX and TSV conversion in one task.
test/​pipelines/​converter/​by_extension.tsv Provides sample TSV input.
internal/​pkg/​pipeline/​task/​converter/​tsv.go Implements TSV-to-CSV conversion.
internal/​pkg/​pipeline/​task/​converter/​README.md Documents extension routing and TSV behavior.
internal/​pkg/​pipeline/​task/​converter/​converter.go Adds converter selection by file extension.
internal/​pkg/​pipeline/​task/​converter/​converter_test.go Tests conversion, routing, and configuration errors.

Review effort: Balanced

@ankur-pattern

Copy link
Copy Markdown
Author

/argus review

@ankur-pattern
Ankur Gupta (ankur-pattern) force-pushed the DATA-12008-converter-by-extension branch from 6ed9014 to e94bed2 Compare December 2, 2026 09:18
@ankur-pattern
Ankur Gupta (ankur-pattern) force-pushed the DATA-12008-converter-by-extension branch from e94bed2 to 5e90787 Compare December 2, 2026 09:19
@ankur-pattern Ankur Gupta (ankur-pattern) changed the title feat(converter): pick the format from the file extension and add tsv feat(converter): add by_extension and tsv formats Dec 2, 2026
@ankur-pattern

Copy link
Copy Markdown
Author

/argus review

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.

3 participants