Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
3f37302
WIP: implement well core information feature tests
jacob-a-brown Nov 4, 2025
deee08a
WIP: add well purposes to feature testing data
jacob-a-brown Nov 4, 2025
7fdf2df
WIP: well core information behave test development
jacob-a-brown Nov 4, 2025
54abcab
WIP: id link testing
jacob-a-brown Nov 4, 2025
819f7ce
WIP: well core information behave test
jacob-a-brown Nov 4, 2025
8dd71e3
Merge branch 'bdms-221' into bdms-221-jab-bdms-223
jacob-a-brown Nov 4, 2025
b777dc5
WIP: erase and rebuild db each time
jacob-a-brown Nov 4, 2025
fe10338
Merge branch 'bdms-221' into bdms-221-jab-bdms-223
jacob-a-brown Nov 4, 2025
1486fd9
feat: note reused statements and places for fixtures
jacob-a-brown Nov 4, 2025
c2df7af
WIP: note taking for well core information
jacob-a-brown Nov 4, 2025
e8c9442
refactor: address PR comments
jacob-a-brown Nov 5, 2025
6ee0719
refactor: update behave tests per PR feedback
jacob-a-brown Nov 5, 2025
5e3a106
refactor: update feature tests per PR feedback
jacob-a-brown Nov 5, 2025
62fed51
Merge branch 'staging' into bdms-221-jab-bdms-223
jacob-a-brown Nov 6, 2025
c504b27
refactor: revert to context.response for the single request
jacob-a-brown Nov 6, 2025
217c9fe
Merge branch 'staging' into bdms-221-jab-bdms-223
jacob-a-brown Nov 6, 2025
995d6b1
refactor: use context objects to get well id for get request
jacob-a-brown Nov 6, 2025
87dba2b
feat: update tests
jacob-a-brown Nov 6, 2025
077dacd
feat: add id links to pseudo fixtures
jacob-a-brown Nov 6, 2025
2ce6f5c
refactor: update groups in testing data
jacob-a-brown Nov 7, 2025
8f1ff33
Merge pull request #230 from DataIntegrationGroup/bdms-221-jab-bdms-223
jacob-a-brown Nov 7, 2025
94a6dae
feat: update group model and expand lexicon
ksmuczynski Nov 7, 2025
4bdda8e
Merge branch 'bdms-221' into kas-bdms-221-225-core-well-info-models-s…
ksmuczynski Nov 7, 2025
a997e10
refactor: update well core feature test implementation
jacob-a-brown Nov 7, 2025
9858ec2
refactor: update lexicon category names and terms associated with the…
ksmuczynski Nov 7, 2025
19c2904
refactor: list status_type terms in proper case.
ksmuczynski Nov 7, 2025
20e39e2
refactor: update lexicon
ksmuczynski Nov 7, 2025
0d38d28
Merge branch 'staging' into bdms-221
jacob-a-brown Nov 10, 2025
dc23839
refactor: update `Group` model
ksmuczynski Nov 10, 2025
7613648
Merge pull request #239 from DataIntegrationGroup/kas-bdms-221-225-co…
ksmuczynski Nov 10, 2025
84edffc
Merge branch 'bdms-221' of https://github.com/DataIntegrationGroup/NM…
jacob-a-brown Nov 10, 2025
d1a4b34
fix: import lexicon from db
jacob-a-brown Nov 10, 2025
84a2817
feat: make GroupType and MonitoringFrequency enums
jacob-a-brown Nov 10, 2025
d8f69c6
feat: update GroupResponse and add to ThingResponse
jacob-a-brown Nov 10, 2025
81d960f
refactor: update bdd tests for updated group
jacob-a-brown Nov 10, 2025
d22f0da
feat: implement well purposes in behave tests
jacob-a-brown Nov 10, 2025
31c7070
refactor: make status_type and status_value lexicon terms
jacob-a-brown Nov 10, 2025
ba002e2
feat: add monitoring statuses to lexicon
jacob-a-brown Nov 10, 2025
eb5de1e
feat: add well status to thing
jacob-a-brown Nov 10, 2025
33e478e
feat: function to convert m to ft
jacob-a-brown Nov 10, 2025
dc33da4
feat: pass test for well status
jacob-a-brown Nov 10, 2025
f7c0ffb
feat: pass monitoring frequency bdd test
jacob-a-brown Nov 10, 2025
c3018cc
feat: implement monitoring status
jacob-a-brown Nov 10, 2025
9185229
refactor: remove outdated note
jacob-a-brown Nov 10, 2025
e7636dd
refactor: return GeoJSON for current_location
jacob-a-brown Nov 11, 2025
bdeb210
fix: transform wkb to wkt for tests
jacob-a-brown Nov 11, 2025
79e73d5
fix: transform wkb to wkt for tests
jacob-a-brown Nov 11, 2025
505a64e
notes: remove outdated TODO
jacob-a-brown Nov 11, 2025
12998f8
feat: add alternate ids to ThingResponse
jacob-a-brown Nov 11, 2025
85f1c75
Merge branch 'staging' into bdms-221
jacob-a-brown Nov 11, 2025
a74168f
refactor: use Organiation enum for alternate organization
jacob-a-brown Nov 11, 2025
a10ed45
Merge branch 'staging' into bdms-221-jab-updates-to-pass-tests
jacob-a-brown Nov 11, 2025
2ba1271
fix: current_location is not nullable
jacob-a-brown Nov 11, 2025
e87150a
feat: create new `measuring_point_history` model.
ksmuczynski Nov 11, 2025
545c2e8
feat: add new relationship to `Thing` model.
ksmuczynski Nov 11, 2025
15c770f
refactor: add new field to `measuring_point_history` model.
ksmuczynski Nov 11, 2025
aec217b
feat: at mp height & description to well transfer
jacob-a-brown Nov 11, 2025
505ae6e
feat: add well status and monitoring status to well transfer
jacob-a-brown Nov 11, 2025
8107e7c
feat: validate measuring point height for a well
jacob-a-brown Nov 11, 2025
647dc70
refactor: fix erase/rebuild for tests
jacob-a-brown Nov 12, 2025
955336a
Merge branch 'staging' into bdms-221
jacob-a-brown Nov 12, 2025
ddf6436
Merge branch 'bdms-221' into bdms-221-jab-transfer-updates
jacob-a-brown Nov 12, 2025
a61c958
Merge branch 'bdms-221' into bdms-221-jab-updates-to-pass-tests
jacob-a-brown Nov 12, 2025
10ec9ec
Merge branch 'bdms-221-jab-updates-to-pass-tests' into bdms-221-jab-t…
jacob-a-brown Nov 12, 2025
0bccd4f
note: add note for AMMP review
jacob-a-brown Nov 12, 2025
5581ce2
feat: add PLSS as an organization to lexicon
jacob-a-brown Nov 12, 2025
35051be
Merge branch 'bdms-221' into kas-bdms-221-225-core-well-info-models-s…
ksmuczynski Nov 12, 2025
cafbb92
refactor: round m and ft conversion to 6 decimal places
jacob-a-brown Nov 12, 2025
3e1203c
refactor: set start/end date to date not datetime
jacob-a-brown Nov 12, 2025
2201ec1
refactor: use target_id and target_table in status_history
jacob-a-brown Nov 12, 2025
54c24e8
Merge branch 'bdms-221-jab-updates-to-pass-tests' into bdms-221-jab-t…
jacob-a-brown Nov 12, 2025
8d1d8fa
refactor: update 'measuring_point_history' model.
ksmuczynski Nov 12, 2025
f2f5e27
refactor: make well validations more readable
jacob-a-brown Nov 12, 2025
be7cb51
Merge pull request #244 from DataIntegrationGroup/kas-bdms-221-225-co…
jacob-a-brown Nov 12, 2025
1b87a3c
refactor: use cls for status history mixin
jacob-a-brown Nov 12, 2025
3090f93
Merge branch 'bdms-221' into bdms-221-jab-updates-to-pass-tests
jacob-a-brown Nov 12, 2025
bcfff8f
feat: eagerly load measuring point history records
jacob-a-brown Nov 12, 2025
7658fb5
feat: get mp height/description from latest record
jacob-a-brown Nov 12, 2025
2b5d489
refactor: use MeasuringPointHistory table for mp data
jacob-a-brown Nov 12, 2025
f130c42
feat: implement MonitoringFrequencyHistory table
jacob-a-brown Nov 12, 2025
494486b
refactor: remove monitoring frequency from group
jacob-a-brown Nov 12, 2025
85761c0
Merge branch 'bdms-221-jab-updates-to-pass-tests' into bdms-221-jab-t…
jacob-a-brown Nov 12, 2025
771dff4
refactor: update transfer script for monitoring frequency history table
jacob-a-brown Nov 12, 2025
ef1a4c8
refactor: update for measuring point history table
jacob-a-brown Nov 12, 2025
cabac98
feat: set group_type based off of wells' monitoring status
jacob-a-brown Nov 12, 2025
57bd631
feat: add DataProvenance model and enhance base mixins
ksmuczynski Nov 12, 2025
0e601fd
feat: add DataProvenanceMixin for polymorphic provenance tracking
ksmuczynski Nov 12, 2025
9feb596
refactor: use function to retrieve polymorphic records
jacob-a-brown Nov 12, 2025
a795783
Merge branch 'bdms-221-jab-updates-to-pass-tests' into bdms-221-jab-t…
jacob-a-brown Nov 12, 2025
3de8553
fix: remove polymorphic record retrieval from tests
jacob-a-brown Nov 12, 2025
49b3a8c
refactor: use function to retrieve polymorphic records
jacob-a-brown Nov 12, 2025
34856d5
Merge branch 'bdms-221-jab-updates-to-pass-tests' into bdms-221-jab-t…
jacob-a-brown Nov 12, 2025
a6c5556
Merge pull request #240 from DataIntegrationGroup/bdms-221-jab-update…
jacob-a-brown Nov 13, 2025
f2184d2
refactor: refine polymorphic parent relationships.
ksmuczynski Nov 13, 2025
e78a963
Merge branch 'bdms-221' into bdms-221-jab-transfer-updates
jacob-a-brown Nov 13, 2025
b22619c
fix: import retrieve_latest_polymorphic_record from correct place
jacob-a-brown Nov 13, 2025
27b7c82
refactor: move DataProvenanceMixin to data_provenance.py and refactor…
ksmuczynski Nov 13, 2025
73d3a48
refactor: Update lexicon and `enums.py` with DataProvenance related i…
ksmuczynski Nov 13, 2025
781d3f4
refactor: Update lexicon and `enums.py` with DataProvenance related i…
ksmuczynski Nov 13, 2025
a1614f6
Merge branch 'bdms-221' into kas-bdms-221-225-core-well-info-models-s…
jacob-a-brown Nov 17, 2025
66a843b
Merge pull request #245 from DataIntegrationGroup/kas-bdms-221-225-co…
jacob-a-brown Nov 17, 2025
e8bc1f1
fix: fix artifacts from merge conflicts
jacob-a-brown Nov 17, 2025
5c287a6
fix: import DataProvenanceMixin from correct location
jacob-a-brown Nov 17, 2025
c27e169
fix: use logical name for record retrieval
jacob-a-brown Nov 17, 2025
25d7700
refactor: remove fields from location that are now in dataprovenance
jacob-a-brown Nov 17, 2025
4c9232e
refactor: use collection_method in DataProvenance model for elevation…
jacob-a-brown Nov 17, 2025
010bad4
fix: import DataProvenance to db/__init__.py
jacob-a-brown Nov 17, 2025
5ffb2cb
test: add elevation_method testing data
jacob-a-brown Nov 17, 2025
a7a6bb6
refactor: implement elevation_method from data provenance
jacob-a-brown Nov 17, 2025
0875281
feat: implement well_depth_source
jacob-a-brown Nov 17, 2025
c80d4a3
Merge branch 'bdms-221-jab-updates-to-pass-tests' into bdms-221-jab-t…
jacob-a-brown Nov 17, 2025
109d2ed
Merge branch 'staging' into bdms-221
jacob-a-brown Nov 17, 2025
c396dd2
Merge branch 'bdms-221' into bdms-221-jab-updates-to-pass-tests
jacob-a-brown Nov 17, 2025
ac1a33f
fix: fix artifacts from merge with staging
jacob-a-brown Nov 17, 2025
790c814
refactor: use function to get data provenance attributes
jacob-a-brown Nov 17, 2025
226ff1a
Merge pull request #250 from DataIntegrationGroup/bdms-221-jab-update…
jacob-a-brown Nov 17, 2025
15116e7
Merge branch 'bdms-221-jab-updates-to-pass-tests' into bdms-221-jab-t…
jacob-a-brown Nov 17, 2025
ef016da
WIP: use data provenance table in transfers
jacob-a-brown Nov 18, 2025
cfc4e8f
fix: convert ngvd29 to navd88 for elevation where applicable
jacob-a-brown Nov 18, 2025
3e5a8f0
Merge branch 'bdms-221' into bdms-221-jab-transfer-updates
jacob-a-brown Nov 18, 2025
df238fa
refactor: address PR comments
jacob-a-brown Nov 18, 2025
784cb30
Merge pull request #242 from DataIntegrationGroup/bdms-221-jab-transf…
jacob-a-brown Nov 18, 2025
0ae594d
fix: remove data provenance fields from pytest fixtures
jacob-a-brown Nov 18, 2025
e9d55b2
fix: make mp height optional for full thing response
jacob-a-brown Nov 18, 2025
92e3baf
fix: fix contact pytest tests
jacob-a-brown Nov 18, 2025
3d37770
fix: fix geospatial tests
jacob-a-brown Nov 18, 2025
0351854
fix: update location pytest tests
jacob-a-brown Nov 18, 2025
bdeef8a
fix: fix or skip thing pytest tests from feature file changes
jacob-a-brown Nov 18, 2025
a12d8ad
Merge branch 'staging' into bdms-221
jacob-a-brown Nov 18, 2025
9e4e518
fix: fix artifact from merge conflicts in pytest
jacob-a-brown Nov 18, 2025
8258a5f
fix: retrieve notes for location geojson response
jacob-a-brown Nov 18, 2025
d09ea21
fix: ensure all feature test wells have mp heights
jacob-a-brown Nov 18, 2025
5916de1
fix: current location note fix
jacob-a-brown Nov 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ repos:
'--statistics'
]
exclude: ^db/__init__.py$ # all models need to be imported for Alembic, but are not used directly
- repo: local
hooks:
- id: pytest
name: pytest
entry: pytest # Or your specific test command, e.g., poetry run pytest
language: system
types: [python] # Specify relevant file types for your tests
pass_filenames: false
always_run: true
# - repo: local
# hooks:
# - id: pytest
# name: pytest
# entry: pytest # Or your specific test command, e.g., poetry run pytest
# language: system
# types: [python] # Specify relevant file types for your tests
# pass_filenames: false
# always_run: true

# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.10.0 # Use the latest stable version or pin to your preference
Expand Down
5 changes: 5 additions & 0 deletions core/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
MonitoringStatus: type[Enum] = build_enum_from_lexicon_category("monitoring_status")
ParameterName: type[Enum] = build_enum_from_lexicon_category("parameter_name")
Organization: type[Enum] = build_enum_from_lexicon_category("organization")
OriginSource: type[Enum] = build_enum_from_lexicon_category("origin_source")
ParameterType: type[Enum] = build_enum_from_lexicon_category("parameter_type")
PhoneType: type[Enum] = build_enum_from_lexicon_category("phone_type")
PublicationType: type[Enum] = build_enum_from_lexicon_category("publication_type")
Expand All @@ -67,4 +68,8 @@
Vertical_datum: type[Enum] = build_enum_from_lexicon_category("vertical_datum")
ScreenType: type[Enum] = build_enum_from_lexicon_category("screen_type")
SensorType: type[Enum] = build_enum_from_lexicon_category("sensor_type")
GroupType: type[Enum] = build_enum_from_lexicon_category("group_type")
MonitoringFrequency: type[Enum] = build_enum_from_lexicon_category(
"monitoring_frequency"
)
# ============= EOF =============================================
79 changes: 53 additions & 26 deletions core/lexicon.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
{"name": "email_type", "description": null},
{"name": "participant_role", "description": null},
{"name": "geochronology", "description": null},
{"name": "horizontal_datum", "description": null},
{"name": "groundwater_level_reason", "description": null},
{"name": "group_type", "description": null},
{"name": "horizontal_datum", "description": null},
{"name": "limit_type", "description": null},
{"name": "measurement_method", "description": null},
{"name": "monitoring_status", "description": null},
{"name": "monitoring_frequency", "description": null},
{"name": "note_type", "description": null},
{"name": "parameter_name", "description": null},
{"name": "organization", "description": null},
Expand All @@ -48,7 +49,9 @@
{"name": "unit", "description": null},
{"name": "vertical_datum", "description": null},
{"name": "well_purpose", "description": null},
{"name": "well_status", "description": null}
{"name": "status_type", "description": null},
{"name": "status_value", "description": null},
{"name": "origin_source", "description": null}
],
"terms": [
{"categories": ["review_status"], "term": "approved", "definition": "approved"},
Expand Down Expand Up @@ -145,6 +148,7 @@
{"categories": ["unit"], "term": "second", "definition": "second"},
{"categories": ["unit"], "term": "minute", "definition": "minute"},
{"categories": ["unit"], "term": "hour", "definition": "hour"},
{"categories": ["unit"], "term": "m", "definition": "meters"},
{"categories": ["parameter_name"], "term": "groundwater level", "definition": "groundwater level measurement"},
{"categories": ["parameter_name"], "term": "temperature", "definition": "Temperature measurement"},
{"categories": ["parameter_name"], "term": "pH", "definition": "pH"},
Expand Down Expand Up @@ -322,10 +326,15 @@
{"categories": ["groundwater_level_reason"], "term": "Water level affected by stage in nearby surface-water site", "definition": "Water level affected by stage in nearby surface-water site"},
{"categories": ["groundwater_level_reason"], "term": "Other conditions exist that would affect the level (remarks)", "definition": "Other conditions exist that would affect the level (remarks)"},
{"categories": ["groundwater_level_reason"], "term": "Water level not affected", "definition": "Water level not affected"},
{"categories": ["well_status"], "term": "Abandoned", "definition": "Abandoned"},
{"categories": ["well_status"], "term": "Active, pumping well", "definition": "Active, pumping well"},
{"categories": ["well_status"], "term": "Destroyed, exists but not usable", "definition": "Destroyed, exists but not usable"},
{"categories": ["well_status"], "term": "Inactive, exists but not used", "definition": "Inactive, exists but not used"},
{"categories": ["status_type"], "term": "Well Status", "definition": "Defines the well's operational condition as reported by the owner"},
{"categories": ["status_type"], "term": "Monitoring Status", "definition": "Defines the well's current monitoring status by NMBGMR."},
{"categories": ["status_type"], "term": "Access Status", "definition": "Defines the well's access status for field personnel."},
{"categories": ["status_value"], "term": "Abandoned", "definition": "The well has been properly decommissioned."},
{"categories": ["status_value"], "term": "Active, pumping well", "definition": "This well is in use."},
{"categories": ["status_value"], "term": "Destroyed, exists but not usable", "definition": "The well structure is physically present but is damaged, collapsed, or otherwise compromised to the point that it is non-functional."},
{"categories": ["status_value"], "term": "Inactive, exists but not used", "definition": "The well is not currently in use but is believed to be in a usable condition; it has not been permanently decommissioned/abandoned."},
{"categories": ["status_value"], "term": "Currently monitored", "definition": "The well is currently being monitored by AMMP."},
{"categories": ["status_value"], "term": "Not currently monitored", "definition": "The well is not currently being monitored by AMMP."},
{"categories": ["sample_method"], "term": "Airline measurement", "definition": "Airline measurement"},
{"categories": ["sample_method"], "term": "Analog or graphic recorder", "definition": "Analog or graphic recorder"},
{"categories": ["sample_method"], "term": "Calibrated airline measurement", "definition": "Calibrated airline measurement"},
Expand Down Expand Up @@ -562,8 +571,21 @@
{"categories": ["organization"], "term": "Winter Brothers", "definition": "Winter Brothers"},
{"categories": ["organization"], "term": "Yates Petroleum Corporation", "definition": "Yates Petroleum Corporation"},
{"categories": ["organization"], "term": "Zamora Accounting Services", "definition": "Zamora Accounting Services"},
{"categories": ["collection_method"], "term": "manual", "definition": "manual sampling"},
{"categories": ["collection_method"], "term": "continuous", "definition": "continuous sampling"},
{"categories": ["organization"], "term": "PLSS", "definition": "Public Land Survey System"},
{"categories": ["collection_method"], "term": "Altimeter", "definition": "ALtimeter"},
{"categories": ["collection_method"], "term": "Differentially corrected GPS", "definition": "Differentially corrected GPS"},
{"categories": ["collection_method"], "term": "Survey-grade GPS", "definition": "Survey-grade GPS"},
{"categories": ["collection_method"], "term": "Global positioning system (GPS)", "definition": "Global positioning system (GPS)"},
{"categories": ["collection_method"], "term": "LiDAR DEM", "definition": "LiDAR DEM"},
{"categories": ["collection_method"], "term": "Level or other survey method", "definition": "Level or other survey method"},
{"categories": ["collection_method"], "term": "Interpolated from topographic map", "definition": "Interpolated from topographic map"},
{"categories": ["collection_method"], "term": "Interpolated from digital elevation model (DEM)", "definition": "Interpolated from digital elevation model (DEM)"},
{"categories": ["collection_method"], "term": "Reported", "definition": "Reported"},
{"categories": ["collection_method"], "term": "Unknown", "definition": "Unknown"},
{"categories": ["collection_method"], "term": "Survey-grade Global Navigation Satellite Sys, Lvl1", "definition": "Survey-grade Global Navigation Satellite Sys, Lvl1"},
{"categories": ["collection_method"], "term": "USGS National Elevation Dataset (NED)", "definition": "USGS National Elevation Dataset (NED)"},
{"categories": ["collection_method"], "term": "Transit, theodolite, or other survey method", "definition": "Transit, theodolite, or other survey method"},
{"categories": ["role"], "term": "Principal Investigator", "definition": "Principal Investigator"},
{"categories": ["role"], "term": "Owner", "definition": "Owner"},
{"categories": ["role"], "term": "Manager", "definition": "Manager"},
{"categories": ["role"], "term": "Operator", "definition": "Operator"},
Expand Down Expand Up @@ -624,22 +646,6 @@
{"categories": ["publication_type"], "term": "Book", "definition": "Book"},
{"categories": ["publication_type"], "term": "Conference", "definition": "Conference"},
{"categories": ["publication_type"], "term": "Webpage", "definition": "Webpage"},
{"categories": ["monitoring_status"], "term": "Monitor every six months", "definition": "Monitor every six months"},
{"categories": ["monitoring_status"], "term": "Annual water level", "definition": "Annual water level"},
{"categories": ["monitoring_status"], "term": "Monitoring bi-monthly", "definition": "Monitoring bi-monthly"},
{"categories": ["monitoring_status"], "term": "Monitoring complete", "definition": "Monitoring complete"},
{"categories": ["monitoring_status"], "term": "Datalogger installed", "definition": "Datalogger installed"},
{"categories": ["monitoring_status"], "term": "Monitor every 10 years (long-term monitor)", "definition": "Monitor every 10 years (long-term monitor)"},
{"categories": ["monitoring_status"], "term": "Monitor monthly", "definition": "Monitor monthly"},
{"categories": ["monitoring_status"], "term": "Sampling complete", "definition": "Sampling complete"},
{"categories": ["monitoring_status"], "term": "Reported to NMBGMR bimonthly", "definition": "Reported to NMBGMR bimonthly"},
{"categories": ["monitoring_status"], "term": "Sample well", "definition": "Sample well"},
{"categories": ["monitoring_status"], "term": "Water level cannot be measured", "definition": "Water level cannot be measured"},
{"categories": ["monitoring_status"], "term": "Repeat sampling", "definition": "Repeat sampling"},
{"categories": ["monitoring_status"], "term": "Wellntel device", "definition": "Wellntel device"},
{"categories": ["monitoring_status"], "term": "Bi-annual (every other year)", "definition": "Bi-annual (every other year)"},
{"categories": ["monitoring_status"], "term": "Inactive", "definition": "Inactive"},
{"categories": ["monitoring_status"], "term": "Data share", "definition": "Data share"},
{"categories": ["sample_type"], "term": "Background", "definition": "Background"},
{"categories": ["sample_type"], "term": "Equipment blank", "definition": "Equipment blank"},
{"categories": ["sample_type"], "term": "Field blank", "definition": "Field blank"},
Expand Down Expand Up @@ -675,13 +681,34 @@
{"categories": ["sensor_status"], "term": "In Repair", "definition": "In Repair"},
{"categories": ["sensor_status"], "term": "Retired", "definition": "Retired"},
{"categories": ["sensor_status"], "term": "Lost", "definition": "Lost"},
{"categories": ["group_type"], "term": "Monitoring Plan", "definition": "A group of `Things` that are monitored together for a specific programmatic or scientific purpose."},
{"categories": ["group_type"], "term": "Geographic Area", "definition": "A group of `Things` that fall within a specific, user-defined or official spatial boundary. E.g, `Wells in the Estancia Basin`."},
{"categories": ["group_type"], "term": "Historical", "definition": "A group of `Things` that share a common historical attribute. E.g., 'Wells drilled before 1950', 'Legacy Wells (Pre-1990)'."},
{"categories": ["monitoring_frequency"], "term": "Monthly", "definition": "Location is monitored on a monthly basis."},
{"categories": ["monitoring_frequency"], "term": "Bimonthly", "definition": "Location is monitored every two months."},
{"categories": ["monitoring_frequency"], "term": "Bimonthly reported", "definition": "Location is monitored every two months and reported to NMBGMR."},
{"categories": ["monitoring_frequency"], "term": "Quarterly", "definition": "Location is monitored on a quarterly basis."},
{"categories": ["monitoring_frequency"], "term": "Biannual", "definition": "Location is monitored twice a year."},
{"categories": ["monitoring_frequency"], "term": "Annual", "definition": "Location is monitored once a year."},
{"categories": ["monitoring_frequency"], "term": "Decadal", "definition": "Location is monitored once every ten years."},
{"categories": ["monitoring_frequency"], "term": "Event-based", "definition": "Location is monitored based on specific events or triggers rather than a fixed schedule."},
{"categories": ["origin_source"], "term": "Reported by another agency", "definition": "Reported by another agency"},
{"categories": ["origin_source"], "term": "From driller's log or well report", "definition": "From driller's log or well report"},
{"categories": ["origin_source"], "term": "Private geologist, consultant or univ associate", "definition": "Private geologist, consultant or univ associate"},
{"categories": ["origin_source"], "term": "Interpreted fr geophys logs by source agency", "definition": "Interpreted fr geophys logs by source agency"},
{"categories": ["origin_source"], "term": "Memory of owner, operator, driller", "definition": "Memory of owner, operator, driller"},
{"categories": ["origin_source"], "term": "Measured by source agency", "definition": "Measured by source agency"},
{"categories": ["origin_source"], "term": "Reported by owner of well", "definition": "Reported by owner of well"},
{"categories": ["origin_source"], "term": "Reported by person other than driller owner agency", "definition": "Reported by person other than driller owner agency"},
{"categories": ["origin_source"], "term": "Measured by NMBGMR staff", "definition": "Measured by NMBGMR staff"},
{"categories": ["origin_source"], "term": "Other", "definition": "Other"},
{"categories": ["origin_source"], "term": "Data Portal", "definition": "Data Portal"},
{"categories": ["note_type"], "term": "Access", "definition": "Access instructions, gate codes, permission requirements, etc."},
{"categories": ["note_type"], "term": "Construction", "definition": "Construction details, well development, drilling notes, etc. Could create separate `types` for each of these if needed."},
{"categories": ["note_type"], "term": "Maintenance", "definition": "Maintenance observations and issues."},
{"categories": ["note_type"], "term": "Historical", "definition": "Historical information or context about the well or location."},
{"categories": ["note_type"], "term": "Other", "definition": "Other types of notes that do not fit into the predefined categories."},
{"categories": ["note_type"], "term": "Water", "definition": "Water bearing zone information and other info from ose reports"},
{"categories": ["note_type"], "term": "Measuring", "definition": "Notes about measuring/visiting the well, on Access form"}

]
}
2 changes: 2 additions & 0 deletions db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
from db.status_history import *
from db.thing import *
from db.transducer import *
from db.measuring_point_history import *
from db.data_provenance import *

