feat: add inference for elo on new listings

This commit is contained in:
Stijnvandenbroek
2026-03-08 14:09:05 +00:00
parent fea062fbaa
commit 16a7a470ea
15 changed files with 360 additions and 6 deletions

View File

@@ -0,0 +1 @@
create schema if not exists elo

View File

@@ -0,0 +1,4 @@
create table if not exists elo.notified (
global_id text primary key,
notified_at timestamp with time zone default now()
)

View File

@@ -0,0 +1,6 @@
create table if not exists elo.predictions (
global_id text primary key,
predicted_elo double precision not null,
mlflow_run_id text not null,
scored_at timestamp with time zone default now()
)

View File

@@ -0,0 +1,3 @@
insert into elo.notified (global_id)
values (: global_id)
on conflict (global_id) do nothing

View File

@@ -0,0 +1,20 @@
select
ep.global_id,
ep.predicted_elo,
fl.title,
fl.city,
fl.url,
fl.current_price,
fl.living_area,
fl.bedrooms,
fl.rooms,
fl.energy_label,
fl.price_per_sqm,
ep.scored_at
from elo.predictions as ep
inner join marts.funda_listings as fl on ep.global_id = fl.global_id
left join elo.notified as en on ep.global_id = en.global_id
where
ep.predicted_elo >=: min_elo
and en.global_id is null
order by ep.predicted_elo desc

View File

@@ -0,0 +1,28 @@
select
fl.global_id,
fl.url,
fl.title,
fl.city,
fl.current_price,
fl.living_area,
fl.plot_area,
fl.bedrooms,
fl.rooms,
fl.construction_year,
fl.latitude,
fl.longitude,
fl.energy_label,
fl.has_garden,
fl.has_balcony,
fl.has_solar_panels,
fl.has_heat_pump,
fl.has_roof_terrace,
fl.is_energy_efficient,
fl.is_monument,
fl.photo_count,
fl.views,
fl.saves,
fl.price_per_sqm
from marts.funda_listings as fl
left join elo.predictions as ep on fl.global_id = ep.global_id
where ep.global_id is null

View File

@@ -0,0 +1,7 @@
insert into elo.predictions (global_id, predicted_elo, mlflow_run_id)
values (: global_id,: predicted_elo,: mlflow_run_id)
on conflict (global_id) do update
set
predicted_elo = excluded.predicted_elo,
mlflow_run_id = excluded.mlflow_run_id,
scored_at = now()