feat(ai-services): add building_coverage, loading_docks, zoning to industrial AVM

Completes the industrial-specific feature set required for AVM industrial
valuation. Adds heuristic adjustments for all three new features and
4 new tests covering zoning premiums, loading docks, and coverage ratio.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-16 17:06:27 +07:00
parent 8592fb436c
commit 13bd76ac5d
3 changed files with 115 additions and 8 deletions

View File

@@ -109,6 +109,62 @@ def test_predict_industrial_total_rent():
assert abs(resp["total_monthly_rent_usd"] - expected_total) < 1.0
def test_predict_industrial_free_trade_zone_premium():
"""Free-trade-zone zoning should command higher rent than general_industrial."""
general = client.post(
"/avm/industrial/predict",
json={**_PREDICT_PAYLOAD, "zoning": "general_industrial"},
).json()
ftz = client.post(
"/avm/industrial/predict",
json={**_PREDICT_PAYLOAD, "zoning": "free_trade_zone"},
).json()
assert ftz["estimated_rent_usd_m2"] > general["estimated_rent_usd_m2"]
def test_predict_industrial_high_tech_zone_premium():
"""High-tech zoning should command higher rent than general_industrial."""
general = client.post(
"/avm/industrial/predict",
json={**_PREDICT_PAYLOAD, "zoning": "general_industrial"},
).json()
ht = client.post(
"/avm/industrial/predict",
json={**_PREDICT_PAYLOAD, "zoning": "high_tech"},
).json()
assert ht["estimated_rent_usd_m2"] > general["estimated_rent_usd_m2"]
def test_predict_industrial_loading_docks_premium():
"""More loading docks should increase rent."""
no_docks = client.post(
"/avm/industrial/predict",
json={**_PREDICT_PAYLOAD, "loading_docks": 0},
).json()
many_docks = client.post(
"/avm/industrial/predict",
json={**_PREDICT_PAYLOAD, "loading_docks": 6},
).json()
assert many_docks["estimated_rent_usd_m2"] > no_docks["estimated_rent_usd_m2"]
def test_predict_industrial_building_coverage_premium():
"""Higher building coverage should increase rent."""
low_cov = client.post(
"/avm/industrial/predict",
json={**_PREDICT_PAYLOAD, "building_coverage": 0.3},
).json()
high_cov = client.post(
"/avm/industrial/predict",
json={**_PREDICT_PAYLOAD, "building_coverage": 0.7},
).json()
assert high_cov["estimated_rent_usd_m2"] > low_cov["estimated_rent_usd_m2"]
def test_predict_industrial_validation_error():
"""Missing required fields should return 422."""
resp = client.post("/avm/industrial/predict", json={"area_m2": 5000})