feat: add elo tables for house ranking
This commit is contained in:
14
dbt/models/marts/elo_sample_listings.sql
Normal file
14
dbt/models/marts/elo_sample_listings.sql
Normal 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 %}
|
||||
31
dbt/models/marts/elo_sample_listings.yml
Normal file
31
dbt/models/marts/elo_sample_listings.yml
Normal 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
|
||||
Reference in New Issue
Block a user