Skip to content

Commit 38ed231

Browse files
committed
fix(overture): credit Overture on place cards via a GERS external reference
The place card showed OSM as a source but never Overture, even when Overture supplied the phone/website/brand — because the resolved GERS id was used internally and then dropped. Surface it: knowledge-overture now returns externalIds.gers for every match, foldExternalIdsIntoPlace folds it into place.ids.gers, and place-ids registers an "Overture Maps" id-scheme view — so the Info tab's External references credits Overture exactly the way it credits OSM. (Site-wide license attribution already lives in the legal tables now that the integrations are enabled; this adds the per-place, data-flow credit.)
1 parent 34ca5ef commit 38ed231

5 files changed

Lines changed: 31 additions & 9 deletions

File tree

apps/api/src/routes/places.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ function foldExternalIdsIntoPlace(
7373
if (externalIds.facebook && !ids.facebook && buildFacebookUrl(externalIds.facebook)) {
7474
ids.facebook = externalIds.facebook;
7575
}
76+
// Overture GERS id — surfaces as an "Overture Maps" external reference,
77+
// crediting the source whenever Overture enrichment matched the place.
78+
if (externalIds.gers && !ids.gers) {
79+
ids.gers = externalIds.gers;
80+
}
7681
}
7782
const osmTripadvisor = place.osmTags?.["contact:tripadvisor"];
7883
if (osmTripadvisor && !ids.tripadvisor && buildTripadvisorUrl(osmTripadvisor)) {

integrations/knowledge-overture/__tests__/provider.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ describe("knowledge-overture provider lookup", () => {
146146
expect(result?.names).toEqual({ de: "Starbucks", fr: "Starbucks" });
147147
expect(result?.structuredOpeningHours).toBe("Mo-Fr 07:00-21:00; Sa-Su 08:00-20:00");
148148
expect(result?.externalIds?.wikidata).toBe("Q37158");
149+
// The GERS id is always exposed so the place card can credit Overture.
150+
expect(result?.externalIds?.gers).toBe("overture-abc-123");
149151
expect(result?.phone).toBe("+49 30 1234567");
150152
expect(result?.website).toBe("https://starbucks.de");
151153
});

integrations/knowledge-overture/provider.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,17 @@ async function fetchOverturePlaceByGers(
146146
}
147147

148148
function overtureRowToKnowledgeResult(row: OvertureDetailRow): KnowledgeResult | null {
149-
const result: KnowledgeResult = {};
149+
// A successful match always credits Overture as a source via its GERS id,
150+
// which surfaces as an "Overture Maps" external reference on the place card.
151+
const result: KnowledgeResult = { externalIds: { gers: row.gers_id } };
150152

151153
const brandName = row.brand?.names?.primary;
152154
if (brandName) {
153155
result.brand = { name: brandName };
154-
if (row.brand?.wikidata) {
155-
result.brand.wikidata = row.brand.wikidata;
156-
result.externalIds = { wikidata: row.brand.wikidata };
157-
}
158-
} else if (row.brand?.wikidata) {
159-
// Branded place with no resolvable brand name — still expose the Q-id.
160-
result.externalIds = { wikidata: row.brand.wikidata };
156+
}
157+
if (row.brand?.wikidata) {
158+
if (result.brand) result.brand.wikidata = row.brand.wikidata;
159+
result.externalIds = { ...result.externalIds, wikidata: row.brand.wikidata };
161160
}
162161

163162
if (row.names && Object.keys(row.names).length > 0) {
@@ -174,7 +173,8 @@ function overtureRowToKnowledgeResult(row: OvertureDetailRow): KnowledgeResult |
174173
const website = row.websites?.[0];
175174
if (website) result.website = website;
176175

177-
return Object.keys(result).length > 0 ? result : null;
176+
// Always non-empty: externalIds.gers is set for every match.
177+
return result;
178178
}
179179

180180
export const overtureKnowledgeSource: KnowledgeProvider = {

packages/place-ids/src/builtin-views.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ export function registerBuiltinIdSchemeViews(): void {
5353
},
5454
});
5555

56+
registerIdSchemeView({
57+
scheme: "gers",
58+
label: "Overture Maps",
59+
displayOrder: 25,
60+
// Overture's GERS ids have no canonical per-feature public page, so the id
61+
// is shown as a source credit without a deep link (like EVA/GTFS).
62+
});
63+
5664
// Transit / stations
5765

5866
registerIdSchemeView({

packages/place-ids/src/external-platforms.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,11 @@ describe("external platform URL builders", () => {
8282
"https://www.instagram.com/openmapx/",
8383
);
8484
});
85+
86+
it("registers a user-facing 'Overture Maps' view for the gers scheme", () => {
87+
registerBuiltinIdSchemeViews();
88+
const view = getIdSchemeView("gers");
89+
expect(view?.label).toBe("Overture Maps");
90+
expect(view?.internal).toBeFalsy();
91+
});
8592
});

0 commit comments

Comments
 (0)