mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
feat(FE): Add chart data types to Uniformity API types
This commit is contained in:
+57
@@ -1,6 +1,62 @@
|
|||||||
import { BaseMetadata } from '@/types/api/api-general';
|
import { BaseMetadata } from '@/types/api/api-general';
|
||||||
import { BaseApproval } from '@/types/api/approval/approval';
|
import { BaseApproval } from '@/types/api/approval/approval';
|
||||||
|
|
||||||
|
// ==================== CHART DATA TYPES ====================
|
||||||
|
export type WeightDistributionData = {
|
||||||
|
weight: number;
|
||||||
|
count: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type StatisticsData = {
|
||||||
|
mean: number;
|
||||||
|
standardDeviation: number;
|
||||||
|
min: number;
|
||||||
|
max: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type WeekBarChartData = {
|
||||||
|
has_data: boolean;
|
||||||
|
weight_distribution: WeightDistributionData[];
|
||||||
|
ideal_range: {
|
||||||
|
min: number;
|
||||||
|
max: number;
|
||||||
|
} | null;
|
||||||
|
statistics: StatisticsData | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type BarChart = {
|
||||||
|
current_week: number;
|
||||||
|
all_weeks: Record<string, WeekBarChartData>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AvailableWeek = {
|
||||||
|
week: number;
|
||||||
|
uniformity_percentage: number;
|
||||||
|
ideal_count: number;
|
||||||
|
outside_ideal_count: number;
|
||||||
|
total_count: number;
|
||||||
|
has_data: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type WeekInfo = {
|
||||||
|
total_weeks: number;
|
||||||
|
weeks_with_data: number;
|
||||||
|
current_week_index: number;
|
||||||
|
has_prev_week: boolean;
|
||||||
|
has_next_week: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GaugeChart = {
|
||||||
|
current_week: number;
|
||||||
|
available_weeks: AvailableWeek[];
|
||||||
|
week_info: WeekInfo;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ChartData = {
|
||||||
|
bar_chart: BarChart;
|
||||||
|
gauge_chart: GaugeChart;
|
||||||
|
};
|
||||||
|
|
||||||
// ==================== GET ALL RESPONSE ====================
|
// ==================== GET ALL RESPONSE ====================
|
||||||
export type Uniformity = BaseMetadata & {
|
export type Uniformity = BaseMetadata & {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -21,6 +77,7 @@ export type Uniformity = BaseMetadata & {
|
|||||||
standard_mean_weight: number | null;
|
standard_mean_weight: number | null;
|
||||||
standard_uniformity: number | null;
|
standard_uniformity: number | null;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
|
chart_data?: ChartData;
|
||||||
created_by: number;
|
created_by: number;
|
||||||
latest_approval?: BaseApproval;
|
latest_approval?: BaseApproval;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user