Repository navigation
feat: sector segments in the timeseries download and benchmark plots - #976
Conversation
The timeseries CSV's sector_scope column repeated one taxonomy string
per metric ("Power generation" for every Power metric). It is replaced
by two columns read from each row's v2 sectorSegment (#915):
- sector_segment: the segments the value covers, joined with "; "
- definition_sector_segment: what each means, in the same order, next
to the existing technology and metric definitions
The per-metric sectorScope is removed from timeseriesTaxonomy.ts and
from common/metric.v1.json, which had it as required free text; the
rows are now the only source.
The CSV helpers move to scripts/timeseries-csv.ts so they can be tested
(the build script runs on import). A list value is now joined before
quoting, so it can never spill commas into later columns. Each
dataset's index summary also lists its sectorSegments.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Benchmark plots captioned each panel with the metric's sector scope. They now show the segments of the rows the panel actually draws (metric and resolved geography), via plottedSegments, ordered as the sector defines its segments: - a series spanning several segments shows a badge for each - comparison columns read their own rows, so two pathways whose series of the same metric cover different segments now say so; before, one per-metric value was repeated across every column Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Expected version change and release notes🚨 WARNING: This PR is not expected to trigger a new versionTo trigger a version bump, use at least one conventional commit message in this branch. See: https://www.conventionalcommits.org/en/v1.0.0/ |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Segment badges can appear for one-year series that the plot considers unrenderable.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds row-level sector segments to timeseries downloads, summaries, and benchmark plot badges.
Changes:
- Replaces metric-level sector scope with row-level segment CSV columns.
- Displays segment badges based on each plotted series.
- Adds segment summaries and tests.
| File | Description |
|---|---|
src/utils/timeseriesTaxonomy.ts |
Removes metric-level sector scope. |
src/utils/timeseriesSegments.ts |
Derives segments for plot panels. |
src/utils/timeseriesSegments.test.ts |
Tests segment derivation. |
src/types/common/metric.v1.d.ts |
Updates generated metric type. |
src/schema/common/metric.v1.json |
Removes sector scope from metric schema. |
src/data/index.gen.ts |
Adds dataset segment summaries. |
src/components/PlotSelector.tsx |
Adds segments to plot data typing. |
src/components/PlotSelector.test.tsx |
Updates plot fixtures. |
src/components/PlotGrid.tsx |
Renders row-derived segment badges. |
src/components/PlotGrid.test.tsx |
Tests multi-segment panels. |
src/components/ComparisonPlots.tsx |
Derives segments per comparison column. |
src/components/ComparisonPlots.test.tsx |
Tests per-column segments. |
scripts/timeseries-csv.ts |
Provides CSV and segment-column helpers. |
scripts/timeseries-csv.test.ts |
Tests CSV serialization. |
scripts/build-timeseries-files.ts |
Generates segment-aware CSVs and summaries. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PlotPanel only draws a series with more than one distinct year; a single-year series shows its empty state. plottedSegments counted any matching row, so a badge could caption an empty chart (#976 review). Both components now apply PlotPanel's own hasDataForMetricAndGeo before reading segments, so the badge and the chart follow one rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Expected version change and release notes🚨 WARNING: This PR is not expected to trigger a new versionTo trigger a version bump, use at least one conventional commit message in this branch. See: https://www.conventionalcommits.org/en/v1.0.0/ |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://proud-glacier-0f640931e-976.westus2.2.azurestaticapps.net |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Expected version change and release notes🚨 WARNING: This PR is not expected to trigger a new versionTo trigger a version bump, use at least one conventional commit message in this branch. See: https://www.conventionalcommits.org/en/v1.0.0/ |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://proud-glacier-0f640931e-976.westus2.2.azurestaticapps.net |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Expected version change and release notes🚨 WARNING: This PR is not expected to trigger a new versionTo trigger a version bump, use at least one conventional commit message in this branch. See: https://www.conventionalcommits.org/en/v1.0.0/ |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://proud-glacier-0f640931e-976.westus2.2.azurestaticapps.net |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Expected version change and release notes🚨 WARNING: This PR is not expected to trigger a new versionTo trigger a version bump, use at least one conventional commit message in this branch. See: https://www.conventionalcommits.org/en/v1.0.0/ |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://proud-glacier-0f640931e-976.westus2.2.azurestaticapps.net |

Part of #915. Stacked on #975 (#974 → #975 → this).
Download
The CSV's
sector_scopecolumn repeated one taxonomy string per metric. It is replaced by two columns read from each row'ssectorSegment:sector_segment: the segments, joined with"; "definition_sector_segment: what each means, in the same order, next to the existing technology and metric definitionsA list is joined before quoting, so it can't spill into later columns. The CSV helpers moved to
scripts/timeseries-csv.ts, with tests, because the build script runs on import. Each dataset's index summary also lists itssectorSegments.The per-metric
sectorScopeis removed fromtimeseriesTaxonomy.tsand fromcommon/metric.v1.json, where it was required free text.Plots
Each panel's segment badges now come from the rows it actually draws (metric + resolved geography), ordered as the sector defines its segments.
Checked
🤖 Generated with Claude Code