Commit Graph

22 Commits

Author SHA1 Message Date
albertfj114
3cf1465fb6 feat: add Nominatim forward geocoding script
Enriches churches with lat/lng=0 using Nominatim search API.
Cleans trailing city/country suffixes from addresses before querying.
Maps HK/MO to 'cn' countrycodes (OSM treats them as part of China).
After this runs, enrich-with-reverse-geocode fills city/state fields.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 21:34:42 -04:00
albertfj114
92265cf27f feat: add DB operations and CLI wiring for HK parish import
upsertChurch() handles matched churches (replace schedules atomically
via $transaction, update contact fields if null) and new churches
(create with source='diocese-hk', lat/lng=0 for later geocoding).
main() wires up CLI args, file reading, matching loop, and summary.
Guards main() call with ESM import.meta.url check to prevent execution
on import during tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 16:27:02 -04:00
albertfj114
8075072c24 fix: use true Jaccard similarity in wordOverlap (intersection/union)
Replaces max(|A|,|B|) denominator with |A∪B| = |A|+|B|-intersection,
which is the correct Jaccard formula and avoids inflating similarity
when both name sets have significant unique words.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 16:25:24 -04:00
albertfj114
3ebbc3732f feat: add name normalizer and church matcher for HK import
normalizeName strips noise words (church/parish/chapel/etc), accents,
and punctuation for robust name comparison. findMatch uses word-overlap
Jaccard score (threshold 0.4) with address-prefix fallback for Chinese-
named churches where English name overlap may be low.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 16:23:58 -04:00
albertfj114
eedb442e78 feat: add full entry parser for HK parishes
parseEntry composes extractNames, extractFields, parseScheduleLine,
and parseWeekdayLine into a single ParsedEntry. Routes schedule
lines by section header (Sunday/Anticipated/Weekday) and skips
Special Masses and Eucharist Adoration sections.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 16:18:05 -04:00
albertfj114
38274174a9 feat: add HK parish import parser functions (Tasks 2-6)
Implements splitEntries, extractNames, extractFields, normalizeTime,
parseScheduleLine, and parseWeekdayLine with 26 passing unit tests.
Handles full-width parentheses, language tags, conditional schedule
notes, day ranges, and comma-separated day/time lists.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 16:15:04 -04:00
albertfj114
328d146201 feat: add HK parish parser functions (Tasks 2-6) with tests
Implements entry splitter, name extractor, field extractor, time normalizer,
schedule line parser, and weekday day-prefix parser. All 26 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 16:06:26 -04:00
albertfj114
9aea12f4b0 feat: add HK parish import script skeleton
- Imports, types, and Prisma client init
- ParsedSchedule and ParsedEntry types for parsing parish data
- ExistingChurch interface for matching
- ImportStats interface for tracking progress

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 15:59:51 -04:00
albertfj114
033f805965 fix: clean up church-matcher types and add HK OSM bounding box
- Remove discovermassId/buscarmisasNetworkId from findDuplicateChurch match
  passes (importers now do their own pre-check dedup); restore as optional
  fields on ExistingChurch to keep type/runtime in sync
- Add HK bounding box to COUNTRY_BOUNDING_BOXES; fix silent 0-result
  fallback when country query returns empty from mirror server
- discovermass importer: add --limit flag and skip-already-imported
  pre-check using importedSlugs set
- Import scripts: remove discovermassId from ExistingChurch select/stubs
  (field not needed in shared matcher context)
- Schema: reorder discovermassId/kerknetId/gottesdienstzeitenId fields

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 22:20:45 -04:00
albertfj114
3bd4d2e2f9 fix: write heartbeat file at startup to avoid cold-start unhealthy window 2026-03-28 10:05:21 -04:00
albertfj114
73d8e8990c fix: include freesearch-enrichment in deploy build step 2026-03-28 10:03:11 -04:00
albertfj114
8f7c4d1698 fix: write heartbeat file for Docker healthcheck 2026-03-28 08:50:19 -04:00
albertfj114
857eaedbcf fix: wait for FreeSearch on startup instead of exiting; clean stale jobs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 08:46:03 -04:00
albertfj114
9593e08983 feat: add buscarmisas-network to package.json and scheduler pipeline
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 23:49:39 -04:00
albertfj114
2b37c2d5f2 feat: add buscarmisas-network importer — CLI + main loop
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 23:47:41 -04:00
albertfj114
dde083c32e feat: add buscarmisas-network importer — DB helpers and church processing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 23:45:34 -04:00
albertfj114
5c7bc4cfed feat: add buscarmisas-network importer — sitemap discovery
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 23:43:19 -04:00
albertfj114
08dc9e76ba feat: add buscarmisas-network importer — parsing functions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 19:09:24 -04:00
albertfj114
9e5e2a2b53 feat: add discovermass-import to scheduler pipeline and package.json
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 07:06:55 -04:00
albertfj114
53ddc51f64 refactor: remove --test-parse debug block from discovermass importer
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 07:06:14 -04:00
albertfj114
2046bbe289 feat: add import-discovermass.ts — USA church importer with 10s crawl delay
Imports 20,284 US Catholic churches from discovermass.com including mass,
confession, and adoration schedules. Respects robots.txt Crawl-delay: 10.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 07:02:58 -04:00
albertfj114
a046928ed0 feat: add discovermassId to church-matcher ExistingChurch and ChurchCandidate
Add discovermassId field to ExistingChurch interface and ChurchCandidate type,
insert a dedicated matching pass in findDuplicateChurch, and update all 15 importer
push blocks plus 16 loadExistingChurches select queries to include the new field.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 06:52:05 -04:00