-
Notifications
You must be signed in to change notification settings - Fork 4
BDMS 350: add groundwater_level_accuracy to observation model #314
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
5 commits
Select commit
Hold shift + click to select a range
c03f4a2
refactor: rename data_quality to groundwater_level_accuracy
jacob-a-brown 64b9b6b
feat: update observation model and transfer to include groundwater_le…
jacob-a-brown 8a6326f
feat: add groundwater_level_accuracy to wl transfer
jacob-a-brown ca0109e
fix: remove print debugging statement
jacob-a-brown 6aeb49a
fix: skip records with invalud DataQuality values
jacob-a-brown 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
36 changes: 36 additions & 0 deletions
36
tests/transfers/test_water_level_with_unknown_data_quality.py
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,36 @@ | ||
| from db import Observation, FieldEvent, FieldActivity, Sample | ||
| from db.engine import session_ctx | ||
| from transfers.well_transfer import WellTransferer | ||
| from transfers.waterlevels_transfer import WaterLevelTransferer | ||
|
|
||
|
|
||
| def test_water_level_with_unknown_data_quality(): | ||
| pointids = ["MG-020"] | ||
| wt = WellTransferer(pointids=pointids) | ||
| wt.transfer() | ||
|
|
||
| wlt = WaterLevelTransferer() | ||
| input_df, cleaned_df = wlt._get_dfs() | ||
| wlt.input_df = input_df | ||
| wlt.cleaned_df = cleaned_df | ||
| wlt.cleaned_df.at[wlt.cleaned_df.index[0], "DataQuality"] = "faux" | ||
|
|
||
| with session_ctx() as session: | ||
| wlt._transfer_hook(session) | ||
|
|
||
| assert len(wlt.errors) == 1 | ||
| error = wlt.errors[0] | ||
| assert error["pointid"] == "MG-020" | ||
| assert error["table"] == "WaterLevels" | ||
| assert error["field"] == "DataQuality" | ||
| assert error["error"] == "Unknown DataQuality value: faux" | ||
|
|
||
| assert session.query(FieldEvent).count() == 2 | ||
| assert session.query(FieldActivity).count() == 2 | ||
| assert session.query(Sample).count() == 2 | ||
| assert session.query(Observation).count() == 2 | ||
|
|
||
| session.query(Observation).delete() | ||
| session.query(Sample).delete() | ||
| session.query(FieldActivity).delete() | ||
| session.query(FieldEvent).delete() |
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.
Uh oh!
There was an error while loading. Please reload this page.