Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
196 commits
Select commit Hold shift + click to select a range
c0f77a6
feat: implement BDD steps for well inventory CSV upload and validation
jirhiker Nov 12, 2025
168dda0
feat: add BDD steps and validation for well inventory CSV upload
jirhiker Nov 14, 2025
f3b39d9
feat: add additional BDD steps for well inventory CSV validation scen…
jirhiker Nov 14, 2025
85ec7fd
Merge branch 'refs/heads/staging' into well-inventory-csv
jirhiker Nov 14, 2025
bd2dc36
fix: refactor CSV handling in well-inventory steps and add error hand…
jirhiker Nov 14, 2025
69c2b03
fix: update well inventory CSV validation to use context.rows for imp…
jirhiker Nov 14, 2025
6d1e55c
feat: implement well inventory CSV upload endpoint with validation an…
jirhiker Nov 15, 2025
77d6283
fix: update well inventory CSV handling to improve validation and err…
jirhiker Nov 15, 2025
897286c
feat: enhance well inventory CSV processing with improved validation,…
jirhiker Nov 16, 2025
96220b4
feat: expand well inventory CSV model with additional contact and wel…
jirhiker Nov 17, 2025
a9bd8ed
Merge branch 'staging' into well-inventory-csv
jirhiker Nov 17, 2025
94feba4
feat: refactor well inventory CSV processing with improved model vali…
jirhiker Nov 18, 2025
a26217c
Merge branch 'refs/heads/staging' into well-inventory-csv
jirhiker Nov 19, 2025
c9a9cba
refactor: enhance well inventory processing with new models and impro…
jirhiker Nov 19, 2025
594888a
refactor: streamline well inventory data handling and enhance model v…
jirhiker Nov 20, 2025
e5ef68d
refactor: enhance contact role validation and improve error handling …
jirhiker Nov 20, 2025
75f57ac
refactor: enhance contact role validation and improve error handling …
jirhiker Nov 20, 2025
ae06bff
refactor: improve error handling and streamline well data processing …
jirhiker Nov 20, 2025
8c6a636
Potential fix for code scanning alert no. 11: Information exposure th…
jirhiker Nov 20, 2025
e22ac60
Formatting changes
jirhiker Nov 20, 2025
350ff14
Merge remote-tracking branch 'origin/well-inventory-csv' into well-in…
jirhiker Nov 20, 2025
d7c3ba6
refactor: improve error handling for CSV file uploads in well invento…
jirhiker Nov 20, 2025
368a91a
refactor: update error handling in CSV response validation and stream…
jirhiker Nov 21, 2025
fc5cdf5
refactor: update well inventory CSV files with corrected UTM coordina…
jirhiker Nov 21, 2025
fa572aa
refactor: consolidate validation error handling for well inventory pr…
jirhiker Nov 21, 2025
dc5e97e
refactor: improve object deletion logic and streamline group associat…
jirhiker Nov 21, 2025
c7518e7
refactor: update well inventory CSV files to correct UTM zones and en…
jirhiker Nov 21, 2025
283e8ed
feat: add validation for duplicate headers and improve error handling…
jirhiker Nov 21, 2025
8019b3b
refactor: enhance CSV validation by adding row limit and delimiter ch…
jirhiker Nov 22, 2025
4ef7bff
refactor: implement auto-generation of unique well_name_point_id valu…
jirhiker Nov 23, 2025
2b6958b
refactor: update type aliases for optional fields and modify contact …
jirhiker Nov 24, 2025
df3a7cf
refactor: add get_bool_env utility function and update well purpose t…
jirhiker Nov 24, 2025
089cb13
fix: update historic_depth_to_water to use OptoinalFloat
chasetmartin Nov 24, 2025
b60546d
refactor: update Group model to enforce unique constraint on name and…
jirhiker Nov 24, 2025
0de0ddb
refactor: specify group_type as "Monitoring Plan" when creating new G…
jirhiker Nov 24, 2025
9a595ff
refactor: add support for an additional well purpose field in the model
jirhiker Nov 24, 2025
ecfea93
refactor: enhance CSV processing to include field events and staff ma…
jirhiker Nov 25, 2025
d79dde4
refactor: enhance sensor transfer process with recording interval est…
jirhiker Nov 25, 2025
d647d51
refactor: improve contact handling by adding user parameter and optim…
jirhiker Nov 25, 2025
b10ff57
refactor: optimize group selection query by using and_ for conditions
jirhiker Dec 1, 2025
e75352f
Merge branch 'staging' into well-inventory-csv
jirhiker Dec 5, 2025
4a91381
Merge branch 'staging' into bdms-389-well-inventory-csv-updates
jacob-a-brown Dec 9, 2025
36122f0
fix: use lexicon values in well inventory CSV testing data
jacob-a-brown Dec 9, 2025
339f839
feat: ignore .DS_Store
jacob-a-brown Dec 9, 2025
27bb37e
refactor: update origin_source to origin_type in lexicon
jacob-a-brown Dec 9, 2025
9c79e8d
feat: add well inventory csv gherkin file
jacob-a-brown Dec 9, 2025
1b4bfcc
refactor: default engine's port to 54321 to reflect docker
jacob-a-brown Dec 9, 2025
6b37efa
feat: add well inventory as possible activity_type
jacob-a-brown Dec 9, 2025
6560b92
note: indicate which fields still need a home in the models
jacob-a-brown Dec 9, 2025
0387409
feat: update CreateWell and CreateThing schemas for well inventory CS…
jacob-a-brown Dec 9, 2025
a7a0968
feat/refactor: move logic for thing tables to add_thing
jacob-a-brown Dec 9, 2025
a70b71c
feat: update well transfer script to account for updated CreateWell s…
jacob-a-brown Dec 9, 2025
9f7fa8c
Merge branch 'staging' into well-inventory-csv
jacob-a-brown Dec 9, 2025
13c5c90
Merge branch 'well-inventory-csv' into bdms-389-well-inventory-csv-up…
jacob-a-brown Dec 9, 2025
8577af4
feat: add field activity record for the well inventory
jacob-a-brown Dec 9, 2025
efa3af4
fix: reset default POSTGRES_PORT to 5432 and update POSTGRES_PORT in …
jacob-a-brown Dec 10, 2025
872ae4b
Merge pull request #282 from DataIntegrationGroup/bdms-389-well-inven…
jirhiker Dec 10, 2025
2df0026
Merge branch 'staging' into well-inventory-csv
jacob-a-brown Dec 10, 2025
12148bc
feat: add historic water level note to well
jacob-a-brown Dec 10, 2025
918c6eb
feat: add water level fields and scenario to well inventory feature
chasetmartin Dec 10, 2025
0a617ff
Merge pull request #286 from DataIntegrationGroup/cm-well-inventory-f…
jirhiker Dec 10, 2025
1c28a4c
feat: add notes to contact
jacob-a-brown Dec 11, 2025
01e66d4
Merge branch 'staging' into contact-note-implementation
jacob-a-brown Dec 11, 2025
5e227e2
Merge branch 'staging' into well-inventory-csv
jacob-a-brown Dec 11, 2025
9e09e23
Merge branch 'well-inventory-csv' of https://github.com/DataIntegrati…
jacob-a-brown Dec 11, 2025
c3a2b98
feat: add optional water level entry fields and validation for comple…
jirhiker Dec 11, 2025
12b7c03
Merge branch 'well-inventory-csv' into contact-note-implementation
jacob-a-brown Dec 11, 2025
3508921
feat: implement contact notes in well inventory import and API
jacob-a-brown Dec 11, 2025
b4ed76e
feat: refresh thing notes after adding
jacob-a-brown Dec 11, 2025
705e862
Merge branch 'well-inventory-csv' of https://github.com/DataIntegrati…
jacob-a-brown Dec 11, 2025
d207c81
Merge branch 'well-inventory-csv' into contact-note-implementation
jacob-a-brown Dec 11, 2025
d1b0e4b
Merge branch 'well-inventory-csv' into bdms-389-well-inventory-csv-up…
jacob-a-brown Dec 11, 2025
a20cfb9
feat: add sampling_scenario_notes as a Sampling Procedure note to well
jacob-a-brown Dec 11, 2025
3013207
Merge pull request #290 from DataIntegrationGroup/contact-note-implem…
jirhiker Dec 11, 2025
0556e2c
Merge branch 'staging' into well-inventory-csv
jacob-a-brown Dec 11, 2025
f4dd1ff
Merge branch 'well-inventory-csv' into bdms-389-historic-well-notes
jacob-a-brown Dec 11, 2025
bec2a04
feat: add historic depth to water source in well notes
jacob-a-brown Dec 11, 2025
9bf285f
Merge pull request #291 from DataIntegrationGroup/bdms-389-historic-w…
jirhiker Dec 11, 2025
2e903f6
fix: add missing well inventory fields and fix contact association
jacob-a-brown Dec 11, 2025
a1832ab
Merge branch 'well-inventory-csv' into well-purposes-fix
jacob-a-brown Dec 11, 2025
4ca5683
fix: note_type is 'Historical' not 'Historic'
jacob-a-brown Dec 11, 2025
d897d0b
Merge pull request #293 from DataIntegrationGroup/well-purposes-fix
jirhiker Dec 11, 2025
9febedd
feat: ensure date/time values are today or in the past
jacob-a-brown Dec 11, 2025
9c7e635
fix: require date_time field
jacob-a-brown Dec 11, 2025
78f7d2d
fix: mp ehgith and dtw should be floats not strings
jacob-a-brown Dec 12, 2025
48dcb65
Merge pull request #294 from DataIntegrationGroup/datetime-validation…
jirhiker Dec 12, 2025
bac1792
Merge branch 'refs/heads/staging' into well-inventory-csv
jirhiker Dec 12, 2025
82ee91a
refactor: remove redundant UTF-8 encoding check from CSV steps
jirhiker Dec 12, 2025
2d76a12
refactor: clarify references to water level CSV in feature and implem…
jirhiker Dec 12, 2025
e208768
feat: add open status and datalogger installation status to lexicon
jacob-a-brown Dec 12, 2025
c0c743e
refactor: use the nomenclature 'Datalogger Suitability Status' for cl…
jacob-a-brown Dec 12, 2025
a8718c6
refactor: store open status and datalogger suitability status in stat…
jacob-a-brown Dec 12, 2025
5ef51df
refactor: transfer datalogger suitability to status history table
jacob-a-brown Dec 12, 2025
2fc4493
feat: map open unequipped wells to status history
jacob-a-brown Dec 12, 2025
9cb7464
fix: permission should be datalogger installation not suitability in …
jacob-a-brown Dec 12, 2025
1c1a050
fix: remove print debugging error
jacob-a-brown Dec 12, 2025
09d77ad
Merge branch 'status-history-refactor' into well-inventory-csv
jacob-a-brown Dec 15, 2025
b5afa13
feat: add open and datalogger suitability status to well inventory an…
jacob-a-brown Dec 15, 2025
7ad83e8
fix: remove debugging print statement
jacob-a-brown Dec 16, 2025
4bd9b99
fix: remove print debugging statement
jacob-a-brown Dec 16, 2025
d4fcfb5
fix: remove outdated variable from testing env
jacob-a-brown Dec 16, 2025
c84a229
fix: rectify variable mishap that occurred with merge conflict
jacob-a-brown Dec 16, 2025
3a5874e
Merge branch 'well-inventory-csv' into bdms-389-well-statuses
jacob-a-brown Dec 16, 2025
9e55601
fix: don't erase testing data by default
jacob-a-brown Dec 16, 2025
b7f8975
fix: remove outdated comment
jacob-a-brown Dec 16, 2025
e56993c
Merge branch 'well-inventory-csv' into bdms-389-well-statuses
jacob-a-brown Dec 16, 2025
3d4c6b5
Merge pull request #306 from DataIntegrationGroup/bdms-389-well-statuses
chasetmartin Dec 16, 2025
f137c91
fix: update measuing_person and date_time field names in water level …
chasetmartin Dec 16, 2025
65cdd83
feat: update date time timezone handling in well inventory feature
chasetmartin Dec 16, 2025
6f6009d
Merge pull request #307 from DataIntegrationGroup/cm-well-inventory-c…
chasetmartin Dec 17, 2025
ede6209
refactor: remove tz offset from date validations in well inventory CS…
jacob-a-brown Dec 17, 2025
81305ed
refactor: update valid well inventory CSV test data to have MST and M…
jacob-a-brown Dec 17, 2025
47437ad
feat: convert naive dt to tz aware dt in well inventory CSV import
jacob-a-brown Dec 17, 2025
d17d835
feat: update well inventory csv step tests per feature file
jacob-a-brown Dec 17, 2025
a4a603b
feat: account for future water level implementation in tests
jacob-a-brown Dec 17, 2025
3867554
Merge pull request #311 from DataIntegrationGroup/well-inventory-csv-…
chasetmartin Dec 18, 2025
029f32a
Merge branch 'staging' into well-inventory-csv
jacob-a-brown Jan 5, 2026
8aa3fbe
Merge branch 'staging' into well-inventory-csv
jacob-a-brown Feb 2, 2026
772b6a3
fix: resolve artifacts from merge conflicts
jacob-a-brown Feb 2, 2026
fb5a8b5
fix: remove is_suitable_for_datalogger from Well model
jacob-a-brown Feb 2, 2026
e38b546
fix: import from transducer
jacob-a-brown Feb 2, 2026
e4a0a2c
fix: use MG-043 not MG-033
jacob-a-brown Feb 2, 2026
d6de89a
fix: remove is_suitable_for_datalogger field from thing admin
jacob-a-brown Feb 2, 2026
e8a5228
fix: add status history properties to OGC features
jacob-a-brown Feb 2, 2026
4d4c02a
feat: add more detailed notes about well inventory
jacob-a-brown Feb 2, 2026
1f6676b
fix: remove outdated note
jacob-a-brown Feb 3, 2026
50970db
fix: create monitoring frequencies for things
jacob-a-brown Feb 3, 2026
da7a88c
feat: test that data is persisted as expected for well inventory
jacob-a-brown Feb 3, 2026
60fc69e
fix: cleanup well inventory pytest
jacob-a-brown Feb 3, 2026
8633977
feat: test contact notes
jacob-a-brown Feb 3, 2026
bbfa939
feat: add datalogger/open status to well transfer & fix exclusions
jacob-a-brown Feb 3, 2026
e237672
fix: remove duplicate lexicon values
jacob-a-brown Feb 3, 2026
311917f
fix: fix typo
jacob-a-brown Feb 3, 2026
2d4dfd7
fix: fix spelling typo in note
jacob-a-brown Feb 3, 2026
4f751a3
fix: remove duplicate excluded fields from well transfer
jacob-a-brown Feb 3, 2026
cd9e330
test: add comprehensive tests for well inventory CSV upload
kbighorse Feb 4, 2026
e5be6af
Formatting changes
kbighorse Feb 4, 2026
6794d81
fix: add missing imports to ChemistrySampleInfoAdmin
kbighorse Feb 4, 2026
ec956ea
Add regression tests for well inventory validation and query patterns
kbighorse Feb 4, 2026
43c53e7
Merge branch 'staging' into well-inventory-csv
jacob-a-brown Feb 4, 2026
2791889
feat: record well_hole_status in StatusHistory
jacob-a-brown Feb 5, 2026
bee061e
fix: exclude well_status from tansfer into Thing table
jacob-a-brown Feb 5, 2026
cf5c371
fix: fix spelling typo
jacob-a-brown Feb 5, 2026
4b0917e
fix: remove print debugging statement
jacob-a-brown Feb 5, 2026
6364052
feat: test status histories for well inventory
jacob-a-brown Feb 5, 2026
3f457f1
note: add note about EXCLUDED_FIELDS in well transfer
jacob-a-brown Feb 5, 2026
8e2bd78
Update services/thing_helper.py
jirhiker Feb 6, 2026
f9d0090
Update transfers/tester.py
jirhiker Feb 6, 2026
df83c48
Update services/util.py
jirhiker Feb 6, 2026
fd95224
Update db/group.py
jirhiker Feb 6, 2026
5986657
Formatting changes
jirhiker Feb 6, 2026
bec8a4e
refactor: Update well inventory CSV test to check for unique well_nam…
jacob-a-brown Feb 6, 2026
f374c0b
fix: assert num validation errors matches expected
jacob-a-brown Feb 6, 2026
0c19e2e
fix: raise error if CSV cannot be parsesd
jacob-a-brown Feb 6, 2026
1a0c0e3
fix: fix Annotated type hint for past or today date and datetime
jacob-a-brown Feb 6, 2026
85e2d4d
fix: update CreateBaseThing to handle alternate_ids in before mode
jacob-a-brown Feb 6, 2026
5e362cc
fix: use correct type hint for generated_autogen_well_id
jacob-a-brown Feb 6, 2026
8b574b1
fix: raise error if UTM zone not 12N or 13N
jacob-a-brown Feb 6, 2026
ca7c927
fix: rollback partial addition of wells on error during bulk import
jacob-a-brown Feb 6, 2026
cf69ad7
fix: temp edit to reset workflow
jacob-a-brown Feb 6, 2026
daaf883
test: show alembic heads in tests to debug
jacob-a-brown Feb 6, 2026
8b3843d
test: show alembic heads in tests to debug
jacob-a-brown Feb 6, 2026
e753db9
fix: use uv to run alembic in migration
jacob-a-brown Feb 6, 2026
57b1e48
Merge branch 'staging' into well-inventory-csv
jacob-a-brown Feb 6, 2026
cee9c5a
fix: point alembic revision to latest staging revision
jacob-a-brown Feb 6, 2026
d9b2bd8
fix: ensure thing data is dict before popping in add_thing
jacob-a-brown Feb 6, 2026
8567db7
fix: allow phone number to be optional in well inventory import
jacob-a-brown Feb 6, 2026
39c3452
fix: if PastOrToday validator receives a naive datetime, compare to c…
jacob-a-brown Feb 6, 2026
7e197c4
Merge branch 'staging' into well-inventory-csv
jacob-a-brown Feb 6, 2026
a21f7f0
Update api/well_inventory.py
jirhiker Feb 6, 2026
6821153
Update schemas/well_inventory.py
jirhiker Feb 6, 2026
5204137
Update api/well_inventory.py
jirhiker Feb 6, 2026
a150f45
Update services/thing_helper.py
jirhiker Feb 6, 2026
2d5ab53
Update services/thing_helper.py
jirhiker Feb 6, 2026
93ce87e
Update tests/test_well_inventory.py
jirhiker Feb 6, 2026
f171a60
Update tests/features/steps/well-inventory-csv-given.py
jirhiker Feb 6, 2026
eaf26b5
Update services/thing_helper.py
jirhiker Feb 6, 2026
366a71f
Update schemas/well_inventory.py
jirhiker Feb 6, 2026
aebe40c
Update tests/test_well_inventory.py
jirhiker Feb 6, 2026
34bfd14
Update services/util.py
jirhiker Feb 7, 2026
ef49776
feat: implement well inventory CSV import functionality and related m…
jirhiker Feb 7, 2026
eb06ca4
feat: enhance well inventory CSV processing with improved error handl…
jirhiker Feb 7, 2026
0add256
Formatting changes
jirhiker Feb 7, 2026
9a901bc
Update tests/test_well_inventory.py
jirhiker Feb 7, 2026
b075aa5
Update services/well_inventory_csv.py
jirhiker Feb 7, 2026
294fcb7
Update schemas/thing.py
jirhiker Feb 7, 2026
ef4a3f1
feat: refactor well inventory CSV processing for improved error handl…
jirhiker Feb 7, 2026
a53ec1a
Formatting changes
jirhiker Feb 7, 2026
231eff4
Update schemas/well_inventory.py
jirhiker Feb 7, 2026
65a1e9e
fix: clean up EOF comments in well_inventory.py and add default thing…
jirhiker Feb 7, 2026
3f180f1
Update services/well_inventory_csv.py
jirhiker Feb 7, 2026
1c37e01
Update tests/features/well-inventory-csv.feature
jirhiker Feb 7, 2026
7c09529
Formatting changes
jirhiker Feb 7, 2026
335ae97
Merge branch 'staging' into well-inventory-csv
jirhiker Feb 7, 2026
60614ea
feat: update well inventory fields and improve validation error handling
jirhiker Feb 8, 2026
4d0a796
Formatting changes
jirhiker Feb 8, 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
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ MODE=development
# disable authentication (for development only)
AUTHENTIK_DISABLE_AUTHENTICATION=1

