-
Notifications
You must be signed in to change notification settings - Fork 4
BDMS 233: transfer updates #261
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
Closed
Closed
Changes from all commits
Commits
Show all changes
117 commits
Select commit
Hold shift + click to select a range
0ac45c1
WIP: first stab at well additional information
jacob-a-brown 466055b
Merge branch 'staging' into bdms-227-jab-bdms-229
jacob-a-brown edf3c38
WIP: well additional information bdd tests
jacob-a-brown 7197ede
feat: use function to retrieve polymoprhic records
jacob-a-brown 826a6b6
feat: pass bdd test for well completion date
jacob-a-brown b34f62e
feat: pass well driller name bdd test
jacob-a-brown 3d89a3e
feat: implement well construction method
jacob-a-brown ea00c9c
feat: implement well casing diameter in inches
jacob-a-brown cd4e174
feat: implement well pump type
jacob-a-brown ca6b6c4
feat: implement well pump depth
jacob-a-brown 7e6f9a1
Merge branch 'bdms-227' into bdms-227-jab-bdms-229
jacob-a-brown a0d939f
Merge branch 'bdms-227' into bdms-227-jab-updates-to-pass-tests
jacob-a-brown e1df131
fix: remove duplicate lexicon
jacob-a-brown 7d37154
refactor: test for casing materials
jacob-a-brown 8e70c85
Merge branch 'bdms-227-jab-bdms-229' into bdms-227-jab-updates-to-pas…
jacob-a-brown 08d7aed
feat: update tests to include well casing materials
jacob-a-brown c0b80fb
fix: fix casing materials test
jacob-a-brown 3000e79
Merge branch 'kas-bdms-221-225-core-well-info-models-schemas' into ka…
ksmuczynski 878ef3b
fix: uncomment pytest from pre commit
jacob-a-brown 13f2a45
refactor: rename Permission -> PermissionHistory | move mixin to same…
jacob-a-brown 6e036e5
feat: add permission types to lexicon
jacob-a-brown 091637c
refactor: import PermissionHistoryMixin from correct dir
jacob-a-brown 71d8534
fix: fix imports for newly renamed PermissionHistory
jacob-a-brown 825ec4a
feat: add permission_type to lexicon
jacob-a-brown 8ed0ce4
feat: update util to correspond with bdms 221
jacob-a-brown 3b36c49
fix: sync bdms 221/227 for util functions
jacob-a-brown 1657bb9
feat: implement permissions
jacob-a-brown 307f47c
feat: add is_suitable_for_datalogger to thing
jacob-a-brown 7923551
feat: add 'AquiferSystem' model with relationships and controlled voc…
ksmuczynski 4ddec89
refactor: remove completed TODO about lexicon updates
ksmuczynski 29d7b91
refactor: clarify relationship name and add association proxy
ksmuczynski 0d3f807
refactor: clarify proxy purpose doc statement
ksmuczynski c3393d9
feat: add ThingAquiferAssociation model and update Thing relationships
ksmuczynski af092dd
feat: add `aqufiers` proxy to Thing model
ksmuczynski e330df4
feat: Link WellScreen to AquiferSystem
ksmuczynski 04a28be
feat: add GeologicFormation and ThingFormationAssociation models with…
ksmuczynski 477247a
feat(lexicon): add "formation_code" category and associated terms to …
ksmuczynski d359fa1
rafactor(model): Remove TODO about adding formation_code values to le…
ksmuczynski fc81327
refactor(lexicon): refine terms associated with "geographic_scale".
ksmuczynski b01d172
refactor(model): Replace hardcoded srid with SRID_WGS84 from constants
ksmuczynski f35e61d
refactor(model): Add geologic_formation foreign key to WellScreen model.
ksmuczynski 390d6f3
refactor(model): enhance relationships for `ThingAquiferAssociation` …
ksmuczynski c738afb
refactor(model): refactor `lithology` field to a lexicon_term
ksmuczynski 4d55177
feat(core): create placeholder `formations.json`
ksmuczynski 8362f9c
refactor: add aquifer and geology related models to `db/__init__.py`
ksmuczynski 39aeefa
feat: add aquifer and geology related enums.
ksmuczynski 47b8415
feat(schemas): add response schemas for aquifer systems and geologic …
ksmuczynski 1c4eda8
Merge pull request #237 from DataIntegrationGroup/bdms-227-jab-bdms-229
jacob-a-brown 82e100f
Merge branch 'staging' into bdms-227
jacob-a-brown 38e86b2
Merge branch 'bdms-227' into bdms-227-jab-updates-to-pass-tests
jacob-a-brown b4c8beb
fix: fix artifacts from merge conflicts
jacob-a-brown d1149f5
refactor: rename `ThingFormationAssociation` usages to `ThingGeologic…
ksmuczynski c85f971
refactor: rename `ThingFormationAssociation` file`ThingGeologicFormat…
ksmuczynski 853e450
refactor(schema): remove aquifer and formation field validators from …
ksmuczynski 2c33a79
feat: implement data source tests for well additional information
jacob-a-brown 8ef2592
fix: remove outdated notes
jacob-a-brown ced10b9
feat: transfer water level sample permissions
jacob-a-brown e48b71e
feat: transfer permissions from legacy db
jacob-a-brown 171b41b
feat: transfer well construction information
jacob-a-brown a9cec8a
WIP: transfers for well additional info
jacob-a-brown 722425f
feat: implement origin_type
jacob-a-brown 3c92552
Merge branch 'bdms-227-jab-updates-to-pass-tests' into bdms-227-trans…
jacob-a-brown 75265f3
feat: transfer well source information
jacob-a-brown 2b90f86
feat: add Quemado Mutual Water and Sewage Works Association to organi…
jacob-a-brown cf72461
fix: remove erroneous or check
jacob-a-brown 58b92f8
feat: transfer well pump type
jacob-a-brown 4e9876e
fix: change Air-rotary to Air-Rotary to correspond with lu table
jacob-a-brown e9639bf
feat(model): Add `AquiferType` model and rename `aquifer_type` to `pr…
ksmuczynski 1de7f47
Merge branch 'bdms-227' into kas-227-231-additional-well-info-models
ksmuczynski ba2b296
feat(model): add eager loading
ksmuczynski 910d5b3
feat(schema): refactor GeoJSON responses for `aquifer_system` and `ge…
ksmuczynski 31b8602
Merge pull request #248 from DataIntegrationGroup/kas-227-231-additio…
jacob-a-brown 827652a
Merge branch 'bdms-227' into bdms-227-jab-updates-to-pass-tests
jacob-a-brown 1342b8d
fix: fix __table_args__ for aquifer and geology
jacob-a-brown 88419b7
fix: add geologic_formation relation to WellScreen
jacob-a-brown 1a23dff
fix: add missing comma
jacob-a-brown d82b163
fix: use BaseResponseModel for GeoJSONProperties in location schema
jacob-a-brown 20af430
fix: include baseresponseinfo in location geojson properties
jacob-a-brown 5778b74
feat: implement aquifer_systems in thing response
jacob-a-brown c4f9de0
feat: fix aquifer systems test
jacob-a-brown d3abd83
fix: return aquifer system and types in dict
jacob-a-brown b4cd84e
feat: implement geologic_formations from feature files
jacob-a-brown f0fe4c2
Merge branch 'bdms-227-jab-updates-to-pass-tests' into bdms-227-trans…
jacob-a-brown fbfa908
fix: remove duplicate well pump types in lexicon
jacob-a-brown e6af5e6
fix: use OpenWellLoggerOK for is_suitable_for_datalogger field
jacob-a-brown d3c8101
feat: update CreateWell for transfers
jacob-a-brown 2ea4cb1
fix: return aquifer/geology str instead of full response
jacob-a-brown 0994bec
refactor: clean up permission history testing data
jacob-a-brown 3041102
fix: use origin_type to retrieve well depth source
jacob-a-brown 5e8fdad
refactor: use __tabename__ for polymorphic mixins
jacob-a-brown 95ff8c0
fix: use __tablename__ for NotesMixin add_note
jacob-a-brown ca6d16d
Merge branch 'bdms-227-jab-updates-to-pass-tests' into bdms-227-trans…
jacob-a-brown 69b2b7a
refactor: move well_construction_notes to polymorphic table
jacob-a-brown 404a8f0
feat: transfer other, water, and construction notes for wells
jacob-a-brown fe8541b
feat: transfer Measuring notes
jacob-a-brown 5c6b444
feat: transfer location notes
jacob-a-brown bdff12e
refactor: use sets in feature tests for comparison
jacob-a-brown 8d055bd
Merge branch 'bdms-227-jab-updates-to-pass-tests' into bdms-227-trans…
jacob-a-brown 27128fc
Merge branch 'bdms-227-transfer-updates' into bdms-233-transfer-updates
jacob-a-brown 19d736a
refactor: return permission history records for a well
jacob-a-brown ddef82d
Merge branch 'bdms-227-jab-updates-to-pass-tests' into bdms-227-trans…
jacob-a-brown d0cf3fe
Merge branch 'bdms-227-transfer-updates' into bdms-233-transfer-updates
jacob-a-brown eac24a2
Merge pull request #256 from DataIntegrationGroup/bdms-227-jab-update…
jacob-a-brown 3ada894
Merge branch 'bdms-227' into bdms-227-transfer-updates
jacob-a-brown 6f7e5a1
Merge branch 'bdms-227-transfer-updates' into bdms-233-transfer-updates
jacob-a-brown d81de21
Merge pull request #257 from DataIntegrationGroup/bdms-227-transfer-u…
jacob-a-brown b3957f2
Merge branch 'bdms-227' into bdms-233-transfer-updates
jacob-a-brown 656e159
fix: use regex to check for pump type in well construction notes
jacob-a-brown 183d275
fix: ensure permissions are not null during transfer
jacob-a-brown 2d0f2b6
refactor: check for existence of permissions before converting
jacob-a-brown 1147e77
Merge branch 'staging' into bdms-227
jacob-a-brown 7ba6155
Merge branch 'bdms-227' into bdms-227-transfer-updates
jacob-a-brown 3342a29
Merge branch 'bdms-227-transfer-updates' into bdms-233-transfer-updates
jacob-a-brown cc2b29a
refactor: use NotesMixin for FieldEvent
jacob-a-brown a8d177a
fix: import NotesMixin correctly for FieldEvent
jacob-a-brown 001d243
refactor: rename Other to General for notes
jacob-a-brown 2d64410
feat: add SiteNotes for field events
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
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| """ | ||
| SQLAlchemy model for the AquiferSystem table. | ||
|
|
||
| This is a master reference table for aquifer systems and hydrogeologic units. | ||
| """ | ||
|
|
||
| from typing import List, TYPE_CHECKING | ||
|
|
||
| from sqlalchemy import Text, Index | ||
| from sqlalchemy.orm import relationship, Mapped, mapped_column | ||
| from sqlalchemy.ext.associationproxy import association_proxy, AssociationProxy | ||
| from geoalchemy2 import Geometry | ||
|
|
||
| from db.base import Base, AutoBaseMixin, ReleaseMixin | ||
| from db.lexicon import lexicon_term | ||
|
|
||
| from constants import SRID_WGS84 | ||
|
|
||
| if TYPE_CHECKING: | ||
| from db.thing import WellScreen, ThingAquiferAssociation, Thing | ||
| from db.aquifer_type import AquiferType | ||
|
|
||
|
|
||
| class AquiferSystem(Base, AutoBaseMixin, ReleaseMixin): | ||
| __versioned__ = {} | ||
|
|
||
| name: Mapped[str] = mapped_column( | ||
| nullable=False, | ||
| unique=True, | ||
| comment="The full, human-readable name of the aquifer system (e.g., 'Ogallala Aquifer').", | ||
| ) | ||
| description: Mapped[str] = mapped_column( | ||
| Text, | ||
| nullable=True, | ||
| comment="A detailed description of the aquifer system, its characteristics, and its significance.", | ||
| ) | ||
| # Lexicon terms were retrieved from NMAquifer's 'LU_AquiferType' table. | ||
| primary_aquifer_type: Mapped[str] = lexicon_term( | ||
| nullable=False, | ||
| comment="A controlled vocabulary field to classify the aquifer system as a whole (e.g., 'Unconfined', 'Confined', 'Perched').", | ||
| ) | ||
| geographic_scale: Mapped[str] = lexicon_term( | ||
| nullable=False, | ||
| comment="A controlled vocabulary field to classify the aquifer's geographic scale (e.g., 'Major', 'Regional', 'Local').", | ||
| ) | ||
| boundary: Mapped[Geometry] = mapped_column( | ||
| Geometry(geometry_type="MULTIPOLYGON", srid=SRID_WGS84, spatial_index=True), | ||
| nullable=True, | ||
| comment="A spatial representation of the aquifer system's boundary.", | ||
| ) | ||
| # Hierarchical relationship fields (may be implemented in future iterations) | ||
| # Example: High Plains Aquifer (parent) contains Ogallala Aquifer (child) | ||
| # parent_id = Column(Integer, ForeignKey('aquifer_system.id')) | ||
| # parent = relationship('AquiferSystem', remote_side=[id], backref='subsystems') | ||
|
|
||
| # --- Relationships --- | ||
| # One-To-Many: An AquiferSystem can be associated with many wells (Things) via the ThingAquiferAssociation join table. | ||
| thing_associations: Mapped[List["ThingAquiferAssociation"]] = relationship( | ||
| "ThingAquiferAssociation", | ||
| back_populates="aquifer_system", | ||
| cascade="all, delete-orphan", | ||
| passive_deletes=True, | ||
| ) | ||
|
|
||
| # One-To-Many: An AquiferSystem can be the target for many individual WellScreens. | ||
| well_screens: Mapped[List["WellScreen"]] = relationship( | ||
| "WellScreen", | ||
| back_populates="aquifer_system", | ||
| cascade="all, delete-orphan", | ||
| passive_deletes=True, | ||
| ) | ||
|
|
||
| # --- Association Proxies --- | ||
| # Proxy to directly access Things (wells) associated with this AquiferSystem. | ||
| things: AssociationProxy[List["Thing"]] = association_proxy( | ||
| "thing_associations", "thing" | ||
| ) | ||
| # Proxy to directly access all AquiferTypes associated with this AquiferSystem. | ||
| aquifer_types: AssociationProxy[List["AquiferType"]] = association_proxy( | ||
| "thing_associations", "aquifer_types" | ||
| ) | ||
|
|
||
| # --- Table Arguments --- | ||
| __table_args__ = (Index("ix_aquifersystem_name", "name"),) |
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,58 @@ | ||
| """ | ||
| SQLAlchemy model for the AquiferType table. | ||
|
|
||
| This table stores the specific aquifer characteristics/types associated with | ||
| a Thing-AquiferSystem relationship. It allows capturing that a single aquifer | ||
| can have multiple characteristics simultaneously. | ||
|
|
||
| Example: | ||
| A well in the "Ogallala" aquifer might tap portions that are both | ||
| "Fractured" AND "Confined". This would create: | ||
| - One AquiferSystem: "Ogallala" | ||
| - One ThingAquiferAssociation: linking well to Ogallala | ||
| - Two AquiferType records: "Fractured" and "Confined" | ||
| """ | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| from sqlalchemy import ForeignKey | ||
| from sqlalchemy.orm import relationship, Mapped, mapped_column | ||
|
|
||
| from db.base import Base, AutoBaseMixin, ReleaseMixin, lexicon_term | ||
|
|
||
| if TYPE_CHECKING: | ||
| from db.thing_aquifer_association import ThingAquiferAssociation | ||
|
|
||
|
|
||
| class AquiferType(Base, AutoBaseMixin, ReleaseMixin): | ||
| """ | ||
| Represents the specific aquifer types/characteristics for a | ||
| Thing-AquiferSystem association. | ||
|
|
||
| This allows modeling the fact that: | ||
| - A single aquifer can have multiple characteristics | ||
| - Different wells may tap different characteristics of the same aquifer | ||
| - Characteristics are attributes of the relationship, not the aquifer itself | ||
|
|
||
| Fields from WellData CSV: | ||
| - AquiferType: May contain multiple codes (e.g., "FC" = Fractured + Confined) | ||
| - Each code becomes a separate AquiferType record | ||
| """ | ||
|
|
||
| # --- Columns --- | ||
| thing_aquifer_association_id: Mapped[int] = mapped_column( | ||
| ForeignKey("thing_aquifer_association.id", ondelete="CASCADE"), | ||
| nullable=False, | ||
| comment="Links to the Thing-Aquifer association this type describes.", | ||
| ) | ||
| aquifer_type: Mapped[str] = lexicon_term( | ||
| nullable=False, | ||
| comment="Controlled vocabulary for aquifer hydrologic properties. " | ||
| "Examples: 'Unconfined', 'Confined', 'Perched', 'Fractured', 'Unconsolidated'.", | ||
| ) | ||
|
|
||
| # --- Relationships --- | ||
| # Many-to-One: Multiple aquifer types can belong to one association | ||
| thing_aquifer_association: Mapped["ThingAquiferAssociation"] = relationship( | ||
| "ThingAquiferAssociation", back_populates="aquifer_types" | ||
| ) |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not be committing these temporary, dev changes to .pre-commit-config.yaml