feat(tradein): add data_quality flag to /sales-vs-listings (#721) (#723)
All checks were successful
Deploy Trade-In / changes (push) Successful in 5s
Deploy Trade-In / build-frontend (push) Has been skipped
Deploy Trade-In / test (push) Successful in 24s
Deploy Trade-In / build-backend (push) Successful in 39s
Deploy Trade-In / deploy (push) Successful in 33s
All checks were successful
Deploy Trade-In / changes (push) Successful in 5s
Deploy Trade-In / build-frontend (push) Has been skipped
Deploy Trade-In / test (push) Successful in 24s
Deploy Trade-In / build-backend (push) Successful in 39s
Deploy Trade-In / deploy (push) Successful in 33s
Co-authored-by: bot-backend <bot-backend@gendsgn.local> Co-committed-by: bot-backend <bot-backend@gendsgn.local>
This commit is contained in:
parent
a79cf7d5e0
commit
575d9abbf7
2 changed files with 4 additions and 0 deletions
|
|
@ -1581,6 +1581,7 @@ def get_sales_vs_listings(
|
|||
deals_with_listings=0,
|
||||
linkage_rate_pct=0.0,
|
||||
median_discount_pct=None,
|
||||
data_quality="no_data", # #721 ADR v3: нет сделок / улица не извлеклась
|
||||
pairs=[],
|
||||
)
|
||||
|
||||
|
|
@ -1686,5 +1687,7 @@ def get_sales_vs_listings(
|
|||
deals_with_listings=deals_with_listings,
|
||||
linkage_rate_pct=linkage_rate_pct,
|
||||
median_discount_pct=median_discount,
|
||||
# #721 ADR v3: total_deals>0 здесь (guard `if not rows` выше → _empty).
|
||||
data_quality="house_linked" if deals_with_listings > 0 else "street_only",
|
||||
pairs=pairs,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -457,6 +457,7 @@ class SalesVsListingsResponse(BaseModel):
|
|||
deals_with_listings: int # сколько имеют связанный listing
|
||||
linkage_rate_pct: float # deals_with_listings / total_deals * 100
|
||||
median_discount_pct: float | None # медиана по парам с listing
|
||||
data_quality: str # "house_linked" | "street_only" | "no_data" (#721, ADR v3)
|
||||
pairs: list[SalesListingPair] # все пары, sorted by deal_date DESC
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue