feat(analytics): add NeighborhoodScoreService with POI-based scoring and API endpoint
- Create INeighborhoodScoreService interface and implementation - Score districts 0-100 across 6 categories: education, healthcare, transport, shopping, greenery, safety - Calculate scores from POI data with configurable weights and max counts - Add GetNeighborhoodScoreQuery handler with lazy calculation - Add GET /analytics/neighborhoods/:district/score endpoint - Wire service and handler into AnalyticsModule Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
export const NEIGHBORHOOD_SCORE_SERVICE = Symbol('NEIGHBORHOOD_SCORE_SERVICE');
|
||||
|
||||
export interface NeighborhoodScoreResult {
|
||||
district: string;
|
||||
city: string;
|
||||
educationScore: number;
|
||||
healthcareScore: number;
|
||||
transportScore: number;
|
||||
shoppingScore: number;
|
||||
greeneryScore: number;
|
||||
safetyScore: number;
|
||||
totalScore: number;
|
||||
poiCounts: Record<string, number>;
|
||||
calculatedAt: Date;
|
||||
}
|
||||
|
||||
export interface INeighborhoodScoreService {
|
||||
getScore(district: string, city: string): Promise<NeighborhoodScoreResult | null>;
|
||||
calculateAndSave(district: string, city: string): Promise<NeighborhoodScoreResult>;
|
||||
}
|
||||
Reference in New Issue
Block a user