Skip to content

feat(tests): relax validation rules and expand enum coverage in well-inventory-csv feature#548

Open
marissafichera wants to merge 1 commit intostagingfrom
marissa
Open

feat(tests): relax validation rules and expand enum coverage in well-inventory-csv feature#548
marissafichera wants to merge 1 commit intostagingfrom
marissa

Conversation

@marissafichera
Copy link
Contributor

BDMS-608: Relax well inventory CSV validation rules and expand enum coverage

@BDMS-608

Why

  • Validation rules in the feature file were stricter than necessary, causing real user-submitted CSVs to fail ingestion
  • Required fields did not reflect actual field usage in the field — elevation and measuring point data is not always available at time of entry
  • Contact and water level rules were all-or-nothing, blocking valid partial submissions
  • Several enum fields (address_type, state, well_hole_status, monitoring_status, well_pump_type) lacked explicit validation coverage

How

  • Moved site_name, elevation_ft, elevation_method, and measuring_point_height_ft from required to optional
  • Replaced "both contact_name and contact_organization required" rule with "at least one of the two required"
  • Removed all-or-nothing water level validation; water_level_date_time is now required only when depth_to_water_ft is provided, all other water level fields are independent and optional
  • Added negative scenarios for invalid address_type, state abbreviation, well_hole_status, monitoring_status, and well_pump_type with allowed values specified in each Given step
  • Added well_notes, well_measuring_notes, water_notes, historical_notes, well_hole_status, and monitoring_status to optional fields

Notes

  • Corresponding changes to the Pydantic schema (WellInventoryRow) are required for these rules to take effect in the backend — this PR covers the feature spec only
  • Allowed values for new enum scenarios are based on the current lexicon and should be kept in sync if the lexicon changes

…inventory-csv feature

- Move site_name, elevation_ft, elevation_method, and measuring_point_height_ft from required to optional
- Replace "both contact_name and contact_organization required" rule with "at least one required" rule
- Remove all-or-nothing water level rule; water_level_date_time now required only when depth_to_water_ft is provided, all other water level fields are independent and optional
- Add negative scenarios for invalid address_type, state abbreviation, well_hole_status, monitoring_status, and well_pump_type with allowed values specified
- Add well_notes, well_measuring_notes, water_notes, historical_notes, well_hole_status, and monitoring_status to optional fields
@marissafichera marissafichera requested review from Copilot and ksmuczynski and removed request for Copilot February 26, 2026 19:39
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56f6cbf678

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@negative @validation @BDMS-TBD
Scenario: Upload fails when a row has an invalid postal code format
Given my CSV file contains a row that has an invalid postal code format in contact_1_address_1_postal_code
Given my CSV file contains a row that has an invalid postal code format in contact_1_address_1_postal_code

Choose a reason for hiding this comment

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

P1 Badge Restore matching Given text for invalid postal code step

This edit changes the step text from row that has... to row that has..., but the registered Given step in tests/features/steps/well-inventory-csv-given.py still uses the original double-space phrase, so this scenario no longer matches any step definition. In a behave run, that makes the scenario undefined and prevents the validation assertion from executing.

Useful? React with 👍 / 👎.


@negative @validation @BDMS-TBD
Scenario: Upload fails when a row has a contact with an invalid "address_type"
Given my CSV file contains a row with an address_type value that is not one of: Work, Personal, Mailing, Physical

Choose a reason for hiding this comment

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

P1 Badge Add step implementations for newly added validation scenarios

The new enum/contact/water-level scenarios introduced in this section rely on Given/Then phrases that currently have no matching step decorators in the well-inventory step files (tests/features/steps/well-inventory-csv-given.py and tests/features/steps/well-inventory-csv-validation-error.py). Because these steps are undefined, the added scenarios fail at step resolution time and do not provide executable coverage.

Useful? React with 👍 / 👎.

@ksmuczynski
Copy link
Contributor

@marissafichera Two comments below related to potential future work, but I agree overall with the updates. Approved!

Regarding point no. 1 in the HOW section of the PR:

  1. Moved site_name, elevation_ft, elevation_method, and measuring_point_height_ft from required to optional
  • site_name: Yes
  • elevation_ft: Yes for now.
    • The Ocotillo codebase includes functionality to retrieve elevation data from the USGS National Map Elevation Point Query Service (EPQS). While this feature exists, it is not currently used during the ingestion of the well inventory CSV.
    • The ingestion logic uses the user-provided values and does not automatically query or verify them against the USGS DEM.
    • In the interest of getting new data into Ocotillo, let's relax the requirement. In the future, we can implement functionality to retrieve elevation data from the USGS National Map Elevation Point Query Service (EPQS), and assign elevation_method appropriately.
  • elevation_method: Yes for now
    • In the interest of getting new data into Ocotillo, let's relax the requirement. In the future, if we implement functionality to retrieve elevation data from the USGS National Map Elevation Point Query Service (EPQS), we can have this be assigned automatically
  • measuring_point_height_ft: Yes

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