Problem
A stream goes by several names on this site, and each page converts between them itself:
| Where |
S&P 500 |
Stock Splits |
US Weather Alerts |
| urls the site links |
StockMarket |
StockMarketStockSplit |
USNationalWeather |
| requests to the performance api |
stockmarket |
stockmarketstocksplit |
usnationalweather |
| the alarm page's own state |
stock-market |
stockmarketstocksplit |
us-national-weather |
| file names |
featured/stock-market.jsx |
trigger/content/stock-split.jsx |
trigger/content/us-national-weather.jsx |
datalake Data, via DATASETS |
stock-market |
stock-split |
us-weather-alert |
Two of those conversions are wrong today:
- The Stock Splits trigger page is empty.
- The /stream page links it as
/stream/StockMarketStockSplit/trigger, but trigger.jsx renders the split content only for stocksplit. No other branch matches, so the page shows no content.
- Its test passes because it routes to
/stream/StockSplit/trigger, a url the site never links.
- Two alarm pages name their stream by its id.
alarm.jsx renames StockMarket to stock-market and USNationalWeather to us-national-weather. It then labels the page with streamName(), which knows only the unhyphenated ids.
- As a result, the S&P 500 page reads "Download raw stock-market ingest performance metrics", and the weather page says "us-national-weather" where it should say "US Weather Alerts".
Proposal
The performance api will accept stock-market, stock-split, bls, sec and us-national-weather, and will keep accepting today's ids while the site moves. Make those five the site's only stream ids:
- One module owns the ids. Add
jsx/import/general/stream-id.js, holding the five ids and a canonicalStream(). That function maps every form in use today to one of the five, or to null. The forms include StockMarket, stockmarket, StockMarketStockSplit, StockSplit, USNationalWeather and BLS.
- Urls use the ids. For example
/stream/stock-market/alarm, /stream/stock-split/trigger, /stream?item=us-national-weather&rate=Day and /data?item=stock-market. An old url still loads, and is replaced with its canonical form, so bookmarks and shared links keep working.
- Requests send the ids, such as
Stream=stock-market.
- The archive column matches the listing through
canonicalStream(). It then shows the same files whichever ids the listing uses.
- Everything keyed by a stream uses its id. That covers
STREAM_LABELS, STREAM_COVERAGE, DATASETS, the ingest schedules and gaps, the per-stream state keys and the css classes.
- Pages stop converting ids themselves. Remove the renames in
alarm.jsx, and the 'stocksplit' and 'usnationalweather' comparisons in trigger.jsx.
- Docs:
- In
documentation/api/openapi/performance.json, update the Stream enum, the archive's stream enum, the id pattern (to ^[a-z-]+/...) and every example.
- In
documentation/api/performance.md, update the parameter table, and say that the old ids are still accepted for now.
Acceptance criteria
Order
- The performance api accepts the hyphenated ids.
- This issue.
- The performance api names streams by the hyphenated ids in its answers.
Merge this only after step 1 is live. Until then, a request with a new id is answered with a 400.
Out of scope
- The datalake's dataset names.
us-weather-alert stays, and DATASETS maps the new ids onto it.
- Where the archive files live. Their folders stay put, because the listing gives each file's url.
Problem
A stream goes by several names on this site, and each page converts between them itself:
StockMarketStockMarketStockSplitUSNationalWeatherstockmarketstockmarketstocksplitusnationalweatherstock-marketstockmarketstocksplitus-national-weatherfeatured/stock-market.jsxtrigger/content/stock-split.jsxtrigger/content/us-national-weather.jsxData, viaDATASETSstock-marketstock-splitus-weather-alertTwo of those conversions are wrong today:
/stream/StockMarketStockSplit/trigger, buttrigger.jsxrenders the split content only forstocksplit. No other branch matches, so the page shows no content./stream/StockSplit/trigger, a url the site never links.alarm.jsxrenamesStockMarkettostock-marketandUSNationalWeathertous-national-weather. It then labels the page withstreamName(), which knows only the unhyphenated ids.Proposal
The performance api will accept
stock-market,stock-split,bls,secandus-national-weather, and will keep accepting today's ids while the site moves. Make those five the site's only stream ids:jsx/import/general/stream-id.js, holding the five ids and acanonicalStream(). That function maps every form in use today to one of the five, or to null. The forms includeStockMarket,stockmarket,StockMarketStockSplit,StockSplit,USNationalWeatherandBLS./stream/stock-market/alarm,/stream/stock-split/trigger,/stream?item=us-national-weather&rate=Dayand/data?item=stock-market. An old url still loads, and is replaced with its canonical form, so bookmarks and shared links keep working.Stream=stock-market.canonicalStream(). It then shows the same files whichever ids the listing uses.STREAM_LABELS,STREAM_COVERAGE,DATASETS, the ingest schedules and gaps, the per-stream state keys and the css classes.alarm.jsx, and the'stocksplit'and'usnationalweather'comparisons intrigger.jsx.documentation/api/openapi/performance.json, update theStreamenum, the archive'sstreamenum, theidpattern (to^[a-z-]+/...) and every example.documentation/api/performance.md, update the parameter table, and say that the old ids are still accepted for now.Acceptance criteria
/stream/StockMarket/alarm,/stream/StockMarketStockSplit/trigger,/stream?item=USNationalWeather&rate=Dayand/data?item=StockMarket./stream/stock-split/triggerrenders the split content, and a test routes to the url the /stream page links.Order
Merge this only after step 1 is live. Until then, a request with a new id is answered with a 400.
Out of scope
us-weather-alertstays, andDATASETSmaps the new ids onto it.