Skip to content

Commit e436125

Browse files
committed
fix: standardize thing type terminology in lexicon and payloads
1 parent d6bf42c commit e436125

3 files changed

Lines changed: 39 additions & 14 deletions

File tree

core/lexicon.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,42 +2011,42 @@
20112011
"categories": [
20122012
"thing_type"
20132013
],
2014-
"term": "Rock sample location",
2014+
"term": "rock sample location",
20152015
"definition": "a location where rock samples are collected"
20162016
},
20172017
{
20182018
"categories": [
20192019
"thing_type"
20202020
],
2021-
"term": "Diversion of surface water, etc.",
2021+
"term": "diversion of surface water, etc.",
20222022
"definition": "a diversion structure for surface water such as a ditch, canal, or intake"
20232023
},
20242024
{
20252025
"categories": [
20262026
"thing_type"
20272027
],
2028-
"term": "Lake, pond or reservoir",
2028+
"term": "lake, pond or reservoir",
20292029
"definition": "a natural or artificial standing body of water"
20302030
},
20312031
{
20322032
"categories": [
20332033
"thing_type"
20342034
],
2035-
"term": "Soil gas sample location",
2035+
"term": "soil gas sample location",
20362036
"definition": "a location where soil gas samples are collected"
20372037
},
20382038
{
20392039
"categories": [
20402040
"thing_type"
20412041
],
2042-
"term": "Other",
2042+
"term": "other",
20432043
"definition": "a thing type that does not fit other categories"
20442044
},
20452045
{
20462046
"categories": [
20472047
"thing_type"
20482048
],
2049-
"term": "Outfall of wastewater or return flow",
2049+
"term": "outfall of wastewater or return flow",
20502050
"definition": "a discharge point for wastewater or return flows"
20512051
},
20522052
{

transfers/thing_transfer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def transfer_rock_sample_locations(session, limit=None):
146146
def make_payload(row):
147147
return {
148148
"name": row.PointID,
149-
"thing_type": "Rock sample location",
149+
"thing_type": "rock sample location",
150150
"release_status": _release_status(row),
151151
}
152152

@@ -157,7 +157,7 @@ def transfer_diversion_of_surface_water(session, limit=None):
157157
def make_payload(row):
158158
return {
159159
"name": row.PointID,
160-
"thing_type": "Diversion of surface water, etc.",
160+
"thing_type": "diversion of surface water, etc.",
161161
"release_status": _release_status(row),
162162
}
163163

@@ -168,7 +168,7 @@ def transfer_lake_pond_reservoir(session, limit=None):
168168
def make_payload(row):
169169
return {
170170
"name": row.PointID,
171-
"thing_type": "Lake, pond or reservoir",
171+
"thing_type": "lake, pond or reservoir",
172172
"release_status": _release_status(row),
173173
}
174174

@@ -179,7 +179,7 @@ def transfer_soil_gas_sample_locations(session, limit=None):
179179
def make_payload(row):
180180
return {
181181
"name": row.PointID,
182-
"thing_type": "Soil gas sample location",
182+
"thing_type": "soil gas sample location",
183183
"release_status": _release_status(row),
184184
}
185185

@@ -190,7 +190,7 @@ def transfer_other_site_types(session, limit=None):
190190
def make_payload(row):
191191
return {
192192
"name": row.PointID,
193-
"thing_type": "Other",
193+
"thing_type": "other",
194194
"release_status": _release_status(row),
195195
}
196196

@@ -201,7 +201,7 @@ def transfer_outfall_wastewater_return_flow(session, limit=None):
201201
def make_payload(row):
202202
return {
203203
"name": row.PointID,
204-
"thing_type": "Outfall of wastewater or return flow",
204+
"thing_type": "outfall of wastewater or return flow",
205205
"release_status": _release_status(row),
206206
}
207207

transfers/transfer.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@
2121

2222
from dotenv import load_dotenv
2323

24+
from transfers.thing_transfer import (
25+
transfer_rock_sample_locations,
26+
transfer_springs,
27+
transfer_perennial_streams,
28+
transfer_ephemeral_streams,
29+
transfer_met_stations,
30+
transfer_diversion_of_surface_water,
31+
transfer_lake_pond_reservoir,
32+
transfer_soil_gas_sample_locations,
33+
transfer_other_site_types,
34+
transfer_outfall_wastewater_return_flow,
35+
)
36+
2437
# Load .env file FIRST, before any database imports, to ensure correct port/database settings
2538
load_dotenv(override=True)
2639

@@ -374,7 +387,19 @@ def transfer_all(metrics: Metrics) -> list[ProfileArtifact]:
374387
# These create Things and Locations that chemistry/other transfers depend on.
375388
# =========================================================================
376389
non_well_tasks = []
377-
gs = globals()
390+
transfer_functions = {
391+
"springs": transfer_springs,
392+
"perennial_streams": transfer_perennial_streams,
393+
"ephemeral_streams": transfer_ephemeral_streams,
394+
"met_stations": transfer_met_stations,
395+
"rock_sample_locations": transfer_rock_sample_locations,
396+
"diversion_of_surface_water": transfer_diversion_of_surface_water,
397+
"lake_pond_reservoir": transfer_lake_pond_reservoir,
398+
"soil_gas_sample_locations": transfer_soil_gas_sample_locations,
399+
"other_site_types": transfer_other_site_types,
400+
"outfall_wastewater_return_flow": transfer_outfall_wastewater_return_flow,
401+
}
402+
378403
for attr in (
379404
"springs",
380405
"perennial_streams",
@@ -390,7 +415,7 @@ def transfer_all(metrics: Metrics) -> list[ProfileArtifact]:
390415
thing_type = "".join(part.capitalize() for part in attr.split("_"))
391416
attr_name = f"transfer_{attr}"
392417
if getattr(transfer_options, attr_name):
393-
transfer_func = gs[attr_name]
418+
transfer_func = transfer_functions[attr]
394419
non_well_tasks.append((thing_type, transfer_func))
395420

396421
if non_well_tasks:

0 commit comments

Comments
 (0)