Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
1e0b253
feat(schemas): add alias validation for well inventory fields
ksmuczynski Mar 7, 2026
3b2db6b
test(well_inventory): add tests for schema alias handling
ksmuczynski Mar 7, 2026
6c38157
feat(schemas): enhance well inventory schema with flexible validation…
ksmuczynski Mar 9, 2026
1d3aa13
test(features): improve error messages and enhance contact field vali…
ksmuczynski Mar 9, 2026
4d74d1b
feat(core): expand lexicon with new terms for water-related categories
ksmuczynski Mar 9, 2026
a7e0632
feat(schemas): add `monitoring_status` field to `thing` schema
ksmuczynski Mar 9, 2026
42bae2d
feat(thing_helper): add handling for `monitoring_status` in status hi…
ksmuczynski Mar 9, 2026
81faed4
test(features): isolate well inventory scenarios with unique well ids…
ksmuczynski Mar 9, 2026
5bbff15
refactor(helpers): tighten helper transactions to avoid refresh and r…
ksmuczynski Mar 9, 2026
6c5d46e
feat(services): improve well inventory handling and align well invent…
ksmuczynski Mar 10, 2026
4a4e249
feat(tests): adjust validation scenarios to allow partial imports wit…
ksmuczynski Mar 10, 2026
c350555
Merge staging
ksmuczynski Mar 11, 2026
6302d80
test(features): enhance CSV reading to handle empty values and ensure…
ksmuczynski Mar 11, 2026
9742c03
fix(schemas): fix well inventory schema mismatch for `SampleMethod` a…
ksmuczynski Mar 11, 2026
86aa582
fix(contacts): allow nullable role and contact_type in well inventory…
ksmuczynski Mar 12, 2026
3072e41
test(well-inventory): preserve structural CSV fixtures in BDD setup
ksmuczynski Mar 12, 2026
dbe7074
test(well-inventory): require distinct matches for expected validatio…
ksmuczynski Mar 12, 2026
76a450c
test(well-inventory): align BDD expectations with best-effort import …
ksmuczynski Mar 12, 2026
ce742fd
test(well-inventory): align autogen placeholder tests with case-insen…
ksmuczynski Mar 13, 2026
ad86bf6
test(well-inventory): update expected values for `SampleMethod` and `…
ksmuczynski Mar 13, 2026
55872b2
test(well-inventory): expand contact tests for missing name and organ…
ksmuczynski Mar 13, 2026
8c9ea27
Merge branch 'staging' into kas-well-BDMS-626-inventory-ingestion-upd…
ksmuczynski Mar 13, 2026
7143ed3
refactor(enums): update `MonitoringStatus` to use `status_value` lexi…
ksmuczynski Mar 16, 2026
8e583ea
refactor(well-inventory): update field mappings and naming convention…
ksmuczynski Mar 16, 2026
a7bad53
fix(cli): handle UTF-8 BOM in CSV decoding for well inventory import
ksmuczynski Mar 16, 2026
6d2d810
fix(well-inventory): preserve attempted water-level records when dept…
ksmuczynski Mar 16, 2026
4f2b3cd
fix(well-inventory): improve error handling for database exceptions
ksmuczynski Mar 17, 2026
b2df9ab
fix(well-inventory): normalize blank contact values and add missing o…
ksmuczynski Mar 17, 2026
27e0695
• fix(well-inventory): make CSV import reruns idempotent
ksmuczynski Mar 17, 2026
a4e9412
Merge pull request #605 from DataIntegrationGroup/kas-BDMS-626-resolv…
jacob-a-brown Mar 17, 2026
1e0fd84
fix(test): encore ocotilloapi_test for bdd tests
jacob-a-brown Mar 17, 2026
3ad295a
feat(test): print exit_code when assert fails
jacob-a-brown Mar 17, 2026
e768d8a
fix(contact): Make contact role and type non-nullable
jacob-a-brown Mar 17, 2026
a0ea88d
fix(test): remove print debugging statement
jacob-a-brown Mar 17, 2026
0a30676
fix(well inventory): extract role/contact_type from enum
jacob-a-brown Mar 17, 2026
0fada74
fix(test): ensure different step test names
jacob-a-brown Mar 17, 2026
965bcc7
test(well-inventory): align invalid well_hole_status scenario with de…
ksmuczynski Mar 17, 2026
bf65262
Merge pull request #607 from DataIntegrationGroup/jab-bdms-626
ksmuczynski Mar 18, 2026
1dfc24d
feat(well inventory): add groundwater level field activity for well i…
jacob-a-brown Mar 18, 2026
fe9fc0d
fix(test): compare dt aware objects for optional water level tests
jacob-a-brown Mar 18, 2026
0c9e8fa
fix(test): use enums when testing helper functions
jacob-a-brown Mar 18, 2026
815cfc6
fix(test): utilize autouse fixture to clean up tests
jacob-a-brown Mar 18, 2026
3e9dcf3
fix(test): fix failing well inventory tests
jacob-a-brown Mar 18, 2026
d6e1dc4
fix(well inventory): use correct activity type for water level records
jacob-a-brown Mar 18, 2026
b2bc17d
fix(well inventory): retrieve groundwater level reason enum value, el…
jacob-a-brown Mar 18, 2026
e899412
fix(test): ensure sample references correct field activity
jacob-a-brown Mar 18, 2026
44c598a
feat(test): ensure more robust water level tests
jacob-a-brown Mar 18, 2026
6fb61cf
Merge pull request #609 from DataIntegrationGroup/jab-bdms-626-field-…
jacob-a-brown Mar 18, 2026
fe7fba2
feat(well inventory): require measuring_point_height_ft or mp_height_…
jacob-a-brown Mar 18, 2026
1763df2
fix(test): make test name more accurate
jacob-a-brown Mar 18, 2026
4c0db46
fix(well inventory): test if mp height not None to avoid truthiness trap
jacob-a-brown Mar 18, 2026
aac5c95
fix(well inventory): check for Nones to avoid truthiness traps
jacob-a-brown Mar 18, 2026
b6e5d80
fix(test): make docstring more accurate
jacob-a-brown Mar 18, 2026
4a0f0da
fix(test): clarify docstrings
jacob-a-brown Mar 18, 2026
6df12f6
fix(test): clarify docstrings
jacob-a-brown Mar 18, 2026
6fe2bc1
Merge pull request #610 from DataIntegrationGroup/jab-bdms-626-mp-height
ksmuczynski Mar 18, 2026
dda88c8
Revert "Merge pull request #610 from DataIntegrationGroup/jab-bdms-62…
ksmuczynski Mar 19, 2026
b80bd32
fix(cli): include staged sql path in local db restore result
ksmuczynski Mar 19, 2026
2932721
fix(well-inventory): validate invalid well_hole_status before persist…
ksmuczynski Mar 19, 2026
525a9fd
test(environment): use default test database settings for BDD runs
ksmuczynski Mar 19, 2026
1460d4f
fix(well-inventory): avoid creating empty project groups on failed im…
ksmuczynski Mar 20, 2026
3e93bb6
fix(well-inventory): treat whitespace-only lexicon values as blank
ksmuczynski Mar 20, 2026
a01e091
fix(well inventory): allow null mp heights
jacob-a-brown Mar 20, 2026
fe6cfbc
Merge branch 'kas-well-BDMS-626-inventory-ingestion-updates_v2' into …
jacob-a-brown Mar 20, 2026
6d03bf4
fix(well inventory): use one mp height for thing and gwl
jacob-a-brown Mar 20, 2026
cf7ca5a
fix(test): fix typo in doc string
jacob-a-brown Mar 20, 2026
467c87e
feat(cli): add progress updates for well inventory imports
ksmuczynski Mar 23, 2026
eb6792c
Merge pull request #615 from DataIntegrationGroup/jab-bdms-626-mp-height
ksmuczynski Mar 23, 2026
9b08049
Merge remote-tracking branch 'origin/kas-well-BDMS-626-inventory-inge…
ksmuczynski Mar 23, 2026
0ec4da9
feat(well-inventory): emit per-row progress during imports
ksmuczynski Mar 23, 2026
f482b5a
fix(well-inventory): normalize "Complete" monitoring frequency to "No…
ksmuczynski Mar 23, 2026
5fabcd1
fix(well-inventory): stop defaulting missing observation data quality…
ksmuczynski Mar 23, 2026
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
1 change: 1 addition & 0 deletions cli/db_restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ def restore_local_db_from_sql(
) from exc

return LocalDbRestoreResult(
sql_file=staged_sql_file,
source=source_description,
host=host,
port=port,
Expand Down
22 changes: 18 additions & 4 deletions cli/service_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,33 @@ def well_inventory_csv(source_file: Path | str):
payload = {"detail": "Empty file"}
return WellInventoryResult(1, json.dumps(payload), payload["detail"], payload)
try:
text = content.decode("utf-8")
# Accept UTF-8 CSVs saved with a BOM so the first header is parsed correctly.
text = content.decode("utf-8-sig")
except UnicodeDecodeError:
payload = {"detail": "File encoding error"}
return WellInventoryResult(1, json.dumps(payload), payload["detail"], payload)
try:
progress_callback = None
if sys.stdout.isatty():
progress_callback = lambda message: print(message, flush=True)
payload = import_well_inventory_csv(
text=text, user={"sub": "cli", "name": "cli"}
text=text,
user={"sub": "cli", "name": "cli"},
progress_callback=progress_callback,
)
except ValueError as exc:
payload = {"detail": str(exc)}
return WellInventoryResult(1, json.dumps(payload), payload["detail"], payload)
exit_code = 0 if not payload.get("validation_errors") else 1
return WellInventoryResult(exit_code, json.dumps(payload), "", payload)
exit_code = (
0 if not payload.get("validation_errors") and not payload.get("detail") else 1
)
stderr = ""
if exit_code != 0:
if payload.get("validation_errors"):
stderr = f"Validation errors: {json.dumps(payload.get('validation_errors'), indent=2)}"
else:
stderr = f"Error: {payload.get('detail')}"
return WellInventoryResult(exit_code, json.dumps(payload), stderr, payload)


def water_levels_csv(source_file: Path | str, *, pretty_json: bool = False):
Expand Down
2 changes: 1 addition & 1 deletion core/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
)
LimitType: type[Enum] = build_enum_from_lexicon_category("limit_type")
MeasurementMethod: type[Enum] = build_enum_from_lexicon_category("measurement_method")
MonitoringStatus: type[Enum] = build_enum_from_lexicon_category("monitoring_status")
MonitoringStatus: type[Enum] = build_enum_from_lexicon_category("status_value")
ParameterName: type[Enum] = build_enum_from_lexicon_category("parameter_name")
Organization: type[Enum] = build_enum_from_lexicon_category("organization")
OriginType: type[Enum] = build_enum_from_lexicon_category("origin_type")
Expand Down
112 changes: 112 additions & 0 deletions core/lexicon.json
Original file line number Diff line number Diff line change
Expand Up @@ -4452,6 +4452,111 @@
"term": "Zamora Accounting Services",
"definition": "Zamora Accounting Services"
},
{
"categories": [
"organization"
],
"term": "Agua Sana MWCD",
"definition": "Agua Sana MWCD"
},
{
"categories": [
"organization"
],
"term": "Canada Los Alamos MDWCA",
"definition": "Canada Los Alamos MDWCA"
},
{
"categories": [
"organization"
],
"term": "Canjilon Mutual Domestic Water System",
"definition": "Canjilon Mutual Domestic Water System"
},
{
"categories": [
"organization"
],
"term": "Cebolla Mutual Domestic",
"definition": "Cebolla Mutual Domestic"
},
{
"categories": [
"organization"
],
"term": "Chihuahuan Desert Rangeland Research Center (CDRRC)",
"definition": "Chihuahuan Desert Rangeland Research Center (CDRRC)"
},
{
"categories": [
"organization"
],
"term": "East Rio Arriba SWCD",
"definition": "East Rio Arriba SWCD"
},
{
"categories": [
"organization"
],
"term": "El Prado Municipal Water",
"definition": "El Prado Municipal Water"
},
{
"categories": [
"organization"
],
"term": "Hachita Mutual Domestic",
"definition": "Hachita Mutual Domestic"
},
{
"categories": [
"organization"
],
"term": "Jornada Experimental Range (JER)",
"definition": "Jornada Experimental Range (JER)"
},
{
"categories": [
"organization"
],
"term": "La Canada Way HOA",
"definition": "La Canada Way HOA"
},
{
"categories": [
"organization"
],
"term": "Los Ojos Mutual Domestic",
"definition": "Los Ojos Mutual Domestic"
},
{
"categories": [
"organization"
],
"term": "The Nature Conservancy (TNC)",
"definition": "The Nature Conservancy (TNC)"
},
{
"categories": [
"organization"
],
"term": "Smith Ranch LLC",
"definition": "Smith Ranch LLC"
},
{
"categories": [
"organization"
],
"term": "Zia Pueblo",
"definition": "Zia Pueblo"
},
{
"categories": [
"organization"
],
"term": "Our Lady of Guadalupe (OLG)",
"definition": "Our Lady of Guadalupe (OLG)"
},
{
"categories": [
"organization"
Expand Down Expand Up @@ -8185,6 +8290,13 @@
"term": "Water",
"definition": "Water bearing zone information and other info from ose reports"
},
{
"categories": [
"note_type"
],
"term": "Water Quality",
"definition": "Water quality information"
},
{
"categories": [
"note_type"
Expand Down
2 changes: 1 addition & 1 deletion schemas/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class CreateContact(BaseCreateModel, ValidateContact):
name: str | None = None
organization: str | None = None
role: Role
contact_type: ContactType = "Primary"
contact_type: ContactType
nma_pk_owners: str | None = None
# description: str | None = None
# email: str | None = None
Expand Down
1 change: 1 addition & 0 deletions schemas/thing.py
Copy link
Contributor

Choose a reason for hiding this comment

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

If monitoring_status is added in CreateWell then I think that it should also be a field in WellResponse

Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class CreateWell(CreateBaseThing, ValidateWell):
is_suitable_for_datalogger: bool | None = None
is_open: bool | None = None
well_status: str | None = None
monitoring_status: str | None = None
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be restricted to MonitoringStatus enum values

formation_completion_code: FormationCode | None = None
nma_formation_zone: str | None = None

Expand Down
Loading
Loading