add filter for furnished/unfurnished type for rented listings
This commit is contained in:
parent
b873eaf203
commit
9f3e466b23
3 changed files with 41 additions and 16 deletions
|
|
@ -6,7 +6,7 @@ import importlib
|
|||
from rec.districts import get_districts
|
||||
from data_access import Listing
|
||||
import csv_exporter
|
||||
from rec.query import ListingType
|
||||
from rec.query import ListingType, FurnishType
|
||||
|
||||
dump_listings_module = importlib.import_module('1_dump_listings')
|
||||
dump_detail_module = importlib.import_module('2_dump_detail')
|
||||
|
|
@ -14,14 +14,6 @@ dump_images_module = importlib.import_module('3_dump_images')
|
|||
detect_floorplan_module = importlib.import_module('4_detect_floorplan')
|
||||
routing_module = importlib.import_module('5_routing')
|
||||
|
||||
steps_to_handlers = {
|
||||
'dump_listings': dump_listings_module.dump_listings,
|
||||
'dump_detail': dump_detail_module.dump_detail,
|
||||
'dump_images': dump_images_module.dump_images,
|
||||
'detect_floorplan': detect_floorplan_module.detect_floorplan,
|
||||
'routing': routing_module.calculate_route,
|
||||
}
|
||||
|
||||
|
||||
@click.group()
|
||||
@click.option(
|
||||
|
|
@ -84,6 +76,19 @@ def cli(ctx, data_dir: str):
|
|||
type=click.Choice(get_districts().keys(), case_sensitive=False),
|
||||
multiple=True,
|
||||
)
|
||||
@click.option(
|
||||
'--furnish-types',
|
||||
'-f',
|
||||
help='Furnish types for rented listings',
|
||||
type=click.Choice(
|
||||
[
|
||||
furnish_type.name
|
||||
for furnish_type in FurnishType.__members__.values()
|
||||
],
|
||||
case_sensitive=False,
|
||||
),
|
||||
multiple=True,
|
||||
)
|
||||
@click.pass_context
|
||||
def dump_listings(
|
||||
ctx: click.core.Context,
|
||||
|
|
@ -93,6 +98,7 @@ def dump_listings(
|
|||
min_price: int,
|
||||
max_price: int,
|
||||
type: str,
|
||||
furnish_types: list[str],
|
||||
):
|
||||
data_dir: str = ctx.obj['data_dir']
|
||||
query_parameters = dump_listings_module.QueryParameters(
|
||||
|
|
@ -102,13 +108,16 @@ def dump_listings(
|
|||
max_bedrooms=max_bedrooms,
|
||||
min_price=min_price,
|
||||
max_price=max_price,
|
||||
furnish_types=[
|
||||
FurnishType[furnish_type] for furnish_type in furnish_types
|
||||
],
|
||||
)
|
||||
click.echo(
|
||||
f'Running dump_listings for districts {district}, data dir {data_dir} and parameters: '
|
||||
f'{query_parameters}'
|
||||
)
|
||||
f'{query_parameters}')
|
||||
data_dir_path = pathlib.Path(data_dir)
|
||||
asyncio.run(dump_listings_module.dump_listings(query_parameters, data_dir_path))
|
||||
asyncio.run(
|
||||
dump_listings_module.dump_listings(query_parameters, data_dir_path))
|
||||
|
||||
|
||||
@cli.command()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue