Summary
The places.rank column accepts any INTEGER. It should be constrained to the documented set of valid ranks and its semantics should be explained in code or schema comments.
Context
The ingestion-service writes rank values to the places table to indicate place importance (used downstream for map zoom-level visibility and result ordering). Both ingestion-service and any future writers need to agree on the value set. Today the contract is implicit.
The agreed semantics are:
1 — most important (e.g. hospitals, universities, transport stations)
2 — standard establishments (restaurants, shops, etc.)
3 — minor features (toilets, ATMs, shelters)
Scope
- Add a
CHECK (rank IN (1, 2, 3)) constraint to places.rank via a new migration
- Add a
COMMENT ON COLUMN places.rank describing the value semantics
- Update any relevant API/handler documentation that mentions rank
Acceptance criteria
Notes
Open question: should rank be NOT NULL, or is NULL meaningful for places that have no defined importance? Decide before writing the constraint.
Summary
The
places.rankcolumn accepts any INTEGER. It should be constrained to the documented set of valid ranks and its semantics should be explained in code or schema comments.Context
The ingestion-service writes
rankvalues to theplacestable to indicate place importance (used downstream for map zoom-level visibility and result ordering). Both ingestion-service and any future writers need to agree on the value set. Today the contract is implicit.The agreed semantics are:
1— most important (e.g. hospitals, universities, transport stations)2— standard establishments (restaurants, shops, etc.)3— minor features (toilets, ATMs, shelters)Scope
CHECK (rank IN (1, 2, 3))constraint toplaces.rankvia a new migrationCOMMENT ON COLUMN places.rankdescribing the value semanticsAcceptance criteria
Notes
Open question: should
rankbeNOT NULL, or is NULL meaningful for places that have no defined importance? Decide before writing the constraint.