feat: script for detecting unstable producer urls - #1627
Conversation
…on realtime schema for future
emmambd
left a comment
There was a problem hiding this comment.
Someone else on the team is probably better positioned to review this one than me. Are there specific requirements you wanted to discuss?
I saw comments on the other pr #1629 so I'll refine the detection rules so we don't catch false positives. I'll bring it up to the team after I can finalize them with you |
|
@ianktc Sounds good - looking at the "Detection rules" here, there may be some that I mistook as a false positive |
UpdateDetection rules are now constrained to scan just for date-related tokens. The following rules were removed: dotted_version, dotnet_ticks, shared_access_signature_window, cache_buster, pinned_git_sha, large_version_counter The sentinels that were previously required to safeguard against false positives are no longer required, because the above rules were removed. (api key, hash, version numbers are no longer mistaken as date/time tokens). Updated csv of marked feedsDetection rules — any match sets
|
| Rule | Catches |
|---|---|
iso_date |
YYYYMMDD / - / _ / . separated, plus optional HHMM/HHMMSS |
delimited_year |
standalone year 2010–2029, delimiter-anchored both sides |
wordpress_upload_folder |
wp-content/uploads/[sites/N/]YYYY/MM/ |
dated_version_tag |
2020.0401.1 style release tags |
locale_date |
day-first 03.10.2025, 06-07-2021, 5.12.21 |
month_abbreviation_with_digits |
3-letter month only fused to digits: coquimbo10feb16 |
version_query_parameter |
&version=20250220 |
epoch_timestamp |
10-digit Unix seconds |
month_name |
full month names, 6 languages |
labelled_year |
2025Winter, Spring2025, Q1-CY2025, CY2026 |
year_month |
bare YYYYMM — gtff-202311 |
|
@ianktc These make sense to me, upon reviewing the CSV |
Summary
is_producer_url_unstableis used to identify feeds whose urls may change over time due to a date or a version baked into it. The feed url therefore stops being accessible the moment the agency publishes again with a different version or date. Only active and inactive feeds are scanned, and deprecated feeds can be scanned if a flag is added.This PR adds
scripts/identify_unstable_urls.py, which scans producer URLs for thatevidence and applies the field to what it finds. It also adds the
is_producer_url_unstablefield to the realtime feed schema in case of future adoption.The actual feed update: #1627
csv file detailing the motivation for each decision:
unstable_producer_urls.csv
Usage
The script never writes on a plain run. The intended workflow is scan, read the CSV, then
apply:
Other options:
--data-type {gtfs,gtfs-rt,all}to narrow the catalog,--include-deprecatedto also scan deprecated feeds (raises the count from 86 to 126), and
--weakto print thesignals that are deliberately never flagged, for manual review.
Redaction rules — Tokens to ignore (allow-list)
Blanked to a sentinel before any matching runs, so they cannot contribute a hit.
uuidhex_idazure_service_versionsv=YYYY-MM-DDazure_signaturesig=…credentialapi_key/token/key/subscription-key=…apiKeyis indistinguishable from a pinned commit; 8 feeds were mis-flagged before thisapi_version_segment/vN/as a whole segmentapi_version_segment_dotted/vN.0/as a whole segmentdata.waltti.fiserves 11 feeds from/v1.0/transitfeeds_id/p/<agency>/<id>/latestdrive_file_id?id=<25+ chars>Detection rules — Token to trigger hit
Set
is_producer_url_unstableto"True"iso_dateYYYYMMDD/-/_/.separated, plus optionalHHMM/HHMMSSdelimited_yearwordpress_upload_folderwp-content/uploads/[sites/N/]YYYY/MM/dated_version_tag2020.0401.1style release tagsdotted_versionv2.8,?v=0.16.0,v1.0.0locale_date03.10.2025,06-07-2021,5.12.21month_abbreviation_with_digitscoquimbo10feb16version_query_parameter&version=20250220epoch_timestampmonth_namedotnet_ticksDateTime.Tickslabelled_year2025Winter,Spring2025,Q1-CY2025,CY2026shared_access_signature_windowst=/se=expirycache_busterrefresh=/nocache=/timestamp=+ 8+ hexpinned_git_shalarge_version_countervNN+—GTFS-V126year_monthYYYYMM—gtff-202311