feat: add buscarmisasNetworkId (and discovermassId) to church-matcher interfaces and ID-match passes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
albertfj114
2026-03-19 19:03:51 -04:00
parent 6ca891f517
commit db0be8671e

View File

@@ -28,6 +28,7 @@ export interface ExistingChurch {
kerknetId: string | null;
gottesdienstzeitenId: string | null;
discovermassId: string | null;
buscarmisasNetworkId: string | null;
source: string;
website: string | null;
phone: string | null;
@@ -138,6 +139,7 @@ export type ChurchCandidate = {
kerknetId?: string;
gottesdienstzeitenId?: string;
discovermassId?: string;
buscarmisasNetworkId?: string;
};
/**
@@ -147,8 +149,8 @@ export type ChurchCandidate = {
* Matching strategy (in priority order):
* 1. Exact osmId match
* 2. Exact baiduId match
* 3-14. Exact importer ID matches (orarimesse, massSchedulesPh, philmass, horariosMisas, mszeInfo, weekdayMasses, messesInfo, bohosluzby, miserend, kerknet, gottesdienstzeiten, discovermass)
* 15. Proximity + name similarity (within 200m + similar name)
* 3-9. Exact importer ID matches (orarimesse, massSchedulesPh, philmass, horariosMisas, mszeInfo, weekdayMasses, messesInfo)
* 10. Proximity + name similarity (within 200m + similar name)
*/
export function findDuplicateChurch(
candidate: ChurchCandidate,
@@ -260,11 +262,21 @@ export function findDuplicateChurch(
// Fourteenth pass: exact discovermassId match
if (candidate.discovermassId) {
const match = existingChurches.find(c => c.discovermassId === candidate.discovermassId);
const match = existingChurches.find(
(church) => church.discovermassId === candidate.discovermassId
);
if (match) return match;
}
// Fifteenth pass: proximity + name match (skip if candidate has no real coordinates)
// Fifteenth pass: exact buscarmisasNetworkId match
if (candidate.buscarmisasNetworkId) {
const match = existingChurches.find(
(church) => church.buscarmisasNetworkId === candidate.buscarmisasNetworkId
);
if (match) return match;
}
// Sixteenth pass: proximity + name match (skip if candidate has no real coordinates)
if (candidate.lat === 0 && candidate.lng === 0) {
return null;
}