@@ -98,10 +98,6 @@ class Thing(Base, AutoBaseMixin, ReleaseMixin, StatusHistoryMixin, PermissionMix
9898 info = {"unit" : "feet below ground surface" },
9999 comment = "Depth of the well casing from ground surface to the bottom of the casing (in feet)." ,
100100 )
101- well_casing_material : Mapped [str ] = lexicon_term (
102- nullable = True ,
103- comment = "Material of the well casing (e.g., 'PVC', 'Steel', 'Concrete', 'Wood')." ,
104- )
105101
106102 well_construction_notes : Mapped [str ] = mapped_column (Text , nullable = True )
107103
@@ -211,6 +207,22 @@ class Thing(Base, AutoBaseMixin, ReleaseMixin, StatusHistoryMixin, PermissionMix
211207 passive_deletes = True ,
212208 )
213209
210+ well_purposes : Mapped [List ["WellPurpose" ]] = relationship (
211+ "WellPurpose" ,
212+ back_populates = "thing" ,
213+ cascade = "all, delete-orphan" ,
214+ passive_deletes = True ,
215+ lazy = "joined" ,
216+ )
217+
218+ well_casing_materials : Mapped [List ["WellCasingMaterial" ]] = relationship (
219+ "WellCasingMaterial" ,
220+ back_populates = "thing" ,
221+ cascade = "all, delete-orphan" ,
222+ passive_deletes = True ,
223+ lazy = "joined" ,
224+ )
225+
214226 # --- Association Proxies ---
215227 assets : AssociationProxy [list ["Asset" ]] = association_proxy (
216228 "asset_associations" , "asset"
@@ -237,11 +249,7 @@ class Thing(Base, AutoBaseMixin, ReleaseMixin, StatusHistoryMixin, PermissionMix
237249 )
238250
239251 # Full-text search vector
240- search_vector = Column (
241- TSVectorType (
242- "name" , "well_construction_notes" , "well_purpose" , "well_casing_material"
243- )
244- )
252+ search_vector = Column (TSVectorType ("name" , "well_construction_notes" ))
245253
246254 @property
247255 def current_location (self ):
@@ -302,6 +310,39 @@ class WellScreen(Base, AutoBaseMixin, ReleaseMixin):
302310 thing : Mapped ["Thing" ] = relationship ("Thing" , back_populates = "screens" )
303311
304312
313+ class WellPurpose (Base , AutoBaseMixin , ReleaseMixin ):
314+ """
315+ Represents a controlled vocabulary term for well purposes.
316+ """
317+
318+ thing_id : Mapped [int ] = mapped_column (
319+ Integer , ForeignKey ("thing.id" , ondelete = "CASCADE" ), nullable = False
320+ )
321+ purpose : Mapped [str ] = lexicon_term (nullable = False , unique = True )
322+
323+ search_vector : Mapped [TSVectorType ] = mapped_column (TSVectorType ("purpose" ))
324+
325+ thing : Mapped ["Thing" ] = relationship ("Thing" , back_populates = "well_purposes" )
326+
327+
328+ class WellCasingMaterial (Base , AutoBaseMixin , ReleaseMixin ):
329+ """
330+ Represents a controlled vocabulary term for well casing materials.
331+ """
332+
333+ thing_id : Mapped [int ] = mapped_column (
334+ Integer , ForeignKey ("thing.id" , ondelete = "CASCADE" ), nullable = False
335+ )
336+
337+ material : Mapped [str ] = lexicon_term (nullable = False , unique = True )
338+
339+ search_vector : Mapped [TSVectorType ] = mapped_column (TSVectorType ("material" ))
340+
341+ thing : Mapped ["Thing" ] = relationship (
342+ "Thing" , back_populates = "well_casing_materials"
343+ )
344+
345+
305346# TODO: this could be the model used to handle AMP monitoring
306347# class FieldSamplingAdministation(Base, AutoBaseMixin):
307348# # the thing being monitored
0 commit comments