-
Notifications
You must be signed in to change notification settings - Fork 4
BDMS-408: add water level csv feature #288
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2203bfc
feat: add id to asset search properties & update things
jacob-a-brown ab49e11
fix: remove .DS_Store
jacob-a-brown 1d612f3
Merge pull request #283 from DataIntegrationGroup/jab-asset-search-up…
jirhiker 006d4dd
refactor: rename Measuring to Sampling Procedure in lexicon note_type
jacob-a-brown e929c02
refactor: update measuring notes to sampling procedure notes throughout
jacob-a-brown 5013b26
refactor: all all thing types to have sampling_procedure_notes
jacob-a-brown 29753b9
Merge pull request #285 from DataIntegrationGroup/measuring-notes-ref…
jirhiker 7dd1aac
feat: add water level csv feature
chasetmartin 795fcfd
fix: skip water level feature in test suite
chasetmartin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| @skip | ||
| @backend | ||
| @BDMS-TBD | ||
| @production | ||
| Feature: Bulk upload water level entries from CSV | ||
| As a hydrogeologist or data specialist | ||
| I want to upload a CSV file containing water level entry data for multiple wells | ||
| So that water level records can be created efficiently and accurately in the system | ||
|
|
||
| Background: | ||
| Given a functioning api | ||
| And valid lexicon values exist for: | ||
| | lexicon category | | ||
| | sampler | | ||
| | sample_method | | ||
| | level_status | | ||
| | data_quality | | ||
|
|
||
| @positive @happy_path @BDMS-TBD | ||
| Scenario: Uploading a valid water level entry CSV containing required and optional fields | ||
| Given a valid CSV file for bulk water level entry upload | ||
| And my CSV file is encoded in UTF-8 and uses commas as separators | ||
| And my CSV file contains multiple rows of water level entry data | ||
| And the CSV includes required fields: | ||
| | required field name | | ||
| | field_staff | | ||
| | well_name_point_id | | ||
| | field_event_date_time | | ||
| | measurement_date_time | | ||
| | sampler | | ||
| | sample_method | | ||
| | mp_height | | ||
| | level_status | | ||
| | depth_to_water_ft | | ||
| | data_quality | | ||
| And each "well_name_point_id" value matches an existing well | ||
| And "measurement_date_time" values are valid ISO 8601 timestamps with timezone offsets (e.g. "2025-02-15T10:30:00-08:00") | ||
| And the CSV includes optional fields when available: | ||
| | optional field name | | ||
| | water_level_notes | | ||
| When I upload the file to the bulk upload endpoint | ||
| Then the system returns a 201 Created status code | ||
| And the system should return a response in JSON format | ||
| And the response includes a summary containing: | ||
| | summary_field | value | | ||
| | total_rows_processed | 2 | | ||
| | total_rows_imported | 2 | | ||
| | validation_errors_or_warnings | 0 | | ||
| And the response includes an array of created water level entry objects | ||
|
|
||
| @positive @validation @column_order @BDMS-TBD | ||
| Scenario: Upload succeeds when required columns are present but in a different order | ||
| Given my CSV file contains all required headers but in a different column order | ||
| And the CSV includes required fields: | ||
| | required field name | | ||
| | well_name_point_id | | ||
| | measurement_date_time | | ||
| | sampler | | ||
| | sample_method | | ||
| | mp_height | | ||
| | level_status | | ||
| | depth_to_water_ft | | ||
| | data_quality | | ||
| When I upload the file to the bulk upload endpoint | ||
| Then the system returns a 201 Created status code | ||
| And the system should return a response in JSON format | ||
| And all water level entries are imported | ||
|
|
||
| @positive @validation @extra_columns @BDMS-TBD | ||
| Scenario: Upload succeeds when CSV contains extra, unknown columns | ||
| Given my CSV file contains extra columns but is otherwise valid | ||
| When I upload the file to the bulk upload endpoint | ||
| Then the system returns a 201 Created status code | ||
| And the system should return a response in JSON format | ||
| And all water level entries are imported | ||
|
|
||
| ########################################################################### | ||
| # NEGATIVE VALIDATION SCENARIOS | ||
| ########################################################################### | ||
|
|
||
| @negative @validation @BDMS-TBD | ||
| Scenario: No water level entries are imported when any row fails validation | ||
| Given my CSV file contains 3 rows of data with 2 valid rows and 1 row missing the required "well_name_point_id" | ||
| When I upload the file to the bulk upload endpoint | ||
| Then the system returns a 422 Unprocessable Entity status code | ||
| And the system should return a response in JSON format | ||
| And the response includes a validation error for the row missing "well_name_point_id" | ||
| And no water level entries are imported | ||
|
|
||
| @negative @validation @required_fields @BDMS-TBD | ||
| Scenario Outline: Upload fails when a required field is missing | ||
| Given my CSV file contains a row missing the required "<required_field>" field | ||
| When I upload the file to the bulk upload endpoint | ||
| Then the system returns a 422 Unprocessable Entity status code | ||
| And the system should return a response in JSON format | ||
| And the response includes a validation error for the "<required_field>" field | ||
| And no water level entries are imported | ||
|
|
||
| Examples: | ||
| | required_field | | ||
| | well_name_point_id | | ||
| | measurement_date_time | | ||
| | sampler | | ||
| | sample_method | | ||
| | mp_height | | ||
| | level_status | | ||
| | depth_to_water_ft | | ||
| | data_quality | | ||
|
|
||
| @negative @validation @date_formats @BDMS-TBD | ||
| Scenario: Upload fails due to invalid date formats | ||
| Given my CSV file contains invalid ISO 8601 date values in the "measurement_date_time" field | ||
| When I upload the file to the bulk upload endpoint | ||
| Then the system returns a 422 Unprocessable Entity status code | ||
| And the response includes validation errors identifying the invalid field and row | ||
| And no water level entries are imported | ||
|
|
||
| @negative @validation @numeric_fields @BDMS-TBD | ||
| Scenario: Upload fails due to invalid numeric fields | ||
| Given my CSV file contains values that cannot be parsed as numeric in numeric-required fields such as "mp_height" or "depth_to_water_ft" | ||
| When I upload the file to the bulk upload endpoint | ||
| Then the system returns a 422 Unprocessable Entity status code | ||
| And the response includes validation errors identifying the invalid field and row | ||
| And no water level entries are imported | ||
|
|
||
| @negative @validation @lexicon_values @BDMS-TBD | ||
| Scenario: Upload fails due to invalid lexicon values | ||
| Given my CSV file contains invalid lexicon values for "sampler", "sample_method", "level_status", or "data_quality" | ||
| When I upload the file to the bulk upload endpoint | ||
| Then the system returns a 422 Unprocessable Entity status code | ||
| And the response includes validation errors identifying the invalid field and row | ||
| And no water level entries are imported | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new feature is tagged
@backendand@productionand introduces steps likeGiven a valid CSV file for bulk water level entry upload, but there are no corresponding step implementations anywhere intests/features/steps(rg finds none). When the CI job runsuv run behave tests/features --tags="@backend and @production"the Behave run will stop with undefined steps and return a non-zero status, failing the BDD stage before any functionality is exercised. Please add the matching step definitions or adjust the tags so the suite stays green.Useful? React with 👍 / 👎.