Skip to content

feat/improve-adopters-metrics - #129

Merged
etienne0101 merged 6 commits into
mainfrom
feat/maintainer-review-status/2026-11-20
Nov 27, 2026
Merged

etienne0101 merged 6 commits into
mainfrom
feat/maintainer-review-status/2026-11-20

Conversation

@etienne0101

Copy link
Copy Markdown
Contributor

Allow editing adopters types and metrics

etienne0101 and others added 4 commits November 20, 2026 12:24
…consumers

Known adopters are now data producers plus data consumers, and the
adopters history behind the Adoption chart can be corrected from the
in-page editor.

Data model:
- adoption.adopters_count becomes data_producers_count, and
  adopters_registry_url becomes data_producers_registry_url. The eight
  specification files with a count are migrated with the same values.
- New data_consumers_count and data_consumers_registry_url.
- New adoption.history: rows of date, data_producers, data_consumers that
  add dates git does not know about or replace git's value for a date.
  make specs-check validates dates, duplicates and whole numbers.

History:
- spec_history reads old revisions' adopters_count as data producers, so
  the existing history is kept, then lays the current counts and the
  file's history rows over it.

Editor:
- The History block opens a table prefilled from git. Values can be
  overwritten (with a restore button), rows added by hand, or imported
  from a CSV file (comma, semicolon or tab; a single count column is read
  as data producers; an existing date is overwritten). The table can be
  downloaded as CSV.
- On Apply the newest row becomes the current count, and only rows that
  differ from git are written to the file.
- The chart and the Known adopters total redraw while editing; Discard
  restores the total.

API: adopters_count is now the total and adopters_registry_url stays for
compatibility; producer and consumer fields are added to the JSON, CSV
export and OpenAPI description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The TransXChange update merged from main still used adoption.adopters_count
and adoption.adopters_registry_url, which the registry renamed to
data_producers_count and data_producers_registry_url. The values are kept
(943 data producers, same registry link), so the specs check passes again.

The check now names the new key when it meets one of the old ones, instead
of reporting an unknown key, so a change written in the old format is easy
to fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ow screens

The history table inherited `overflow-wrap: anywhere` from the History
section's table styles, so in a narrow window the "Known adopters" heading
and the totals broke one character per line. Cells now wrap at spaces only,
totals never wrap, and the inputs and columns are a little narrower; a
table that still does not fit scrolls sideways.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Invalid calendar dates can pass history validation and crash chart rendering, causing the site build to fail.

5 open issues
What changed in this PR

This PR expands the specification registry’s adoption metrics to distinguish data producers from data consumers and supports editing historical counts.

Changes:

  • Adds separate producer and consumer counts and registry URLs to validation, pages, and API exports.
  • Adds editable adoption history with CSV import/export and manual corrections to repository-derived counts.
  • Migrates existing specification records and documents the new fields.
File Description
scripts/​spec_history.py Combines producer/consumer counts and manual history overrides.
scripts/​spec_data.py Validates and normalizes the new adoption fields.
scripts/​spec_api.py Exposes separate metrics in JSON, CSV, and schemas.
overrides/​assets/​stylesheets/​spec-editor.css Styles the history editor and CSV controls.
overrides/​assets/​javascript/​specifications.js Formats history changes for display.
overrides/​assets/​javascript/​spec-editor.js Adds metric editing, history charts, and CSV import/export.
hooks/​specifications.py Renders separate metrics and supplies history to the editor.
data/​specifications/​transxchange.md Migrates existing metrics to producer fields.
data/​specifications/​tods.md Migrates existing metrics to producer fields.
data/​specifications/​mds.md Migrates existing metrics to producer fields.
data/​specifications/​gtfs-schedule.md Migrates existing metrics to producer fields.
data/​specifications/​gtfs-realtime.md Migrates existing metrics to producer fields.
data/​specifications/​gtfs-flex.md Migrates existing metrics to producer fields.
data/​specifications/​gofs.md Migrates existing metrics to producer fields.
data/​specifications/​gbfs.md Migrates existing metrics to producer fields.
data/​specifications/​cds.md Migrates existing metrics to producer fields.
data/​README.md Documents split metrics, history editing, and ranking.

Review effort: Balanced

Comment thread scripts/spec_data.py Resolved
Comment thread hooks/specifications.py Resolved
Comment thread scripts/spec_history.py Resolved
Fixes the five points raised in the review of PR 129.

- Reject dates that match YYYY-MM-DD but are not real calendar dates
  (2024-02-30) in adoption.history and adoption.adopters_count_updated.
  They passed the check and then made the chart raise in
  date.fromisoformat, failing the site build. Such a row is now reported
  and skipped, and an invalid count date is left out.
- Show the Adoption section, and its entry in the page menu, when the only
  adoption data is a history of two or more points. It was hidden unless
  there was a current count, a tier or a registry link.
- In the editor, clearing one count while the other is still known now
  dates the new total today and drops a hand-entered row for today, as
  changing a count already did.
- When the newest history row becomes the current count, a consumer count
  of 0 is kept as 0 instead of being removed, which made it read as unknown.
- Counts that are unchanged since they were last committed are no longer
  added again as a point dated today, which happened on every build when
  the file had no adopters_count_updated. The build passes the last
  committed counts to the editor so the table and Apply use the same rule,
  and Apply with the same counts as now no longer touches the count date.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@fredericsimard fredericsimard left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@etienne0101
etienne0101 merged commit 4fdf58d into main Nov 27, 2026
1 check passed
@etienne0101
etienne0101 deleted the feat/maintainer-review-status/2026-11-20 branch November 27, 2026 15:21
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.

3 participants