mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-28 00:47:03 -05:00
Enhance admin stats dashboard
Add data quality metrics, growth trends visualization, entity comparison views, and automated health checks to the AdminDatabaseStats dashboard, including new TS types, hooks, UI components, and integrated tabbed layout.
This commit is contained in:
88
src/types/database-analytics.ts
Normal file
88
src/types/database-analytics.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* Database Analytics Types
|
||||
* For growth trends, entity comparisons, and health checks
|
||||
*/
|
||||
|
||||
// Growth Trends
|
||||
export interface GrowthTrendDataPoint {
|
||||
period: string;
|
||||
parks_added: number;
|
||||
rides_added: number;
|
||||
companies_added: number;
|
||||
ride_models_added: number;
|
||||
photos_added: number;
|
||||
total_added: number;
|
||||
}
|
||||
|
||||
export type GranularityType = 'daily' | 'weekly' | 'monthly';
|
||||
|
||||
// Entity Comparisons
|
||||
export interface TopParkByRides {
|
||||
park_name: string;
|
||||
park_slug: string;
|
||||
ride_count: number;
|
||||
photo_count: number;
|
||||
}
|
||||
|
||||
export interface TopManufacturer {
|
||||
manufacturer_name: string;
|
||||
slug: string;
|
||||
ride_count: number;
|
||||
model_count: number;
|
||||
}
|
||||
|
||||
export interface TopOperator {
|
||||
operator_name: string;
|
||||
slug: string;
|
||||
park_count: number;
|
||||
ride_count: number;
|
||||
}
|
||||
|
||||
export interface TopDesigner {
|
||||
designer_name: string;
|
||||
slug: string;
|
||||
ride_count: number;
|
||||
}
|
||||
|
||||
export interface TopParkByPhotos {
|
||||
park_name: string;
|
||||
park_slug: string;
|
||||
photo_count: number;
|
||||
}
|
||||
|
||||
export interface TopRideByPhotos {
|
||||
ride_name: string;
|
||||
ride_slug: string;
|
||||
park_slug: string;
|
||||
photo_count: number;
|
||||
}
|
||||
|
||||
export interface EntityComparisons {
|
||||
top_parks_by_rides: TopParkByRides[];
|
||||
top_manufacturers: TopManufacturer[];
|
||||
top_operators: TopOperator[];
|
||||
top_designers: TopDesigner[];
|
||||
top_parks_by_photos: TopParkByPhotos[];
|
||||
top_rides_by_photos: TopRideByPhotos[];
|
||||
}
|
||||
|
||||
// Database Health
|
||||
export type HealthSeverity = 'critical' | 'warning' | 'info';
|
||||
|
||||
export interface HealthIssue {
|
||||
severity: HealthSeverity;
|
||||
category: string;
|
||||
count: number;
|
||||
entity_ids: string[];
|
||||
description: string;
|
||||
suggested_action: string;
|
||||
}
|
||||
|
||||
export interface DatabaseHealthData {
|
||||
overall_score: number;
|
||||
critical_issues: number;
|
||||
warning_issues: number;
|
||||
info_issues: number;
|
||||
issues: HealthIssue[];
|
||||
checked_at: string;
|
||||
}
|
||||
Reference in New Issue
Block a user