move parsing logic

This commit is contained in:
2025-07-26 16:33:13 +02:00
parent fb2e90d47d
commit 433b52c0cb
3 changed files with 42 additions and 38 deletions

View File

@@ -0,0 +1,21 @@
import polars as pl
def parse(df: pl.LazyFrame) -> pl.LazyFrame:
"""Parse the Sounds DataFrame."""
ic()
return pl.sql(
"""
SELECT source,
CAST(date AS DATE) AS date,
ean AS id,
_artist AS artist,
LOWER(title) AS title,
CAST(_date AS DATE) AS release,
CAST(_price AS FLOAT) AS price,
CONCAT('https://www.platomania.nl', url) AS url
FROM df
QUALIFY ROW_NUMBER() OVER (PARTITION BY source, id, artist, title, price ORDER BY date DESC) = 1
ORDER BY date ASC
"""
)