Skip to content

BDMS 626: groundwater level field activity & test fixes#609

Merged
jacob-a-brown merged 9 commits intokas-well-BDMS-626-inventory-ingestion-updates_v2from
jab-bdms-626-field-activity
Mar 18, 2026
Merged

BDMS 626: groundwater level field activity & test fixes#609
jacob-a-brown merged 9 commits intokas-well-BDMS-626-inventory-ingestion-updates_v2from
jab-bdms-626-field-activity

Conversation

@jacob-a-brown
Copy link
Copy Markdown
Contributor

Why

This PR addresses the following problem / context:

  • If an optional water level is added in the well inventory then a second FieldActivity record should be created where activity_type is groundwater level
  • level_status should be restricted to GroundWaterLevelReason enum values
  • Fixed some failing tests

How

Implementation summary - the following was changed / added / removed:

  • If an optional water level is added for the well inventory csv then a second FieldActivity record is created with activity_type="groundwater level". The newly created sample references this FieldActivity record instead of the one where activity_type="well inventory"
  • The field level_status was restricted to the GroundWaterLevelReason enum and mapped to the groundwater_level_reason field in the Observation model
  • Some failing tests were fixed, mostly having to do with comparing timezone-aware objects and using enums when

Notes

Any special considerations, workarounds, or follow-up work to note?

  • Use bullet points here

…nventory import

This commit adds a new field activity for groundwater level measurements
during the well inventory import process if an optional water level is provided.
The field activity is created with the type "groundwater level" and includes
notes about the measurement. This enhancement allows for better tracking
of groundwater level data associated with well inventory events.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for importing optional groundwater-level measurements as part of the well-inventory CSV flow, ensuring they are recorded as their own field activity and mapping the “level_status” field onto the observation’s groundwater-level reason.

Changes:

  • Create a second FieldActivity (activity_type="groundwater level") when water-level data is present and attach the created Sample to it.
  • Restrict WellInventoryRow.level_status to GroundwaterLevelReason enum values and map it to Observation.groundwater_level_reason.
  • Update/add tests around water-level import behavior and timezone-aware datetime comparisons.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
services/well_inventory_csv.py Creates a groundwater-level FieldActivity, attaches Sample to it, and maps level_status onto the Observation.
schemas/well_inventory.py Changes level_status to a GroundwaterLevelReason-validated field.
tests/test_well_inventory.py Adds coverage for water-level rows, updates enum usage in helper tests, and adjusts datetime expectations.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Copy Markdown
Contributor

@ksmuczynski ksmuczynski left a comment

Choose a reason for hiding this comment

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

Looking good! Codex had valid comments. I would address them, then re-request my review for approval.

Copy link
Copy Markdown
Contributor

@ksmuczynski ksmuczynski left a comment

Choose a reason for hiding this comment

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

Looks great, approved!

@jacob-a-brown jacob-a-brown merged commit 6fb61cf into kas-well-BDMS-626-inventory-ingestion-updates_v2 Mar 18, 2026
5 checks passed
@jacob-a-brown jacob-a-brown deleted the jab-bdms-626-field-activity branch March 18, 2026 18:47
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