HomeHarvest/homeharvest/core/scrapers/models.py

132 lines
3.1 KiB
Python
Raw Normal View History

from __future__ import annotations
2023-09-15 15:17:37 -07:00
from dataclasses import dataclass
from enum import Enum
2023-10-03 22:21:16 -07:00
from typing import Optional
2023-09-15 15:17:37 -07:00
2023-09-17 16:30:37 -07:00
class SiteName(Enum):
ZILLOW = "zillow"
REDFIN = "redfin"
REALTOR = "realtor.com"
@classmethod
def get_by_value(cls, value):
for item in cls:
if item.value == value:
return item
raise ValueError(f"{value} not found in {cls}")
2023-09-17 16:30:37 -07:00
2023-09-15 15:17:37 -07:00
class ListingType(Enum):
2023-09-18 11:38:17 -07:00
FOR_SALE = "FOR_SALE"
FOR_RENT = "FOR_RENT"
PENDING = "PENDING"
2023-09-18 11:38:17 -07:00
SOLD = "SOLD"
2023-09-15 15:17:37 -07:00
2024-04-16 18:01:20 -07:00
@dataclass
class Agent:
name: str | None = None
phone: str | None = None
class PropertyType(Enum):
APARTMENT = "APARTMENT"
BUILDING = "BUILDING"
COMMERCIAL = "COMMERCIAL"
CONDO_TOWNHOME = "CONDO_TOWNHOME"
CONDO_TOWNHOME_ROWHOME_COOP = "CONDO_TOWNHOME_ROWHOME_COOP"
CONDO = "CONDO"
2024-05-12 21:12:12 -07:00
CONDOP = "CONDOP"
CONDOS = "CONDOS"
COOP = "COOP"
DUPLEX_TRIPLEX = "DUPLEX_TRIPLEX"
FARM = "FARM"
INVESTMENT = "INVESTMENT"
LAND = "LAND"
MOBILE = "MOBILE"
MULTI_FAMILY = "MULTI_FAMILY"
RENTAL = "RENTAL"
SINGLE_FAMILY = "SINGLE_FAMILY"
TOWNHOMES = "TOWNHOMES"
OTHER = "OTHER"
2023-09-15 15:17:37 -07:00
@dataclass
class Address:
full_line: str | None = None
2023-10-03 22:21:16 -07:00
street: str | None = None
unit: str | None = None
2023-09-19 19:13:20 -07:00
city: str | None = None
state: str | None = None
2023-10-03 22:21:16 -07:00
zip: str | None = None
2023-09-15 15:17:37 -07:00
@dataclass
2023-10-04 06:58:55 -07:00
class Description:
2023-11-24 11:41:46 -08:00
primary_photo: str | None = None
alt_photos: list[str] | None = None
style: PropertyType | None = None
2023-10-04 06:58:55 -07:00
beds: int | None = None
baths_full: int | None = None
baths_half: int | None = None
sqft: int | None = None
lot_sqft: int | None = None
sold_price: int | None = None
year_built: int | None = None
garage: float | None = None
stories: int | None = None
text: str | None = None
@dataclass
class AgentPhone: #: For documentation purposes only (at the moment)
number: str | None = None
type: str | None = None
primary: bool | None = None
ext: str | None = None
2024-04-16 12:55:44 -07:00
@dataclass
class Agent:
name: str | None = None
phones: list[dict] | AgentPhone | None = None
email: str | None = None
href: str | None = None
@dataclass
class Broker:
2024-04-16 12:55:44 -07:00
name: str | None = None
phone: str | None = None
website: str | None = None
2024-04-16 12:55:44 -07:00
2023-09-18 11:38:17 -07:00
@dataclass
class Property:
2023-10-04 06:58:55 -07:00
property_url: str
2023-10-03 22:21:16 -07:00
mls: str | None = None
2023-09-15 16:03:17 -07:00
mls_id: str | None = None
2023-10-03 22:21:16 -07:00
status: str | None = None
2023-10-04 06:58:55 -07:00
address: Address | None = None
2023-10-03 22:21:16 -07:00
list_price: int | None = None
list_date: str | None = None
pending_date: str | None = None
2023-10-03 22:21:16 -07:00
last_sold_date: str | None = None
2023-10-04 06:58:55 -07:00
prc_sqft: int | None = None
2023-10-03 22:21:16 -07:00
hoa_fee: int | None = None
2023-10-09 09:00:36 -07:00
days_on_mls: int | None = None
2023-10-04 06:58:55 -07:00
description: Description | None = None
2023-10-03 22:21:16 -07:00
2023-09-19 19:13:20 -07:00
latitude: float | None = None
longitude: float | None = None
2023-10-03 22:21:16 -07:00
neighborhoods: Optional[str] = None
county: Optional[str] = None
fips_code: Optional[str] = None
2024-05-11 21:35:29 -07:00
agents: list[Agent] | None = None
brokers: list[Broker] | None = None
2024-04-16 18:01:20 -07:00
nearby_schools: list[str] = None
2024-04-30 13:29:54 -07:00
assessed_value: int | None = None
estimated_value: int | None = None