Skip to content

BDMS-221-225: New measuring_point_history model#244

Merged
jacob-a-brown merged 5 commits into
bdms-221from
kas-bdms-221-225-core-well-info-models-schemas
Nov 12, 2025
Merged

BDMS-221-225: New measuring_point_history model#244
jacob-a-brown merged 5 commits into
bdms-221from
kas-bdms-221-225-core-well-info-models-schemas

Conversation

@ksmuczynski

Copy link
Copy Markdown
Contributor

Why

This PR addresses the following problem / context:

  • This PR addresses the need to track a well's official measuring point height over time.
  • The purpose of this PR is to make these intermediate updates available to @jacob-a-brown as we continue to co-work on the main BDMS-221 task.

How

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

  • Created a new model, measuring_point_history, to store the official measuring point and description for a Thing.
  • A new One-To-Many relationship named measuring_points was added to the Thing model. This addresses the fact that a Thing may have multiple measuring points over time.

Notes

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

  • This PR does NOT address updates to the schemas, tests, or transfer scripts.

The current schema lacks a way to track the authoritative measuring point height over time.

Created a new model, `measuring_point_history`, to store the official measuring point and description for a Thing. This table serves as a specialized historical log that tracks the measuring point over time.
A Thing may have multiple measuring points over time. As such, the `Thing` model requires a relationship to the new `measuring_point_history` model.

A new One-To-Many relationship named `measuring_points` was added to the `Thing` model.
It would be useful to track the reason for updating the measuring point.

Create new `reason` field in the `measuring_point_history` model.
Comment thread db/measuring_point_history.py Outdated
Comment thread db/measuring_point_history.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

since this model only pertains to the thing model I don't think that it needs to go into its own file. It can go into db/thing.py

@ksmuczynski ksmuczynski Nov 12, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Happy to do this. Just curious, how are we deciding which models get their own files? When I'm looking for info about a table/model, I'm expecting it to be listed in the db directory.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't know if we have a standard, but when making a new model I put it into an existing file if it only pertains to other models in that file (e.g. WellPurpose and WellCasingMaterial). [Now that I think of it, I don't know if I've created a standalone model, but it makes sense for me to have the polymorphic models be in their own files for ease of understanding.]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Curious what @jirhiker thoughts are.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@jirhiker I merged this so I can use develop off of it - where the table is defined in the codebase won't affect how it's used in the schemas/tests. If you think it should be in the db/thing.py file I can move it there easily.

The `back_populates` parameter in the relationship section was updated to match the relationship name in the `THing` model.

The `mp_description` field was renamed `measuring_point_description` for clarity.
@jacob-a-brown jacob-a-brown merged commit be7cb51 into bdms-221 Nov 12, 2025
4 checks passed
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.

2 participants