BDMS-227-231-aquifer-geology-models#248
Merged
jacob-a-brown merged 37 commits intoNov 24, 2025
Merged
Conversation
…s-227-231-additional-well-info-models # Conflicts: # .pre-commit-config.yaml # core/lexicon.json # tests/features/environment.py
…abulary fields - Implemented `AquiferSystem` model for master reference of aquifer systems and hydrogeologic units - Added table index for aquifer system name - Included categories and terms for aquifer type and significance level
Added an association proxy, `things`, to the `AquiferSystem` model. This provides direct access to the `Thing` objects.
- Created ThingAquiferAssociation model to manage many-to-many relationships between Thing and AquiferSystem - Updated Thing model to include aquifer_associations relationship for linking to aquifer systems
Added an `aquifers` proxy to the Thing model to directly access the AqufierSystems associated with a particular Thing.
This commit addresses the need to handle scenarios where multiple well screens may target different aquifers. Added the aquifer_system_id foreign key to the WellScreen model. This creates a direct, physical link between a screened interval and the specific hydrogeologic unit it monitors.
… Thing relationship updates - Introduced GeologicFormation model as a master reference for geologic formations - Created ThingFormationAssociation model to manage many-to-many relationships between Thing and GeologicFormation, including depth interval fields - Updated Thing model to include formation_associations relationship and association proxy for direct access to related geologic formations
Replace the hardcoded `srid` in the `aquifer_system` and `geologic_formation` models with the SRID_WGS84 from constants.
…and `ThingFormationAssociation` models Add `lazy="joined"` to `ThingAquiferAssociation` and `ThingFormationAssociation` models to eagerly load relationships.
- Refactor `lithology` field to a lexicon_term - Add lithology values to lexicon
This is a placeholder file to allow the API to map formation names to codes. It can be periodically updated from the authoritative source (.e.g USGS).
…formations Add comprehensive response schemas for AquiferSystem and GeologicFormation models. Integrate these schemas into Thing/Well response models to provide complete geological context. Changes: - Add AquiferSystemResponse with name, type, scale, and boundary fields - Add GeologicFormationResponse with formation code, lithology, and boundary - Add ThingFormationAssociationResponse with depth interval data - Update WellResponse to include aquifers and formations lists - Add field validators to convert ORM association objects to response schemas - Update WellScreenResponse to include aquifer_system and geologic_formation - Update CreateWellScreen and UpdateWellScreen with geological associations
jacob-a-brown
left a comment
Contributor
There was a problem hiding this comment.
The updates from BDMS-221 have been incorporated into BDMS-227. If you merge BDMS-227 with this branch (and push back to this PR) the length of the PR will become much shorter (and it'll have the most current work).
…FormationAssociation`
…`schemas/thing.py`
…imary_aquifer_type` - Add AquiferType model to store multiple aquifer characteristics per association - Rename AquiferSystem.aquifer_type to primary_aquifer_type for clarity - Update ThingAquiferAssociation with aquifer_types relationship - Update related schemas to use primary_type This enables capturing wells that encounter multiple aquifer characteristics (e.g., both fractured and confined) without compound naming.
# Conflicts: # .pre-commit-config.yaml # core/enums.py # core/lexicon.json # db/__init__.py # schemas/thing.py # tests/features/environment.py # tests/features/steps/well-additional-information.py
Add eager loading to aquifer and geology relationships to the `thing` model.
…ologic_formation`
jacob-a-brown
approved these changes
Nov 24, 2025
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.
Why
This PR addresses the following problem / context:
Aquifer model:
AquiferTypemodel separates aquifer identity (name) from its characteristics (types), following proper database normalization.Geology model:
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-227 task.
How
Implementation summary - the following was changed / added / removed:
AQUIFER MODEL
AquiferSystemmodel with controlled vocabulary fields and spatial boundary supportAquiferTypemodel to store observed aquifer characteristics at specific well locations (e.g., Fractured, Confined, Perched)aquifer_system_idforeign key. This is important for identifying which aquifer a specific screen is monitoringGEOLOGY MODEL
GeologicFormationmodel for master reference of geologic formationsThingFormationAssociationmodel to link formations with things (e.g., wells)Thingmodel to support formation associationsNotes
Any special considerations, workarounds, or follow-up work to note?