mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 11:45:23 +02:00
feat: Integrate PapaParse for CSV handling
Adds papaparse as a dependency and updates the data processing service to use it for more robust CSV file parsing. This replaces manual CSV parsing logic with a dedicated library, improving reliability and handling of various CSV formats. Also renames the `MoversIcon` to `TrendingIcon` to better reflect its usage in indicating trending performance metrics.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
|
||||
|
||||
export interface SalesRecord {
|
||||
id: string;
|
||||
customer: string;
|
||||
@@ -25,7 +24,7 @@ export interface FilterState {
|
||||
title: string[]; // Added Title filter
|
||||
}
|
||||
|
||||
export interface LineGrowthMetric { // Renamed from GrowthMetric
|
||||
export interface GrowthMetric {
|
||||
line: string;
|
||||
currentYearSellOut: number;
|
||||
previousYearSellOut: number;
|
||||
@@ -38,23 +37,23 @@ export interface LineGrowthMetric { // Renamed from GrowthMetric
|
||||
unitsGrowthPercentage: number;
|
||||
}
|
||||
|
||||
export type LineGrowthMetric = GrowthMetric;
|
||||
|
||||
export interface ItemGrowthMetric {
|
||||
sku: string;
|
||||
asin: string;
|
||||
title: string;
|
||||
line: string; // Keep line for context
|
||||
line: string;
|
||||
currentYearSellOut: number;
|
||||
previousYearSellOut: number;
|
||||
sellOutGrowthValue: number;
|
||||
sellOutGrowthPercentage: number;
|
||||
|
||||
currentYearUnits: number;
|
||||
previousYearUnits: number;
|
||||
unitsGrowthValue: number;
|
||||
unitsGrowthPercentage: number;
|
||||
}
|
||||
|
||||
|
||||
export interface SeasonalityPoint {
|
||||
name: string; // "Jan", "Feb", etc.
|
||||
[year: string]: number | string; // Dynamic keys for years: "2023": 500, "2024": 600
|
||||
@@ -75,8 +74,8 @@ export interface AggregatedData {
|
||||
seasonality: SeasonalityPoint[];
|
||||
seasonalityUnits: SeasonalityPoint[];
|
||||
availableYears: string[];
|
||||
topMovers: LineGrowthMetric[]; // Now uses LineGrowthMetric
|
||||
bottomMovers: LineGrowthMetric[]; // Now uses LineGrowthMetric
|
||||
topMovers: GrowthMetric[];
|
||||
bottomMovers: GrowthMetric[];
|
||||
comparisonPeriods: { current: string; previous: string };
|
||||
topLinesSplit: YearlySplitData[];
|
||||
byCustomerSplit: YearlySplitData[];
|
||||
@@ -124,4 +123,48 @@ export interface ComparisonTimeSeriesPoint {
|
||||
week: number;
|
||||
name: string; // "W1", "W2", etc.
|
||||
[key: string]: number | string; // Dynamic keys like "2023_sellOut", "2024_units"
|
||||
}
|
||||
}
|
||||
|
||||
export interface AdsRecord {
|
||||
country: string;
|
||||
month: string;
|
||||
asin: string;
|
||||
cost: number;
|
||||
clicks: number;
|
||||
impressions: number;
|
||||
attributedSales30d: number;
|
||||
attributedUnits30d: number;
|
||||
}
|
||||
|
||||
export interface CombinedKPIs {
|
||||
id: string;
|
||||
marketplace: string;
|
||||
month: string;
|
||||
year: number;
|
||||
asin: string;
|
||||
title: string;
|
||||
line: string;
|
||||
sku: string;
|
||||
|
||||
salesTotal: number;
|
||||
unitsTotal: number;
|
||||
|
||||
salesAds: number;
|
||||
unitsAds: number;
|
||||
cost: number;
|
||||
clicks: number;
|
||||
impressions: number;
|
||||
|
||||
salesOrganic: number;
|
||||
unitsOrganic: number;
|
||||
|
||||
paidSalesShare: number;
|
||||
organicSalesShare: number;
|
||||
|
||||
acos: number;
|
||||
tacos: number;
|
||||
roas: number;
|
||||
ctr: number;
|
||||
cpc: number;
|
||||
cvrUnits: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user