Normalize whitespace in country/state/city names - #70
Closed
victore13 wants to merge 1 commit into
Closed
Conversation
Cleans up name-like fields in the shipped JSON that carried leading or trailing spaces, stray tabs or collapsible double spaces (e.g. "The Gambia ", "Barisal ", "Trashi Yangtse\t"). These surface as ugly dropdown entries and break text-based lookups/joins in consuming apps. - 874 fields normalized: trim + collapse any whitespace run to a single space, across countries (name/native/capital/nationality), states (name/country_name) and cities (name/state_name/country_name). - Denormalized copies are normalized with the same deterministic rule, so states.country_name / cities.state_name / cities.country_name stay consistent with their source records. - Add a streamed data-integrity test that fails if any shipped name field regains whitespace (guards future JSON regenerations). Production-safe: no ids, foreign keys or record counts change — only the text of name fields. Existing installs pick up the clean values on the next `atlas:*` re-seed; nothing breaks until then. Changelog: fixed Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Qué hace
Limpia campos de nombre en los JSON que arrastraban espacios/tabs sobrantes o dobles (
"The Gambia ","Barisal ","Trashi Yangtse\t"…) — molestos en dropdowns y rompen búsquedas/joins por texto en las apps consumidoras.states.country_name,cities.state_name,cities.country_namequedan consistentes con su origen.Seguro para producción
atlas:*; nada se rompe hasta entonces.Relación con otros PRs
countries.json(solapa con Make country native field required with name fallback. #67) ystates.json/cities.json(solapan con Add hierarchical state divisions with admin_level and parent_id #65). El test de invariante hace que, si al mergear Add hierarchical state divisions with admin_level and parent_id #65 sustates.jsonreintroduce whitespace, CI falle → fuerza re-normalizar. Recomendado: mergear Add hierarchical state divisions with admin_level and parent_id #65/Make country native field required with name fallback. #67 y re-ejecutar la normalización si hiciera falta.Fuera de alcance (a propósito, documentado aparte)
state_codeen esquema distinto al de su estado (numérico vs alfabético): la FKstate_ides correcta; es característica del dataset origen, no se toca.