Skip to content

Extend darkstorage observation endpoint#13543

Draft
SAKavli wants to merge 1 commit into
equinor:mainfrom
SAKavli:extend-observation-endpoint
Draft

Extend darkstorage observation endpoint#13543
SAKavli wants to merge 1 commit into
equinor:mainfrom
SAKavli:extend-observation-endpoint

Conversation

@SAKavli
Copy link
Copy Markdown
Contributor

@SAKavli SAKavli commented May 12, 2026

We wish to use this endpoint to query ert for wellnames. However, it currently only contains observation name, which does not necessarily contain the summary key.

This change extends the endpoint to explicitly contain the summary key.

Issue
Resolves #13542

Approach
Short description of the approach

(Screenshot of new behavior in GUI if applicable)

  • PR title captures the intent of the changes, and is fitting for release notes.
  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.
  • Make sure unit tests pass locally after every commit (git rebase -i main --exec 'just rapid-tests')

When applicable

  • When there are user facing changes: Updated documentation
  • New behavior or changes to existing untested code: Ensured that unit tests are added (See Ground Rules).
  • Large PR: Prepare changes in small commits for more convenient review
  • Bug fix: Add regression test for the bug
  • Bug fix: Add backport label to latest release (format: 'backport release-branch-name')

We wish to use this endpoint to query ert for wellnames. However,
it currently only contains observation name, which does not
necessarily contain the summary key.

This change extends the endpoint to explicitly contain the summary
key.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the dark storage observations endpoints to include the underlying response_key (summary/response key) in the returned observation objects, enabling clients (e.g. GUI) to derive well names even when the observation name doesn’t encode the key.

Changes:

  • Added response_key to the ObservationOut JSON schema.
  • Populated response_key in both experiment-wide and per-response observation endpoints.
  • Included response_key when constructing observation dicts from stored observation dataframes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/ert/dark_storage/json_schema/observation.py Extends the Observation schema with a response_key field.
src/ert/dark_storage/endpoints/observations.py Populates and returns response_key from stored observation datasets in both observations endpoints.

@dataclass
class _Observation:
name: str
response_key: list[str]
Comment on lines 148 to +151
observations.append(
{
"name": obs_key[0],
"response_key": obs_df["response_key"].to_list(),
Comment on lines 24 to 46
@router.get(
"/experiments/{experiment_id}/observations", response_model=list[js.ObservationOut]
)
def get_observations(
*, storage: Storage = DEFAULT_STORAGE, experiment_id: UUID
) -> list[js.ObservationOut]:
with reraise_as_http_errors(logger, {404: "Experiment not found"}):
experiment = storage.get_experiment(experiment_id)

return [
js.ObservationOut(
id=UUID(int=0),
userdata={},
errors=observation["errors"],
values=observation["values"],
x_axis=observation["x_axis"],
east=observation["east"],
north=observation["north"],
radius=observation["radius"],
name=observation["name"],
response_key=observation["response_key"],
)
for observation in _get_observations(experiment)
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.62%. Comparing base (f32dcb7) to head (bf1852e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13543      +/-   ##
==========================================
- Coverage   89.63%   89.62%   -0.02%     
==========================================
  Files         460      460              
  Lines       32519    32520       +1     
==========================================
- Hits        29150    29147       -3     
- Misses       3369     3373       +4     
Flag Coverage Δ
cli-tests 37.01% <0.00%> (-0.01%) ⬇️
fuzz 43.97% <100.00%> (+<0.01%) ⬆️
gui-tests 63.70% <0.00%> (-0.01%) ⬇️
performance-and-unit-tests 78.03% <100.00%> (-0.02%) ⬇️
test 45.63% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/ert/dark_storage/endpoints/observations.py 93.44% <ø> (ø)
src/ert/dark_storage/json_schema/observation.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

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.

Response key is not present in observations endpoint

3 participants