Skip to content

Add source_datastream_link to waterlevel summary + trend (st2)#89

Merged
jirhiker merged 2 commits into
mainfrom
feature/st2-source-datastream-link
Jun 28, 2026
Merged

Add source_datastream_link to waterlevel summary + trend (st2)#89
jirhiker merged 2 commits into
mainfrom
feature/st2-source-datastream-link

Conversation

@jirhiker

Copy link
Copy Markdown
Member

What

Link each waterlevel summary and waterlevel trend feature back to the raw, non-normalized source series it was derived from. Scoped to st2 (SensorThings) sources, which expose a Datastream URL. Not added to timeseries features.

Naming

source_datastream_link — the source_ prefix matches the existing source_parameter_name / source_parameter_units convention, which already mean "as provided by the source, before DIE normalization." Constant + comments call out that it points to the non-normalized provider series.

How

  • backend/constants.py: SOURCE_DATASTREAM_LINK = "source_datastream_link".
  • backend/connectors/st2/source.py: builds the Datastream URL ({url}/Datastreams({id})); sets it on each observation record (so the trend path can read it) and, via a new _summary_extra hook, on the summary record.
  • backend/source.py: RecordSummarizer.summarize merges s._summary_extra(cleaned) into the summary rec (base returns {}; only st2 overrides).
  • backend/record.py: SummaryRecord gains the key → summary features emit it.
  • backend/persisters/ogc_features.py: the trend dumper reads source_datastream_link from the well's observation dicts and adds it to the per-well feature (omitted when absent).

Scope notes

  • Summary (nm_waterlevels_summary) and trend (nm_waterlevel_trends) only. Timeseries features unchanged.
  • Non-st2 sources: summary features carry source_datastream_link: null; trend features omit the key.

Verification

Offline persister tests cover summary + trend (link present for st2, absent/None otherwise) — 17 pass. test_sources not run here (live-network integration tests).

🤖 Generated with Claude Code

Link each summary/trend feature back to the raw, NON-NORMALIZED source
series it was derived from. Scoped to st2 (SensorThings) sources, which
expose a Datastream URL.

- constants: SOURCE_DATASTREAM_LINK = "source_datastream_link" (source_
  prefix, matching source_parameter_name/units = "as provided by source,
  pre-normalization").
- st2 source: build the Datastream URL ({url}/Datastreams({id})); set it
  on each observation record and, via the new _summary_extra hook, on the
  summary record.
- source.RecordSummarizer: merge _summary_extra(cleaned) into the summary
  rec (default {}; only st2 overrides).
- SummaryRecord gains the key, so summary features emit it. The trend
  dumper reads it from the well's observation dicts and adds it to the
  per-well feature.
- NOT added to timeseries features (per scope).

Offline tests cover summary + trend (present for st2, absent otherwise).

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

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown

Your pull request is automatically being deployed to Dagster Cloud.

Location Status Link Updated
die-orchestration View in Cloud Jun 28, 2026 at 04:54 PM (UTC)

test_sources make live calls to provider APIs — slow and flaky for
default/CI runs. Add to norecursedirs (like tests/archived). Run
explicitly with --override-ini="norecursedirs=" when needed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jirhiker jirhiker merged commit c3e6a88 into main Jun 28, 2026
1 check passed
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