make the csv exporter use the filtering params to allow exporting customizable reports
This commit is contained in:
parent
0acd417d34
commit
0bdfeec195
2 changed files with 41 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue