skip the selection-edge query where nothing reads it
The temporal timeline summarises every snapshot in a series. Each summary now also counts how many features the selection edge cuts, but a timeline point renders values only, so that was one database round trip per snapshot for a disclosure nobody sees. Make it opt-out and have the timeline opt out. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -171,11 +171,15 @@ class TemporalAnalysisService:
|
||||
|
||||
summaries: dict[UUID, dict[str, Any]] = {}
|
||||
|
||||
def summarize(dataset: Dataset) -> dict[str, Any]:
|
||||
def summarize(dataset: Dataset, *, disclose_selection_edge: bool = True) -> dict[str, Any]:
|
||||
cached = summaries.get(dataset.id)
|
||||
if cached is not None:
|
||||
return cached
|
||||
kwargs: dict[str, Any] = {"dataset": dataset, "bbox": bbox}
|
||||
kwargs: dict[str, Any] = {
|
||||
"dataset": dataset,
|
||||
"bbox": bbox,
|
||||
"disclose_selection_edge": disclose_selection_edge,
|
||||
}
|
||||
if selection_area is not None:
|
||||
dataset_is_preclipped = is_preclipped_to_selection_area(dataset)
|
||||
kwargs["selection_geometry"] = None if dataset_is_preclipped else selection_geometry
|
||||
@@ -234,7 +238,9 @@ class TemporalAnalysisService:
|
||||
project_id=project_id,
|
||||
series_key=earlier.temporal_series_key,
|
||||
fallback_datasets=[earlier, later],
|
||||
summarize=summarize,
|
||||
# A timeline point shows values only, so the per-snapshot
|
||||
# selection-edge query would be a round trip nobody reads.
|
||||
summarize=lambda dataset: summarize(dataset, disclose_selection_edge=False),
|
||||
)
|
||||
|
||||
return TemporalComparisonResponse(
|
||||
|
||||
Reference in New Issue
Block a user