Behavior-preserving structural refactor: the ~870-line deterministic pricing block inside estimate_quality() is extracted into a new pure synchronous function _price_from_inputs() returning a PricingResult dataclass. Key design decisions: - All async DB fetches (imv_eval, yandex_val, cian_val) hoisted to estimate_quality BEFORE the call; passed as pre-fetched values / bool flags. - DB-dependent helpers whose arguments are computed inside the block (_get_asking_sold_ratio, _lookup_quarter_index, _lookup_quarter_indexes) injected as Callable parameters (ratio_resolver, quarter_index_lookup, quarter_indexes_lookup). - _fetch_house_imv_anchor called once in estimate_quality (was two separate conditional calls inside the block); single result passed as imv_anchor dict. - _fetch_dkp_corridor and _fetch_anchor_comps hoisted to estimate_quality with identical guards. All 2443 existing tests pass UNMODIFIED. 9 new hermetic unit tests added that call _price_from_inputs directly with stub callables. |
||
|---|---|---|
| .. | ||
| app | ||
| data/sql | ||
| scripts | ||
| tests | ||
| .dockerignore | ||
| Dockerfile | ||
| pyproject.toml | ||