feat: add similar neighborhood analysis
This commit is contained in:
@@ -366,9 +366,55 @@ export type NeighborhoodDetail = {
|
||||
profile: Neighborhood;
|
||||
current_score: NeighborhoodScore | null;
|
||||
monthly_metrics: NeighborhoodMonthlyMetric[];
|
||||
similar_neighborhoods: SimilarNeighborhood[];
|
||||
watchlist_items: WatchlistItem[];
|
||||
};
|
||||
|
||||
export type SimilarNeighborhoodCandidate = {
|
||||
neighborhood_id: string;
|
||||
area_id: string;
|
||||
name: string;
|
||||
area_name: string;
|
||||
district: string;
|
||||
built_year: number | null;
|
||||
property_type: string;
|
||||
metro_distance_m: number | null;
|
||||
school_quality: string | null;
|
||||
month: string;
|
||||
investment_score: number;
|
||||
recommendation: string;
|
||||
transaction_price_psm: number;
|
||||
annual_rent_yield_pct: number;
|
||||
liquidity_score: number;
|
||||
location_score: number;
|
||||
building_age_score: number;
|
||||
};
|
||||
|
||||
export type SimilarNeighborhood = {
|
||||
neighborhood_id: string;
|
||||
area_id: string;
|
||||
name: string;
|
||||
area_name: string;
|
||||
district: string;
|
||||
built_year: number | null;
|
||||
property_type: string;
|
||||
metro_distance_m: number | null;
|
||||
school_quality: string | null;
|
||||
investment_score: number;
|
||||
recommendation: string;
|
||||
transaction_price_psm: number;
|
||||
annual_rent_yield_pct: number;
|
||||
similarity_score: number;
|
||||
relative_price_pct: number;
|
||||
reasons: string[];
|
||||
};
|
||||
|
||||
export type SimilarNeighborhoodResponse = {
|
||||
target: SimilarNeighborhoodCandidate;
|
||||
month: string;
|
||||
items: SimilarNeighborhood[];
|
||||
};
|
||||
|
||||
export type ComparisonMetricValue = {
|
||||
id: string;
|
||||
value: number | null;
|
||||
@@ -444,6 +490,16 @@ export async function fetchNeighborhoodDetail(
|
||||
);
|
||||
}
|
||||
|
||||
export async function fetchSimilarNeighborhoods(
|
||||
neighborhoodId: string,
|
||||
month: string,
|
||||
limit = 8,
|
||||
): Promise<SimilarNeighborhoodResponse> {
|
||||
return fetchJson(
|
||||
`/api/v1/neighborhoods/${encodeURIComponent(neighborhoodId)}/similar?month=${encodeURIComponent(month)}&limit=${limit}`,
|
||||
);
|
||||
}
|
||||
|
||||
export async function fetchAreaComparison(
|
||||
areaIds: string[],
|
||||
month: string,
|
||||
|
||||
Reference in New Issue
Block a user