# erase and rebuild the database for step tests
REBUILD_DB=1
Comment thread
jacob-a-brown marked this conversation as resolved.

# authentik
AUTHENTIK_URL=
AUTHENTIK_CLIENT_ID=
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ jobs:
- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Show Alembic heads
run: uv run alembic heads

- name: Create test database
run: |
PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -c "CREATE DATABASE ocotilloapi_test"
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ requirements.txt

# VS Code

# macOS
.DS_Store

# local development files
development.db
.env
Expand Down
1 change: 0 additions & 1 deletion admin/views/thing.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class ThingAdmin(OcotilloModelView):
"well_pump_type",
"well_pump_depth",
"formation_completion_code",
"is_suitable_for_datalogger",
# Spring-specific
"spring_type",
# Release Status
Expand Down
31 changes: 31 additions & 0 deletions alembic/versions/7b8c9d0e1f2a_delete_is_suitable_for_datalogger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
Revision ID: 7b8c9d0e1f2a
Revises: c7f8a9b0c1d2
Create Date: 2026-02-02 00:00:00.000000

Removes the is_suitable_for_datalogger column from the thing and thing_version tables.
"""

# revision identifiers, used by Alembic.
revision = "7b8c9d0e1f2a"
down_revision = "c7f8a9b0c1d2"
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade():
op.drop_column("thing", "is_suitable_for_datalogger")
op.drop_column("thing_version", "is_suitable_for_datalogger")


def downgrade():
op.add_column(
"thing", sa.Column("is_suitable_for_datalogger", sa.Boolean(), nullable=True)
)
op.add_column(
"thing_version",
sa.Column("is_suitable_for_datalogger", sa.Boolean(), nullable=True),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
"""update group uniqueness from name to (name, group_type)

