feat(analytics): AVM v2 batch valuation, comparison, history + frontend upgrade

Add batch valuation (POST /analytics/valuation/batch, max 50 properties),
valuation comparison (POST /analytics/valuation/compare, 2-5 properties),
and history endpoint (GET /analytics/valuation/history/:propertyId) with
confidence explanation helper. Frontend: enhanced valuation form with project
autocomplete and deep analysis toggle, results with confidence badges and
price range visualization, comparables table, history chart, market context
card, and PDF export.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-16 05:08:05 +07:00
parent 93a390efb9
commit 8da488711b
27 changed files with 1715 additions and 162 deletions

View File

@@ -1,4 +1,4 @@
import { PropertyType } from '@prisma/client';
import { type PropertyType } from '@prisma/client';
export const AVM_SERVICE = Symbol('AVM_SERVICE');
@@ -31,9 +31,38 @@ export interface ValuationResult {
pricePerM2: number;
comparables: Comparable[];
modelVersion: string;
confidenceExplanation?: string;
}
export interface BatchValuationItem {
propertyId: string;
}
export interface BatchValuationResult {
propertyId: string;
valuation: ValuationResult | null;
error?: string;
}
export interface ValuationHistoryPoint {
estimatedPrice: string;
confidence: number;
pricePerM2: number;
modelVersion: string;
valuedAt: string;
}
export interface ValuationComparisonItem {
propertyId: string;
address: string;
district: string;
areaM2: number;
propertyType: PropertyType;
valuation: ValuationResult | null;
}
export interface IAVMService {
estimateValue(params: AVMParams): Promise<ValuationResult>;
getComparables(propertyId: string, radiusMeters: number): Promise<Comparable[]>;
estimateBatch(items: BatchValuationItem[]): Promise<BatchValuationResult[]>;
}