from sqlalchemy import (
func,
Expand Down
19 changes: 1 addition & 18 deletions db/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
- `ReleaseMixin`: Adds a release status column referencing the `lexicon_term` table.
- `AuditMixin`: Adds standard audit columns (created_at, created_by, updated_at, updated_by).
5. A simple `User` model for tracking user information in audit columns.
6. Polymorphic helper mixins (`StatusHistoryMixin`, `NotesMixin`, `AttributionMixin`, `PermissionMixin`.)
6. Polymorphic helper mixins (`StatusHistoryMixin`, `NotesMixin`, `DataProvenanceMixin`, `PermissionMixin`.)
which provide a clean, reusable way to add relationships to the polymorphic
metadata tables. Any model that can have a status history (like Thing or Location)
can simply inherit from the `StatusHistoryMixin` mixin.
Expand Down Expand Up @@ -177,23 +177,6 @@ def properties(self):


# ============= Polymorphic Helper Mixins =============================================
class StatusHistoryMixin:
"""
Mixin for models that can have a status history (e.g., Thing, Location).
It automatically creates a polymorphic One-to-Many relationship to the
StatusHistory table.
"""

@declared_attr
def status_history(self):
# One-to-Many polymorphic relationship
return relationship(
"StatusHistory",
primaryjoin=f"and_({self.__name__}.id==foreign(StatusHistory.statusable_id), "
f"StatusHistory.statusable_type=='{self.__name__}')",
cascade="all, delete-orphan",
lazy="selectin",
)


class PermissionMixin:
Expand Down
Loading
Loading