usdigitalresponse / arpa-reporter

Web app to aid government agencies in reporting on ARPA grants.
Apache License 2.0
3 stars 0 forks source link

Extract dropdown values from correct tab #468

Closed trumanc closed 2 years ago

trumanc commented 2 years ago

The generateRules script was still pulling dropdown value lists from the hidden row within each tab that had inconsistent/incorrect values in many cases.

We had identified and corrected some of those mistakes manually in validation-rules.json, but hadn't addresses the issue systematically so we were regularly getting more errors reported.

This PR changes the system to ignore those often-incorrect lists, and instead uses the lists recorded in the Dropdowns tab of the worksheet to populate the extracted rules. The change resulted in around 370 lines of corrected validations.

It requires manually recording which field-ids map to which dropdown names, so I've added that mapping to the script, and included an error check so that when the Dropdowns tab is updated in the future it will remind us to update the mappings at the same time.

NOTE: This structure assumes that every instance of a certain field-id will adhere to the same list of values. If that assumption ever changes, then we'll have to update this system to include EC codes in the mappings.

ajhyndman commented 2 years ago

Oh, thanks so much for taking this on!