Skip to content

Add Ocotillo OGC API source (summary-only) alongside AMP#112

Open
jirhiker wants to merge 2 commits into
mainfrom
feature/ocotillo-ogcapi-source
Open

Add Ocotillo OGC API source (summary-only) alongside AMP#112
jirhiker wants to merge 2 commits into
mainfrom
feature/ocotillo-ogcapi-source

Conversation

@jirhiker

@jirhiker jirhiker commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

Adds a new ocotillo connector backed by the pygeoapi/PostGIS OGC API - Features service at ocotillo-api.newmexicowaterdata.org/ogcapi, intended as the eventual replacement for the NMBGMR AMP API datastream (nmbgmr_amp).

Runs alongside AMP (not a replacement yet) so outputs can be compared before cutover. Toggle with --no-ocotillo / --no-nmbgmr-amp.

Scope: water levels, chemistry analytes, TDS.

  • Sites ← water_wells
  • Water-level summaries ← water_well_summary
  • Chemistry ← major_chemistry_results / minor_chemistry_wells
  • TDS ← latest_tds_wells

New files

  • backend/connectors/ocotillo/mappings.py — collection ids + DIG-param → (collection, column) map
  • backend/connectors/ocotillo/transformer.py — site + summary transformers (build SummaryRecord directly from pre-aggregated features)
  • backend/connectors/ocotillo/source.py — site source + water-level/analyte summary sources
  • tests/test_sources/test_ocotillo.py — 4 live tests (health, WL summary, analyte summary, timeseries no-op), all passing

Wiring

config.py (SOURCE_DICT, ANALYTE_SOURCE_PAIRS, WATERLEVEL_SOURCE_PAIRS, PARAMETER_SOURCE_MAP, use_source_ocotillo), cli.py (--no-ocotillo on weave + sites), orchestration/resources/die_config.py.

⚠️ NOT yet at feature parity with AMP

The Ocotillo API currently publishes only pre-aggregated latest/summary collections and exposes no raw observations, so this connector is summary-only:

  • Timeseries output (timeseries_unified / timeseries_separated) is a logged no-op.
  • Blank-by-design summary columns: mean, earliest_* (all params); plus min/max/nrecords for chemistry + TDS.
  • Site elevation blank; datum defaults to WGS84.

Backend changes required for AMP parity

Not included in this PR — a working doc lives at OCOTILLO_AMP_PARITY.md (untracked, not committed). Summary:

  1. Raw observation collections (depth_to_water_observations, chemistry_observations), filterable by well + datetime — biggest gap; unblocks timeseries + mean/earliest.
  2. Chemistry history (not latest-only static columns).
  3. Site metadata on water_wells — elevation, horizontal/vertical datum, USGS id.
  4. Nitrate reporting basis — confirm as-N vs as-NO3 (silent ~4.4x error risk).
  5. TDS history — not latest-only.

Verification

die weave waterlevels --output-type summary --bbox ...summary.csv with NMBGMR-Ocotillo rows; water levels get real count/min/max/latest (e.g. NM-28369: 11 records, 133.17–134.51 ft). Chemistry + TDS confirmed live (calcium, arsenic, ph, specific_conductance, tds). 4/4 tests pass.

🤖 Generated with Claude Code

jirhiker and others added 2 commits July 7, 2026 16:50
Adds a new `ocotillo` connector backed by the pygeoapi/PostGIS OGC API -
Features service at ocotillo-api.newmexicowaterdata.org/ogcapi, intended as
the eventual replacement for the NMBGMR AMP API datastream.

The connector runs alongside the existing nmbgmr_amp source (not a
replacement yet) so outputs can be compared before any cutover. Enable/
disable with --no-ocotillo.

Scope: water levels, chemistry analytes, and TDS. Sites are seeded from the
water_wells collection; water-level summaries from water_well_summary;
chemistry from major/minor_chemistry_results; TDS from latest_tds_wells.

Wiring: SOURCE_DICT, ANALYTE_SOURCE_PAIRS, WATERLEVEL_SOURCE_PAIRS,
PARAMETER_SOURCE_MAP, use_source_ocotillo flag, CLI --no-ocotillo, and the
Dagster orchestration source list.

IMPORTANT - NOT yet at feature parity with AMP. The Ocotillo API currently
publishes only pre-aggregated "latest"/"summary" collections and exposes no
raw observations, so this connector is SUMMARY-ONLY and several summary
columns are necessarily blank. Backend (Ocotillo pygeoapi/PostGIS) changes
required to reach AMP parity:

1. Raw observation collections. Add per-observation, filterable-by-datetime
   collections for depth-to-water and for chemistry results (all samples over
   time, not just latest). Without these, DIG timeseries output
   (timeseries_unified / timeseries_separated) yields nothing for Ocotillo and
   summary mean/earliest cannot be computed. This is the single biggest gap.

2. Chemistry history. major_chemistry_results / minor_chemistry_wells expose
   only the latest value per analyte as static columns. Feature parity needs
   full analyte time series so DIG can compute count/min/max/mean/earliest,
   matching AMP's waterchemistry endpoint.

3. Site metadata on water_wells. water_wells lacks elevation, horizontal
   datum, vertical datum, aquifer/formation, and USGS site id. AMP's locations
   endpoint provides these. Currently elevation is null and datum defaults to
   WGS84. Either enrich water_wells or expose a locations-equivalent with full
   metadata.

4. Nitrate reporting basis. Confirm whether the `nitrate` column is reported
   as N or as NO3 and expose units accordingly. AMP reports "Nitrate (as N)"
   and DIG applies a 4.427 conversion; Ocotillo values are currently taken
   as-is. Parity requires a documented, unit-tagged basis.

5. TDS count/summary. latest_tds_wells is latest-only; avg_tds_wells is an
   average. Parity needs full TDS history (or explicit count/min/max/earliest
   fields) rather than a single latest snapshot.

Until (1)-(3) land, requesting timeseries output for Ocotillo is a logged
no-op and summary output omits mean/earliest (and, for chemistry/TDS,
min/max/nrecords) by design.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…pi-source

# Conflicts:
#	orchestration/resources/die_config.py
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

Your pull request is automatically being deployed to Dagster Cloud.

Location Status Link Updated
die-orchestration View in Cloud Jul 08, 2026 at 09:31 PM (UTC)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant