Source code for energy_data_retrieval.wind_catalogue.research_queue

"""Resolve explicit continuation identities against an already reviewed ledger."""

from __future__ import annotations

from typing import Any


[docs] def resolve_saved_identity( decisions: list[dict[str, Any]], registry_id: int, expected_name: str ) -> dict[str, Any]: """Reject stale cursor labels; neither names nor list positions identify plants. This only selects a saved observation. It does not reconcile a project, approve a capacity total, or resolve a historical-generation boundary. """ matches = [row for row in decisions if row.get("registry_id") == registry_id] if len(matches) != 1: raise ValueError("Registry ID must occur exactly once in the saved ledger") row = matches[0] observation = row["source_observation"] if ( row["name"] != expected_name or observation["Navn"] != expected_name or observation["VindkraftAnleggId"] != registry_id ): raise ValueError("Continuation ID/name does not match the saved source observation") return row