CMSgov / hpt-validator-cli

CLI for validating CMS Hospital Price Transparency machine-readable files
Other
4 stars 3 forks source link

Support reading from gzipped files #17

Open Myles1 opened 1 month ago

Myles1 commented 1 month ago

Thanks for publishing and maintaining this project. Super helpful stuff! Feel free to just close this PR if you don't want it. No biggie either way :)

One line description of your change (less than 72 characters)

Support reading from .csv.gz and .json.gz files.

Problem

Explain the context and why you're making that change. What is the problem you're trying to solve? In some cases there is not a problem and this can be thought of being the motivation for your change.

I'm compressing the data files locally and need to unzip them before I can run the hpt-validator-cli. This just lets us read gzipped files directly.

Solution

Describe the modifications you've done.

Allow reading directly from gzipped data files.

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Create a gzipped data file $gzip my_file.json You should now have a file named my_file.json.gz Run hpt-validator-cli on that new file. Ensure the results are the same as they were on the unzipped file.

shaselton-usds commented 2 weeks ago

@Myles1 Thank you so much for your pull request and your patience.

I think this definitely makes sense and is a value-add.

The one thing that I would request to be changed is to avoid adding the .gz as an additional format to be passed into the CLI. It really isn't a different format as it is a compression of the acceptable formats. Would it be possible to update the PR to auto detect whether the acceptable formats are compressed via .gz and then run through the expected business logic to validate the file appropriately?

Once updated we'll gladly accept this PR with much thanks!