Skip to content

Validator skips gmaps_link vs lat/lng and same-name checks across files #283

Open

Description

@AnayDhawan

Problem

npm run validate accepts a gmaps_link that points nowhere near the record's lat/lng, and its duplicate check skips pairs with identical names and never looks across files. That is how the Ahmedabad link on 224 SAT centres and several doubled places reached main with a green CI.

Evidence

  • scripts/validate-places.mjs:205-218 checks gmaps_link only against the schema pattern (data/places.schema.json:46) and the literal lat,lng placeholder (scripts/lib/data-validation.mjs:13-22).
  • scripts/validate-places.mjs:268-289 runs the near-duplicate check inside the per-file loop, and line 279 (if (a.name === b.name) continue;) skips pairs with the same name.
$ node -e "const re=/[?&]q=(-?[\d.]+),(-?[\d.]+)/;let n=0,bad=0;for(const f of require('fs').readdirSync('data/places')){for(const p of require('./data/places/'+f)){const m=re.exec(p.gmaps_link);if(!m)continue;n++;if(Math.abs(m[1]-p.lat)>0.01||Math.abs(m[2]-p.lng)>0.01)bad++}}console.log('q= links',n,'disagree with lat/lng',bad)"
q= links 1931 disagree with lat/lng 224

Ten same-city, same-name pairs exist today (five inside one file, five across files).

Why it matters

The validator is the only automated gate on data PRs, and a copied link or a repeated place is easy to miss in a JSON diff.

Proposed fix

  • Add gmapsLinkCoordinates(link) to scripts/lib/data-validation.mjs: { lat, lng } for ?q=<lat>,<lng> links, null for other forms (cid=, maps.app.goo.gl).
  • In validate-places.mjs, error when the link coordinates differ from lat/lng by more than 0.01 degrees (about 1 km; the largest gap among agreeing records is 0.0009).
  • After the per-file loop, WARN on any group of records with the same city and normalised name (lowercase, diacritics folded, punctuation removed). A warning, because ten such pairs exist today.

Merge after the data fix for the 224 links, or CI goes red.

Acceptance criteria

  • A record with link ?q=23.021537,72.580057 and lat 49.26, lng -123.20 makes npm run validate:places exit 1 and name the record
  • Links in other forms are not reported
  • Records with the same city and normalised name in different files give a WARN
  • Helper tests (import from scripts/lib, as src/lib/verification.test.ts does); npm run test:unit passes

Notes

Size S. Related: #171 (earlier validator gaps), #229, #234. Where to start: scripts/lib/data-validation.mjs; npm run validate:places and npm run test:unit show the result.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ciCI / automationdataPlaces datasetgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions