Skip to content

feat(ingestion): wire the loader end to end - #856

Merged
jirhiker merged 2 commits into
stagingfrom
feat/wire-san-acacia-loader
Aug 19, 2026
Merged

feat(ingestion): wire the loader end to end#856
jirhiker merged 2 commits into
stagingfrom
feat/wire-san-acacia-loader

Conversation

@jirhiker

Copy link
Copy Markdown
Member

san_acacia_observations joins the pieces that until now existed separately:
reconcile the vendor point to a well → choose the deployment its transducer
hangs from → ask the database where that series got to → fetch forward → map →
upsert → extend the QC block.

The seeding half of 3.2 turned out to be nothing

The plan expected to create wells, a parameter, a sensor and deployments.
Checked against staging — all of it already exists:

  • All 38 wells have deployments (108 open ones between them)
  • The parameter exists: id 1, groundwater level, default_unit = ft — which
    is exactly what the adapter emits, so the centimetre conversion lands in the
    right unit
  • Existing observations for these wells already use it

So the series is chosen, not created.

Choosing it needs a rule

A well carries several open deployments because a deployment is a piece of
equipment, not a measured property. SO-0140 has three:

sensor type
234 DiverLink telemetry
235 Pressure Transducer the reading
236 Diver Cable the cable

Barometer appears on other wells. Only the transducer produces a water level —
picking any other would attribute a reading to a cable.

It does not resolve everywhere, and that is reported

wells
exactly one open transducer 35
two open transducers 2
none (SO-0246) 1

The three are skipped and counted in asset metadata, not guessed at. Taking the
lower id would be a silent decision about equipment records.

A removed transducer is not used as a fallback: writing current readings
against retired kit would look like success while being wrong.

An unresolvable well costs that well's readings for the run, not the other
thirty-seven's — same failure isolation as the rest of the pipeline.

Before running it

Two things from earlier findings still apply, and neither is code:

  1. The datum comparison. 14 of these wells hold AMPAPI data through Aug
    2022 under an unverified datum. A normal run starts from each series'
    watermark so it will not overlap them — but confirm before any backfill
    covering 2016–2022.
  2. ngwmn_helper.py filters release_status == "public", and this loads
    with release_status="public". Whether San Acacia should reach NGWMN is
    unchecked.

102 tests pass.

🤖 Generated with Claude Code

san_acacia_observations joins the pieces that existed separately: reconcile the
vendor point to a well, choose the deployment its transducer hangs from, ask the
database where that series got to, fetch forward, map, upsert, and extend the QC
block.

The seeding half of 3.2 turned out to be nothing. All 38 wells already have
deployments, the parameter exists as `groundwater level` in feet -- the unit the
adapter emits -- and existing observations already use it. So the series is
chosen rather than created.

Choosing it needs a rule, because a well carries several open deployments: a
deployment is equipment, not a measured property. SO-0140 has a DiverLink, a
Pressure Transducer and a Diver Cable, and only the transducer produces a water
level. Picking any other would attribute a reading to a cable.

That resolves cleanly for 35 of the 38 wells. Two have two open transducers and
one has none; those are skipped and reported. Taking the lower id would be a
silent guess about equipment, and a removed transducer is not used as a fallback
-- writing current data against retired kit looks like success while being
wrong.

A well that cannot be resolved costs that well's readings for the run, not the
other thirty-seven's.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Coverage

78.98% total — gate is 75%.

Coverage for the Python files changed in this PR
Name Stmts Miss Cover Missing
automated_ingestion/defs/assets/__init__.py 6 0 100%
automated_ingestion/sources/san_acacia/ingest.py 99 83 16% 35-37, 46-59, 76-106, 136-239, 252-264, 269-278, 282-294, 302-309
automated_ingestion/sources/san_acacia/resolve.py 35 0 100%
TOTAL 140 83 41%

@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Coverage

78.08% total — gate is 75%.

Coverage for the Python files changed in this PR
Name Stmts Miss Cover Missing
automated_ingestion/defs/assets/__init__.py 6 0 100%
automated_ingestion/scripts/compare_datum.py 85 85 0% 41-214
automated_ingestion/scripts/diverhub_retention.py 44 44 0% 38-118
automated_ingestion/sources/san_acacia/dlt_pipeline.py 43 0 100%
automated_ingestion/sources/san_acacia/ingest.py 99 83 16% 35-37, 46-59, 76-106, 136-239, 252-264, 269-278, 282-294, 302-309
automated_ingestion/sources/san_acacia/resolve.py 35 0 100%
TOTAL 312 212 32%

Diver-HUB serves nothing before late 2024. Probing six points put their earliest
reading at 2024-10-08 and 2024-11-10, matching the deployments on these wells
being installed 2024-11-25 -- the vendor project was populated then.

INITIAL_START was 2015-01-01, chosen before anyone knew what the vendor retains.
At a 365-day span that made a first run walk twelve windows per well, ten of
them guaranteed empty, against an endpoint that answers 500 when pushed. The
floor is now 2024-01-01: three windows per well, 228 requests across the
thirty-eight rather than 912.

It sits nine months below the earliest observed reading rather than at it,
because only six of thirty-eight points were probed and a well with slightly
earlier data should not be silently truncated.

This also records why the datum comparison could not be completed. Ocotillo's
AMPAPI data for these wells ends August 2022 and the vendor starts late 2024, so
there are no matching timestamps to compare -- attempted on SO-0125 and SO-0245,
zero vendor rows at every reference. The two sources never overlap, which means
no datum mixing can occur on a normal run, and roughly twenty-seven months are
missing from the record and cannot be recovered from this source.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Your pull request is automatically being deployed to Dagster Cloud.

Location Status Link Updated
ocotillo-automated-ingestion View in Cloud Aug 19, 2026 at 06:11 PM (UTC)

@jirhiker
jirhiker merged commit 3e38614 into staging Aug 19, 2026
10 checks passed
@jirhiker
jirhiker deleted the feat/wire-san-acacia-loader branch August 19, 2026 18:09
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