lilith-platform.live/codebase/@features/score-refresh/README.md

31 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

# @lilith/score-refresh
Nightly aggregator that refreshes `destinations` scoring columns from public
sources:
| Source | Column populated | Notes |
|---------------------------------------|-------------------------------|-------|
| Henley & Partners HNWI Cities Report | `wealth_score` (percentile) | per-city HNWI count |
| Spartacus Gay Travel Index | `lgbtq_score` | country-level, mapped to destination by ISO-2 |
| NSWP Sex Work Laws Map | `sw_legal_tier` | country-level, baseline overlay |
| Tryst.link in-{city} listing density | `market_saturation_score` | provider count percentile per destination slug |
Composite `sex_positive_score` is the mean of LGBTQ and the SW-legality
contribution. All sources record provenance + per-source success into
`destinations.score_sources` JSONB. Partial failures are allowed; the row
still updates with the sources that did succeed.
## Run
```bash
QUINN_DB_URL=postgres://... bun run bin/refresh.ts
```
The systemd unit at `systemd/score-refresh-nightly.{service,timer}` runs
nightly at 10:00 UTC (03:00 PT).
## Politeness
The HTTP wrapper enforces 1 req/sec per origin, a 30-second total timeout,
and identifies the user-agent as a research tool with contact info.