Skip to content

BDMS 389 inspired: status history refactor for wells#299

Closed
jacob-a-brown wants to merge 7 commits into
stagingfrom
status-history-refactor
Closed

BDMS 389 inspired: status history refactor for wells#299
jacob-a-brown wants to merge 7 commits into
stagingfrom
status-history-refactor

Conversation

@jacob-a-brown

Copy link
Copy Markdown
Contributor

Why

This PR addresses the following problem / context:

  • The thing table had a field to store is_suitable_for_datalogger, but no way to store if it is open. After multiple discussions we came to the conclusion that both suitability for a datalogger at a well, as well as if it is open, are actually statuses since they are mutable. They can change over time. Because of this, those two pieces of information should be stored in the status_history table
  • All fields in WellData.CurrentUse are being mapped to the well_purpose table. This includes the legacy Open, unequipped well. This is a status to indicate if a well is open or not, so should be recorded in the status_history table and not the well_purpose table.

How

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

  • Removed is_suitable_for_datalogger from the Thing model
  • Added the status_type Datalogger Suitability Status to the lexicon, as well as the status_values Datalogger can be installed and Datalogger cannot be installed as the possible values
  • Added the status_type Open Status to the lexicon, as well as the status_values Open and Closed as possible values
  • Updated transfers/well_transfer.py to write to the status_history table for Datalogger Suitability Status.
  • If WellData.CurrentUser evaluates to Open, unequipped well then a record is made in the status_history table where status_type="Open Status" and status_value="Open". There is no way to determine if a well is closed, though.

Notes

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

  • After these changes are made to staging I'll merge with well-inventory-csv and make requisite updates.

this will allow the refactor from fields to the status history
since these statuses can change for a well over time
…us history table

these statuses are changeable, so they should be in the status history
table rather than as standalone fields in the thing table
this is a status of the well not a well purpose
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Files with missing lines Coverage Δ
db/thing.py 98.05% <100.00%> (+0.07%) ⬆️
schemas/thing.py 95.19% <100.00%> (ø)

@jirhiker jirhiker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good. seems like the project structure and style is starting to settle into place

@jacob-a-brown

Copy link
Copy Markdown
Contributor Author

Should we close this PR since it is now in well-inventory-csv?

@jirhiker jirhiker closed this Dec 23, 2025
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