Skip to content

Stop storing 'Unknown' as a venue city: derive it from the address - #3732

Open
jakebromberg wants to merge 2 commits into
mainfrom
fix/venue-city-unknown-placeholder
Open

jakebromberg wants to merge 2 commits into
mainfrom
fix/venue-city-unknown-placeholder

Conversation

@jakebromberg

Copy link
Copy Markdown
Member

Closes #3731

Why

Clients print venue.city verbatim, and the backend stored the literal string 'Unknown' as a city. The iOS Box Office ticket showed Unknown under "Cat's Cradle Presents at 107 Brewer Lane" (venue 2964).

What changed

  • jobs/venue-events-scraper: ensureVenue's unseeded path derives the city from the JSON-LD address with the new cityFromAddress ("107 Brewer Lane, Carrboro, North Carolina" → Carrboro), and stores '' when the address names none. On conflict it now writes only city, and only while the row still holds a placeholder ('Unknown' or '') and the address yields one. Every other column keeps the existing never-overwrite rule, and a hand-corrected city survives. Venue 2964 is lifted to Carrboro on the next nightly run, with no manual SQL.
  • jobs/triangle-shows-etl: the on-demand venue's missing-city fallback is '', not 'Unknown'.
  • The scraper README and the rhp-venues.ts comment describe the new placeholder row.

venues.city is varchar(64) NOT NULL, and '' satisfies it, so no migration is needed. created on the unseeded path now comes from xmax = 0, like the seeded path, because the conflict branch can update.

Not included

Rows the triangle-shows ETL already stored as 'Unknown' stay as they are until their source sends a city. Clearing them is a one-time production UPDATE, which needs separate approval (see #3731).

Testing

  • New tests: cityFromAddress over live address shapes and rejections; unseeded ensureVenue pins the inserted city, the conflict set, and the placeholder-only setWhere; the ETL pins '' for a null, empty, or blank city.
  • Ran locally: the full unit suite (759 suites, 16,513 tests), eslint and prettier on the touched paths, tsc for both jobs, and typecheck:tests (baseline matches).

…S#3731)

Clients print venue.city verbatim, so the placeholder reached listeners as a city (iOS showed "Unknown" under "Cat's Cradle Presents at 107 Brewer Lane").

The RHP scraper's unseeded ensureVenue path now takes the city from the JSON-LD address ("107 Brewer Lane, Carrboro, North Carolina" -> Carrboro), or '' when the address names none. On conflict it writes only city, and only while the row still holds a placeholder ('Unknown' or ''), so existing placeholder rows heal on the next run and a hand-corrected city is never overwritten. The triangle-shows ETL's missing-city fallback is '' instead of 'Unknown'.
…e city, and always clear a legacy 'Unknown' (BS#3731)

cityFromAddress picked the part before the last comma, so a trailing country stored the state ('NC') and a two-part address stored the street. Because the writer never corrects a city it has filled in, a wrong guess stuck, and a long one overflowed varchar(64) and dropped the venue's concerts. It now returns the canonical spelling of the right-most part that names a known city (the Etix city list, now KNOWN_CITIES), or null.

The unseeded conflict predicate is now venues.city IN ('Unknown', '') AND venues.city <> city, so a legacy 'Unknown' becomes '' even when the address names no city. Also fixes the stale created docstring and the DO NOTHING test name.
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.

Venue rows store the literal city 'Unknown', which clients print

1 participant