make the csv exporter use the filtering params to allow exporting customizable reports

This commit is contained in:
Viktor Barzin 2025-06-01 20:11:00 +00:00
parent 0acd417d34
commit 0bdfeec195
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863
2 changed files with 41 additions and 3 deletions

View file

@ -2,13 +2,17 @@ import asyncio
from pathlib import Path
from data_access import Listing
import pandas as pd
from rec.query import QueryParameters, filter_listings
async def export_to_csv(
listings: list[Listing],
output_file: Path,
columns: list[str],
query_parameters: QueryParameters | None = None,
) -> None:
if query_parameters is not None:
listings = await filter_listings(listings, query_parameters)
ds = await asyncio.gather(*[listing.dict_nicely() for listing in listings])
df = pd.DataFrame(ds)
# read decisions on file