Repository navigation
fix(well-inventory): set observation release status (BDMS-1559) - #1053
Open
ksmuczynski wants to merge 2 commits into
Open
ksmuczynski wants to merge 2 commits into
ksmuczynski wants to merge 2 commits into
Conversation
The well inventory importer sets the well's release status based on the owner's answer to "Owner acknowledges data will be publicly available", but it leaves the groundwater level observation as draft. The public EDR waterlevels collection (ogc_waterlevels) shows an observation only when both the observation and its well are public. So the collection hides this importer's observations, even on public wells. The importer now gives each observation it creates the same release status as its well, whether public, private or draft. The BDMS-1561 backfill applies this rule to the observations this importer created before this fix, so old and new well inventory observations follow it. The rule is in a new domain function, observation_release_status. The water level CSV importer also leaves its observations as draft, and a separate PR will fix that importer using the same function. observation_release_status copies the well's status when it is public or private, and returns draft for any other status. Public and private are the only statuses that indicate whether the well's data may be published. In this importer the well is always new, so its status is always public, private or draft. The water level CSV importer adds observations to existing wells, so it will be the only caller to pass other statuses. The importer sets the observation's status once, when it creates the observation. If staff later make a draft well public, its imported observations stay draft, and the EDR collection keeps hiding them until someone makes them public too. Making a public well private does hide its observations, because the EDR collection also checks the well's status. Refs BDMS-1559
Before this fix, the tests gave these results: - The importer test failed when the owner answered True or False. The importer left the observation as draft, and the test expects public or private. - The importer test passed when the owner left the answer blank. The importer already left that observation as draft, which is the correct status. This case will fail if a later change gives that observation any other status. - The domain tests could not run, because observation_release_status did not exist. The domain tests check that observation_release_status: - Copies public, private and draft. - Returns draft for no status, an empty string, and provisional, final, published and archived. - Returns draft for "Public" with a capital P. The views compare the exact lowercase value, so they would not treat that well as public either. The importer test imports one row with a water level for each owner answer (True, False and blank). It checks that: - The observation's status is public, private or draft, and equals the well's. - The sample, field activity and field event stay draft. - The observation appears in ogc_waterlevels only when the answer is True. The fix exists to make these observations appear there, so the test checks the collection itself. A later change to the view's filter that hides them fails the test. Refs BDMS-1559
Contributor
Coverage✅ 82.03% total — gate is 75%. Coverage for the Python files changed in this PR
|
Contributor
|
Your pull request is automatically being deployed to Dagster Cloud.
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the observation release-status change.
No open issues 🎉
What changed in this PR
This PR fixes release-status handling in the well inventory importer so newly imported groundwater level observations on public wells can appear in the public EDR waterlevels collection.
Changes:
- Adds a domain rule that copies public/private well status to observations and defaults other statuses to draft.
- Applies the rule when creating observations, leaving sample and visit records unchanged.
- Adds unit and import tests covering release statuses and visibility in
ogc_waterlevels.
| File | Description |
|---|---|
tests/test_well_inventory.py |
Tests observation status and public collection visibility for each acknowledgement response. |
tests/test_domain_water_levels.py |
Tests copied statuses and draft fallback behavior. |
services/well_inventory_csv.py |
Sets new observations’ release status from their well. |
domain/water_levels.py |
Defines the observation release-status rule. |
Review effort: Balanced
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR makes the well inventory importer give each groundwater level observation it creates the same release status as its well. After this change, an observation the importer creates for a public well appears in the public EDR waterlevels collection.
Why
This PR addresses the following problem / context:
ogc_waterlevelsshows an observation only when both the observation and its well are public, so these observations never appear there.How
Implementation summary - the following was changed / added / removed:
observation_release_statustodomain/water_levels.py. It returns the well's status when that status is public or private, and draft otherwise.services/well_inventory_csv.py.observation_release_status.ogc_waterlevelsincludes the observation when the answer is True, and does not include it when the answer is False or blank.Notes
Any special considerations, workarounds, or follow-up work to note?
NGWMN_WaterLevels) requires those three records to be public as well, so it does not include these observations. NGWMN is left for a separate ticket.last_observation_dateon the publicwater_wellslayer now includes them. Materialized layers, such asogc_well_water_column, include them after their next refresh.Refs BDMS-1559