| Metadata | Value |
|---|---|
| Status | Completed |
| Version | 2.1.0 |
| Last Updated | 2026-11-01 |
| Author | Sangeetha Grantha Team |
ID: TRACK-154 Status: Complete — Intent, Spec and Plan Accepted; all Plan steps done Owner: Seshadri Created: 2026-10-16 Updated: 2026-11-01
Give each temple in the catalogue a reviewed Google place_id, so TRACK-151 can open or draw the temple on Google Maps without our database storing Google-derived coordinates.
LOCALITY, 84 COMPLEX, 11 SANNIDHI, 1 MANDAPAM. Every temple has a name, city and state. The 12 sub-shrines sit under three parents (ten sannidhis and the Navagraha mandapa under the Tiruvarur complex, one each under the Mayiladuthurai and Kulittalai temples).place_id may be stored indefinitely. The Maps Platform Terms page did not load in full, so the finer rules (for example any short lat/lng caching allowance) must be confirmed in the Spec before anything relies on them.temples.latitude and temples.longitude must not be filled from Google results. They stay for hand-entered or curator-measured values only. The new identity column is google_place_id.TemplesTable has latitude and longitude only. No place identity, precision or review state. The admin Temple modal lets a curator type latitude and longitude. R__seed_09_dikshitar_cycle_memberships.sql upserts temples but its update list excludes coordinates, so a rerun does not erase them.Status: Accepted Accepted by: Seshadri (2026-10-24)
A kshetra map needs correct places. Matching a temple by name can pick a different temple of the same name (there are several Subrahmanya Swamy and Kasi Viswanatha temples), a town, or a nearby business. Google’s terms stop us storing its coordinates, so the durable thing to keep is a verified place_id. Without recorded review, nobody can tell a checked match from a guess.
CONFIRMED, LOCALITY_ONLY (the place is the town, not the temple) or UNRESOLVED, with an approver. Automatic confirmation only when Google’s name and locality match the catalogue exactly after normalisation and there is a single candidate; everything else is a short curator review list.google_place_id and a place review state to temples; a repeatable seed applies the reviewed file with system-attributed audit rows. No Google name, address or coordinate is stored beyond the place id. Hand-entered coordinates, if any, are never overwritten.CONFIRMED rows. A consumer never receives a guessed place.V__ file; corpus data goes in a repeatable seed (TRACK-139 marker rules).place_id, show Google-sourced content on Google Maps with attribution, respect rate limits.LOCALITY_ONLY place as the temple.database/data/?database/data/, applied by a repeatable seed; no admin UI change.Candidate script with recorded-response fixtures and tests, a coverage report by review state, a reviewed data file with approvals, migration and seed tests (rerun, hand-entry protection, no coordinate writes from Google), make test, make test-integration, make check-docs.
(Superseded by the fixed list in the Plan below: fixtures are synthetic, not recorded, for the terms reason in Flagged concerns.)
Status: Accepted Accepted by: Seshadri (chat instruction) Accepted at: 2026-10-25
R1. Candidate lookup (offline, one-time).
"<catalogue name>, <city>, <state>", and writes ranked candidates to a local working file outside version control (storage/ is gitignored; confirm in the Plan).temples rows whose place_kind is not SANNIDHI or MANDAPAM (sub-shrines never get their own lookup).GOOGLE_PLACES_API_KEY), is sent in the request header (never the URL), and is never logged, written to a file, or placed in a DTO or the mobile config. Error messages and the call log redact it.pageSize of 5 or fewer. The script requests no location or geometry fields.PLACES_MAX_CALLS, default 150) and stops before exceeding it; it is resumable from the working file so a rerun does not repeat answered queries.R2. Expected call count against the spending cap.
GROUP BY place_kind.temple_names, or city and state dropped) for each target that is not auto-confirmed. Planned total about 110–130 calls; worst case 170 if every target needs a retry. The default ceiling of 150 therefore stops a runaway, and Seshadri raises it deliberately if the worst case is approached.R3. Review states and rules.
CONFIRMED: the place is this temple. LOCALITY_ONLY: Google only has the town or an area, not the temple. UNRESOLVED: no acceptable candidate.name_normalized and diacritic stripping rules). Everything else goes to a curator review list ordered by risk.place_reviewed_by) and a date (place_reviewed_at). An automatic confirmation is attributed to system:TRACK-154:auto, with the curator’s sign-off recorded in the reviewed file’s approval list.CONFIRMED rows share a google_place_id.LOCALITY_ONLY place is never presented as the temple, anywhere.R4. Sub-shrines inherit.
SANNIDHI and MANDAPAM rows hold no place id and no review state of their own. The V2 payload resolves them through parent_temple_id to the parent’s place and labels the precision PARENT_COMPLEX.CONFIRMED, the sub-shrine has no place. The seed fails if a sub-shrine row in the reviewed file carries its own place id.R5. Storage.
V68__temple_google_place_review.sql, next free number to be confirmed; the V46 gap is existing) adds to temples: google_place_id TEXT, place_review_state place_review_state_enum, place_reviewed_by TEXT, place_reviewed_at TIMESTAMPTZ. Schema only: no data.CHECK constraints: CONFIRMED requires a non-null place id; UNRESOLVED requires null; a place id requires a review state; a partial unique index on google_place_id where the state is CONFIRMED.place_id is stored: no name, address, coordinates, rating, photos or URLs. latitude and longitude are not written by this track (hand-entered values stay untouched).R6. Reviewed file and repeatable seed.
database/data/track154-temple-place-review.json: one entry per reviewed temple, keyed by the natural key (name_normalized, city, state, country; temple UUIDs are not stable across environments), holding the catalogue name, state, google_place_id (when applicable), approver, date and a short curator note. It holds no Google name, address or coordinates.R__seed_12_temple_place_review.sql applies it. Flyway cannot read repo files, so the file’s content is embedded in the SQL as a JSONB literal by a generator script, and a test fails when the embedded copy and the JSON differ (the pattern TRACK-147 uses for its manifest).updated_at; matches by natural key and skips with a notice (not an error) when a temple is absent, so an older or partial database still migrates; writes one AUDIT_LOG row per changed temple (entity_table = 'temples', actor_user_id NULL, metadata.actor = 'system:TRACK-154'), and none when nothing changed.system:TRACK-154. A value set by any other actor is left alone and reported.R7. V2 contract (jointly with TRACK-151).
TRACK-151 owns the V2 temple DTOs in the shared domain; TRACK-154 owns the column, the rule and the mapper logic. The agreed shape: an optional place object on the V2 temple detail DTO (not the list DTO) with googlePlaceId: String and precision: PlacePrecision (TEMPLE |
PARENT_COMPLEX). place is absent (null) unless the effective state is CONFIRMED. |
LOCALITY_ONLY, UNRESOLVED and unreviewed rows expose nothing; the DTO has no field for review state, approver or notes.R8. Out of scope. Admin UI changes, hand-measured coordinates, refresh cadence, the Google Maps SDK map, and the V1 API (no place id in V1).
place_review_state_enum ('CONFIRMED','LOCALITY_ONLY','UNRESOLVED'); columns per R5. TemplesTable in modules/backend/dal/.../tables/CoreTables.kt gains matching columns, and the enum gets a Kotlin counterpart beside PlaceKind. The postgres-flyway-db skill rules apply (PG18, V__ for schema, R__seed_NN_ for data, idempotent).tools/krithi-extract-enrich-worker/scripts/ (uv-managed, tests in the worker’s tests/), as three commands: lookup (calls Google, writes the local candidate file), triage (applies the auto-confirm rule, emits the review list and a coverage report by state), build (turns the curator-edited review into the committed JSON and regenerates the embedded SQL literal). Only lookup touches the network.temples (read-only, via a SQL export or psql) → lookup → local candidates → triage → curator edits → committed JSON (+ approvals) → build → R__seed_12 → temples columns → V2 repository mapper → V2 DTO.parent_temple_id), returning an explicit DTO; no Exposed entity leaks. Routes call services and repositories as elsewhere. No mutation route is added, so the only writes are the seed’s audited ones.googlePlaceId, using Google’s documented Maps URL form, which needs no app API key. TRACK-151 confirms the exact URL form and its attribution needs.application_documentation/04-database/schema.md, the OpenAPI spec (via TRACK-151’s V2 changes), and an implementation note in application_documentation/10-implementations/.place_id is permitted indefinitely; (b) the candidate file holds Google names and addresses, which is caching/storing Google content, so it stays local and is deleted after the review rather than committed; (c) Places results used for a map must appear on a Google Map with attribution, and a plain link to Google Maps is the TRACK-151 phase-one path; (d) whether a temporary working copy during review is acceptable, and any short caching allowance, which the Intent notes was not readable in full; (e) place ids can go stale and Google asks that they be refreshed, so the app must tolerate a link that no longer resolves (refresh cadence is deferred, see Open questions). Anything not confirmed is treated as forbidden.V__ and that reference data lives in idempotent R__ seeds with provenance and system attribution. R6 is written to that reading; if a specific marker convention was meant (for example a header comment or provenance tag), name it before the Spec is accepted.AUDIT_LOG rows with a system actor, as R__seed_11 does. No admin or API write path exists, so no other audit gap arises.carnatic-musicologist subagent for doubtful kshetra identity. It was not run on this Spec, since nothing here is musicological content.krithis.temple_id stays as is.LOCALITY-kind rows count as temples for review? Proposed: yes, they are looked up like the others; a confirmed place on a locality-kind row is the locality, which is correct for that row, but TRACK-151 should decide whether to show it as a temple map pin.Status: Accepted Accepted by: Seshadri Accepted at: 2026-10-25
Written ahead of Spec acceptance at the requesting session’s direction. Nothing here is implemented, and no work starts until the Spec and this Plan are both Accepted.
| Area | File | Change |
|---|---|---|
| Migration | database/migrations/V68__temple_google_place_review.sql (number confirmed at write time) |
New enum, four columns, CHECKs, partial unique index, column comments. Schema only. |
| Seed | database/migrations/R__seed_12_temple_place_review.sql |
Generated; embeds the reviewed JSON; guarded, audited, idempotent. |
| Data | database/data/track154-temple-place-review.json |
Reviewed placements with approvals. No Google content. |
| Script | tools/krithi-extract-enrich-worker/scripts/temple_place_lookup.py (and src/ helper if the worker layout needs it) |
lookup, triage, build. |
| Script tests | tools/krithi-extract-enrich-worker/tests/test_temple_place_lookup.py + synthetic fixtures |
See Proof. |
| DAL | modules/backend/dal/.../tables/CoreTables.kt, a PlaceReviewState enum, TempleRepository.kt |
New columns; read path for V2 with parent resolution. |
| Shared domain | V2 temple DTO (owned by TRACK-151) | Only the place field and PlacePrecision, coordinated with TRACK-151. |
| Backend tests | dal/api tests and a migration/seed integration test | See Proof. |
| Docs | application_documentation/04-database/schema.md, 10-implementations/ note, OpenAPI via TRACK-151, conductor/tracks.md |
Sync. |
| Ignore rules | .gitignore |
Only if storage/ does not already cover the candidate file. |
Not touched: latitude/longitude writers, the admin Temple modal, V1 routes, the mobile binary’s config.
make migrate.make migrate is a no-op.latitude/longitude survives; a row reviewed by another actor is not overwritten; no coordinate column is written; a sub-shrine with its own place id fails the seed; the embedded SQL matches the JSON.CONFIRMED, absent for LOCALITY_ONLY, UNRESOLVED and unreviewed; sub-shrine inherits PARENT_COMPLEX from a confirmed parent and gets nothing from an unconfirmed one.make db-reset then the V2 temple detail for Tiruvarur and one of its sannidhis, showing the expected place.make test, make test-integration, make check-docs, and make agent-evals if any agent-config file changed.