Repository navigation
feat/improve-adopters-metrics - #129
Merged
Merged
Conversation
…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>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Invalid calendar dates can pass history validation and crash chart rendering, causing the site build to fail.
5 open issues
Reject invalid calendar dates in adoption history · New Show adoption history even when current adoption data is absent · New Update adoption history when a count is cleared · New Preserve zero when promoting the newest consumer count · New Avoid adding duplicate adoption observations for unchanged counts · New
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
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Allow editing adopters types and metrics