Add comprehensive analytics system with: - Analytics data layer (aggregator, metrics, trends, cache) - 6 API endpoints (overview, plants, transport, farms, sustainability, export) - 6 chart components (LineChart, BarChart, PieChart, AreaChart, Gauge, Heatmap) - 5 dashboard widgets (KPICard, TrendIndicator, DataTable, DateRangePicker, FilterPanel) - 5 dashboard pages (overview, plants, transport, farms, sustainability) - Export functionality (CSV, JSON) Dependencies added: recharts, d3, date-fns Also includes minor fixes: - Fix EnvironmentalForm spread type error - Fix AgentOrchestrator Map iteration issues - Fix next.config.js image domains undefined error - Add downlevelIteration to tsconfig
70 lines
1.2 KiB
TypeScript
70 lines
1.2 KiB
TypeScript
/**
|
|
* Analytics Module Index
|
|
* Exports all analytics functionality
|
|
*/
|
|
|
|
// Types
|
|
export * from './types';
|
|
|
|
// Data aggregation
|
|
export {
|
|
getDateRangeFromTimeRange,
|
|
generateTimeSeriesPoints,
|
|
aggregateByPeriod,
|
|
calculateChange,
|
|
getAnalyticsOverview,
|
|
getPlantAnalytics,
|
|
getTransportAnalytics,
|
|
getFarmAnalytics,
|
|
getSustainabilityAnalytics,
|
|
getCachedData,
|
|
setCachedData,
|
|
clearCache,
|
|
generateCacheKey,
|
|
} from './aggregator';
|
|
|
|
// Metrics calculations
|
|
export {
|
|
mean,
|
|
median,
|
|
standardDeviation,
|
|
percentile,
|
|
minMax,
|
|
getTrendDirection,
|
|
percentageChange,
|
|
movingAverage,
|
|
rateOfChange,
|
|
normalize,
|
|
cagr,
|
|
efficiencyScore,
|
|
carbonIntensity,
|
|
foodMilesScore,
|
|
sustainabilityScore,
|
|
generateKPICards,
|
|
calculateGrowthMetrics,
|
|
detectAnomalies,
|
|
correlationCoefficient,
|
|
formatNumber,
|
|
formatPercentage,
|
|
} from './metrics';
|
|
|
|
// Trend analysis
|
|
export {
|
|
analyzeTrend,
|
|
linearRegression,
|
|
forecast,
|
|
detectSeasonality,
|
|
findPeaksAndValleys,
|
|
calculateMomentum,
|
|
exponentialSmoothing,
|
|
generateTrendSummary,
|
|
compareTimeSeries,
|
|
getTrendConfidence,
|
|
yearOverYearComparison,
|
|
} from './trends';
|
|
|
|
// Cache management
|
|
export {
|
|
analyticsCache,
|
|
withCache,
|
|
} from './cache';
|