feat: add elo tables for house ranking

This commit is contained in:
Stijnvandenbroek
2026-03-06 10:49:24 +00:00
parent ccfd453dfe
commit 732e50924e
8 changed files with 151 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
-- Mart: stable random sample of Funda listings for pairwise ELO comparison.
-- Incrementally tops up to the target sample size using deterministic ordering.
select l.global_id
from {{ ref('funda_listings') }} as l
{% if is_incremental() %}
left join {{ this }} as s on l.global_id = s.global_id
where s.global_id is null
order by md5(l.global_id)
limit greatest(0, 50 - (select count(*) from {{ this }}))
{% else %}
order by md5(l.global_id)
limit 50
{% endif %}

View File

@@ -0,0 +1,31 @@
version: 2
models:
- name: elo_sample_listings
description: >
Stable random sample of Funda listings used for pairwise ELO comparison in the
house-elo-ranking application. Maintains up to 50 listings, topped up incrementally using
deterministic md5-based ordering.
config:
materialized: incremental
unique_key: global_id
on_schema_change: fail
schema: elo
contract:
enforced: true
meta:
dagster:
group: elo
columns:
- name: global_id
description: Funda internal listing ID, referencing funda_listings.
data_type: text
constraints:
- type: not_null
- type: unique
tests:
- unique
- not_null
- relationships:
to: ref('funda_listings')
field: global_id