Skip to content

Commit e75352f

Browse files
committed
Merge branch 'staging' into well-inventory-csv
# Conflicts: # schemas/location.py # services/util.py # tests/features/environment.py
2 parents b10ff57 + faeb9fe commit e75352f

58 files changed

Lines changed: 6151 additions & 1713 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ dist/
66
wheels/
77
*.egg-info
88

9+
# Test coverage reports
10+
*.cover
11+
.coverage
12+
.coverage.*
13+
htmlcov/
14+
coverage.xml
15+
916
# Virtual environments
1017
.venv
1118
requirements.txt
@@ -25,11 +32,11 @@ launcher.sh
2532
gcs_credentials.json
2633
transfers/data/assets*
2734
transfers/data/nma_csv_cache/*
35+
transfers/data/*.csv
2836
transfers/transfer*.log
2937
transfer*.log
3038
transfers/data/nma_csv_cache/*
3139
!transfers/data/nma_csv_cache/.gitkeep
32-
tests/features/*.feature
3340
transfers/metrics/*
3441
transfers/logs/*
3542
run_bdd-local.sh

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ repos:
2525
types: [python] # Specify relevant file types for your tests
2626
pass_filenames: false
2727
always_run: true
28+
args:
29+
- -x
2830

2931
# - repo: https://github.com/pre-commit/mirrors-mypy
3032
# rev: v1.10.0 # Use the latest stable version or pin to your preference

api/search.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ async def search_api(
175175
user: viewer_dependency,
176176
session: session_dependency,
177177
q: str,
178+
size: int = 100,
178179
limit: int = 25,
179180
) -> CustomPage[dict]:
180181
"""

api/well_inventory.py

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
from schemas.well_inventory import WellInventoryRow
5454
from services.contact_helper import add_contact
5555
from services.exceptions_helper import PydanticStyleException
56-
from services.thing_helper import add_thing, modify_well_descriptor_tables
56+
from services.thing_helper import add_thing
5757
from services.util import transform_srid, convert_ft_to_m
5858

5959
router = APIRouter(prefix="/well-inventory-csv")
@@ -93,34 +93,33 @@ def _make_contact(model: WellInventoryRow, well: Thing, idx) -> dict:
9393
addresses = []
9494
name = getattr(model, f"contact_{idx}_name")
9595
if name:
96-
for j in (1, 2):
97-
for i in (1, 2):
98-
email = getattr(model, f"contact_{j}_email_{i}")
99-
etype = getattr(model, f"contact_{j}_email_{i}_type")
100-
if email and etype:
101-
emails.append({"email": email, "email_type": etype})
102-
phone = getattr(model, f"contact_{j}_phone_{i}")
103-
ptype = getattr(model, f"contact_{j}_phone_{i}_type")
104-
if phone and ptype:
105-
phones.append({"phone_number": phone, "phone_type": ptype})
106-
107-
address_line_1 = getattr(model, f"contact_{j}_address_{i}_line_1")
108-
address_line_2 = getattr(model, f"contact_{j}_address_{i}_line_2")
109-
city = getattr(model, f"contact_{j}_address_{i}_city")
110-
state = getattr(model, f"contact_{j}_address_{i}_state")
111-
postal_code = getattr(model, f"contact_{j}_address_{i}_postal_code")
112-
address_type = getattr(model, f"contact_{j}_address_{i}_type")
113-
if address_line_1 and city and state and postal_code and address_type:
114-
addresses.append(
115-
{
116-
"address_line_1": address_line_1,
117-
"address_line_2": address_line_2,
118-
"city": city,
119-
"state": state,
120-
"postal_code": postal_code,
121-
"address_type": address_type,
122-
}
123-
)
96+
for i in (1, 2):
97+
email = getattr(model, f"contact_{idx}_email_{i}")
98+
etype = getattr(model, f"contact_{idx}_email_{i}_type")
99+
if email and etype:
100+
emails.append({"email": email, "email_type": etype})
101+
phone = getattr(model, f"contact_{idx}_phone_{i}")
102+
ptype = getattr(model, f"contact_{idx}_phone_{i}_type")
103+
if phone and ptype:
104+
phones.append({"phone_number": phone, "phone_type": ptype})
105+
106+
address_line_1 = getattr(model, f"contact_{idx}_address_{i}_line_1")
107+
address_line_2 = getattr(model, f"contact_{idx}_address_{i}_line_2")
108+
city = getattr(model, f"contact_{idx}_address_{i}_city")
109+
state = getattr(model, f"contact_{idx}_address_{i}_state")
110+
postal_code = getattr(model, f"contact_{idx}_address_{i}_postal_code")
111+
address_type = getattr(model, f"contact_{idx}_address_{i}_type")
112+
if address_line_1 and city and state and postal_code and address_type:
113+
addresses.append(
114+
{
115+
"address_line_1": address_line_1,
116+
"address_line_2": address_line_2,
117+
"city": city,
118+
"state": state,
119+
"postal_code": postal_code,
120+
"address_type": address_type,
121+
}
122+
)
124123

125124
return {
126125
"thing_id": well.id,
@@ -439,7 +438,6 @@ def _add_csv_row(session: Session, group: Group, model: WellInventoryRow, user)
439438
well = add_thing(
440439
session=session, data=well_data, user=user, thing_type="water well"
441440
)
442-
modify_well_descriptor_tables(session, well, data, user)
443441
session.refresh(well)
444442

445443
# add field event

core/enums.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
)
2525
CasingMaterial: type[Enum] = build_enum_from_lexicon_category("casing_material")
2626
CollectionMethod: type[Enum] = build_enum_from_lexicon_category("collection_method")
27-
ConstructionMethod: type[Enum] = build_enum_from_lexicon_category("construction_method")
27+
WellConstructionMethod: type[Enum] = build_enum_from_lexicon_category(
28+
"well_construction_method"
29+
)
2830
ContactType: type[Enum] = build_enum_from_lexicon_category("contact_type")
2931
CoordinateMethod: type[Enum] = build_enum_from_lexicon_category("coordinate_method")
3032
WellPurpose: type[Enum] = build_enum_from_lexicon_category("well_purpose")
@@ -68,8 +70,14 @@
6870
Vertical_datum: type[Enum] = build_enum_from_lexicon_category("vertical_datum")
6971
ScreenType: type[Enum] = build_enum_from_lexicon_category("screen_type")
7072
SensorType: type[Enum] = build_enum_from_lexicon_category("sensor_type")
73+
WellPumpType: type[Enum] = build_enum_from_lexicon_category("well_pump_type")
74+
PermissionType: type[Enum] = build_enum_from_lexicon_category("permission_type")
7175
GroupType: type[Enum] = build_enum_from_lexicon_category("group_type")
7276
MonitoringFrequency: type[Enum] = build_enum_from_lexicon_category(
7377
"monitoring_frequency"
7478
)
79+
AquiferType: type[Enum] = build_enum_from_lexicon_category("aquifer_type")
80+
GeographicScale: type[Enum] = build_enum_from_lexicon_category("geographic_scale")
81+
Lithology: type[Enum] = build_enum_from_lexicon_category("lithology")
82+
FormationCode: type[Enum] = build_enum_from_lexicon_category("formation_code")
7583
# ============= EOF =============================================

core/formations.json

Whitespace-only changes.

0 commit comments

Comments
 (0)