Revision ID: h1b2c3d4e5f6
Revises: 7b8c9d0e1f2a
Create Date: 2026-02-07 13:15:00.000000
"""

from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

revision: str = "h1b2c3d4e5f6"
down_revision: Union[str, Sequence[str], None] = "7b8c9d0e1f2a"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def _existing_unique_constraints() -> list[dict]:
bind = op.get_bind()
inspector = sa.inspect(bind)
return inspector.get_unique_constraints("group")


def _drop_name_only_unique_constraints() -> None:
# Drop any existing unique constraint that enforces uniqueness on name only.
for constraint in _existing_unique_constraints():
columns = constraint.get("column_names") or []
name = constraint.get("name")
if name and columns == ["name"]:
op.drop_constraint(name, "group", type_="unique")


def _ensure_no_duplicate_name_group_type_pairs() -> None:
bind = op.get_bind()
duplicate = bind.execute(sa.text("""
SELECT name, group_type, COUNT(*) AS cnt
FROM "group"
WHERE group_type IS NOT NULL
GROUP BY name, group_type
HAVING COUNT(*) > 1
LIMIT 1
""")).first()
if duplicate:
raise RuntimeError(
"Cannot create uq_group_name_type: duplicate (name, group_type) rows exist."
)


def _ensure_no_duplicate_names() -> None:
bind = op.get_bind()
duplicate = bind.execute(sa.text("""
SELECT name, COUNT(*) AS cnt
FROM "group"
GROUP BY name
HAVING COUNT(*) > 1
LIMIT 1
""")).first()
if duplicate:
raise RuntimeError(
"Cannot recreate uq_group_name: duplicate group names exist."
)


def upgrade() -> None:
_drop_name_only_unique_constraints()
_ensure_no_duplicate_name_group_type_pairs()

constraint_names = {
c.get("name") for c in _existing_unique_constraints() if c.get("name")
}
if "uq_group_name_type" not in constraint_names:
op.create_unique_constraint(
"uq_group_name_type", "group", ["name", "group_type"]
)


def downgrade() -> None:
constraint_names = {
c.get("name") for c in _existing_unique_constraints() if c.get("name")
}
if "uq_group_name_type" in constraint_names:
op.drop_constraint("uq_group_name_type", "group", type_="unique")

_ensure_no_duplicate_names()

constraint_names = {
c.get("name") for c in _existing_unique_constraints() if c.get("name")
}
if "uq_group_name" not in constraint_names:
op.create_unique_constraint("uq_group_name", "group", ["name"])
5 changes: 5 additions & 0 deletions api/lexicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,18 @@ async def get_lexicon_term(
async def get_lexicon_categories(
session: session_dependency,
user: viewer_dependency,
name: str | None = None,
sort: str = "name",
order: str = "asc",
filter_: str = Query(alias="filter", default=None),
) -> CustomPage[LexiconCategoryResponse]:
"""
Endpoint to retrieve lexicon categories.
"""
if name:
sql = select(LexiconCategory).where(LexiconCategory.name.ilike(f"%{name}%"))
return paginated_all_getter(session, LexiconCategory, sort, order, filter_, sql)

return paginated_all_getter(session, LexiconCategory, sort, order, filter_)


Expand Down
9 changes: 7 additions & 2 deletions api/ogc/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ def _build_feature(row, collection_id: str) -> dict[str, Any]:
"well_pump_type": model.well_pump_type,
"well_pump_depth": model.well_pump_depth,
"formation_completion_code": model.formation_completion_code,
"is_suitable_for_datalogger": model.is_suitable_for_datalogger,
}
if collection_id == "wells":
properties["well_purposes"] = [
Expand All @@ -281,6 +280,10 @@ def _build_feature(row, collection_id: str) -> dict[str, Any]:
}
for screen in (model.screens or [])
]
properties["open_status"] = model.open_status
properties["datalogger_suitability_status"] = (
model.datalogger_suitability_status
)
if hasattr(model, "nma_formation_zone"):
properties["nma_formation_zone"] = model.nma_formation_zone
return {
Expand Down Expand Up @@ -350,7 +353,9 @@ def get_items(
"well_pump_type": Thing.well_pump_type,
"well_pump_depth": Thing.well_pump_depth,
"formation_completion_code": Thing.formation_completion_code,
"is_suitable_for_datalogger": Thing.is_suitable_for_datalogger,
"well_status": Thing.well_status,
"open_status": Thing.open_status,
"datalogger_suitability_status": Thing.datalogger_suitability_status,
Comment thread
jirhiker marked this conversation as resolved.
}
if hasattr(Thing, "nma_formation_zone"):
column_map["nma_formation_zone"] = Thing.nma_formation_zone
Expand Down
Loading