UNPKG

@vepler/safety-types

Version:

TypeScript type definitions for Vepler Safety Service API

93 lines (92 loc) 2.59 kB
/** * Types for /api/crime/get-area-stats endpoint */ import { CrimeStats } from './get-crime-data'; /** * Query parameters for area statistics */ export interface GetAreaStatsQueryParams { /** Area identifier */ areaId: string; /** Time periods to query (comma-separated) */ periods?: string; /** Start date for date range queries */ startDate?: string; /** End date for date range queries */ endDate?: string; /** Crime categories to filter (comma-separated) */ categories?: string; /** Whether to include rich crime score data (percentile, trends, explanatory tags, etc.) */ includeRichData?: boolean; /** Country code (default: 'uk') */ countryCode?: string; } /** * Area statistics including crime data */ export interface AreaStats { /** Area identifier */ id: string; /** Area name */ name: string; /** Population */ population: number; /** Crime rate per 1000 population */ crimeRate: number; /** Crime score (0-100) */ crimeScore: number; /** Detailed crime statistics */ crimeStats: CrimeStats; /** GeoJSON boundary geometry */ boundaryGeometry?: any; /** Percentile ranking against peer areas (0-100) */ percentile?: number; /** Raw severity score before normalization */ severityScore?: number; /** Severity score normalized per 1000 population */ severityScorePerThousand?: number; /** Trend factor (-1 to 1, negative means improving) */ trendFactor?: number; /** Whether the trend is statistically significant */ trendSignificance?: boolean; /** Confidence interval for the crime score */ confidenceInterval?: { lower: number; upper: number; }; /** Explanatory tags describing factors driving the score */ explanatoryTags?: string[]; /** Period details for the calculation */ periodDetails?: { start: string; end: string; }; } /** * Area statistics response */ export interface GetAreaStatsResponse { /** Area boundaries */ boundaries: Array<{ /** Area code */ code: string; /** Area name */ name: string; /** Boundary geometry */ geometry: any; }>; /** Crime statistics */ stats: { /** Total crimes */ total: number; /** Crimes by category */ byCategory: Record<string, number>; /** Time period */ period: { /** Start date */ start: string; /** End date */ end: string; }; }; }