166 lines
5.5 KiB
TypeScript
166 lines
5.5 KiB
TypeScript
/*
|
|
* File: dashboardAPI.ts
|
|
* Description: API service for dashboard operations using apisauce
|
|
* Design & Developed by Tech4Biz Solutions
|
|
* Copyright (c) Spurrin Innovations. All rights reserved.
|
|
*/
|
|
|
|
import { create } from 'apisauce';
|
|
import { API_CONFIG, buildHeaders } from '../../../shared/utils';
|
|
|
|
const api = create({
|
|
baseURL: API_CONFIG.BASE_URL
|
|
});
|
|
|
|
/**
|
|
* Dashboard API Service
|
|
*
|
|
* Purpose: Handle all dashboard-related API operations
|
|
*
|
|
* Features:
|
|
* - Get AI analysis dashboard statistics
|
|
* - Get feedback statistics for AI cases
|
|
* - Get real-time dashboard metrics
|
|
* - Get time-based analysis data
|
|
*/
|
|
export const dashboardAPI = {
|
|
/**
|
|
* Get AI Analysis Dashboard Statistics
|
|
*
|
|
* Purpose: Fetch comprehensive dashboard statistics for AI analysis
|
|
*
|
|
* @param token - Authentication token
|
|
* @returns Promise with dashboard statistics data
|
|
*/
|
|
getDashboardStatistics: (token: string) => {
|
|
return api.get('/api/ai-cases/feedbacks/statistics', {}, buildHeaders({ token }));
|
|
},
|
|
|
|
/**
|
|
* Get Real-time Dashboard Metrics
|
|
*
|
|
* Purpose: Fetch real-time dashboard metrics for live updates
|
|
*
|
|
* @param token - Authentication token
|
|
* @returns Promise with real-time dashboard metrics
|
|
*/
|
|
getRealTimeMetrics: (token: string) => {
|
|
return api.get('/api/ai-cases/feedbacks/statistics/realtime', {}, buildHeaders({ token }));
|
|
},
|
|
|
|
/**
|
|
* Get Time-based Analysis Data
|
|
*
|
|
* Purpose: Fetch time-based analysis data for trend visualization
|
|
*
|
|
* @param token - Authentication token
|
|
* @param timeRange - Time range for analysis (today, week, month, year)
|
|
* @returns Promise with time-based analysis data
|
|
*/
|
|
getTimeBasedAnalysis: (token: string, timeRange: 'today' | 'week' | 'month' | 'year') => {
|
|
return api.get(`/api/ai-cases/feedbacks/statistics/time-analysis/${timeRange}`, {}, buildHeaders({ token }));
|
|
},
|
|
|
|
/**
|
|
* Get Hospital-specific Statistics
|
|
*
|
|
* Purpose: Fetch statistics for a specific hospital
|
|
*
|
|
* @param token - Authentication token
|
|
* @param hospitalId - Hospital identifier
|
|
* @returns Promise with hospital-specific statistics
|
|
*/
|
|
getHospitalStatistics: (token: string, hospitalId: string) => {
|
|
return api.get(`/api/ai-cases/feedbacks/statistics/hospital/${hospitalId}`, {}, buildHeaders({ token }));
|
|
},
|
|
|
|
/**
|
|
* Get Department Performance Metrics
|
|
*
|
|
* Purpose: Fetch performance metrics for specific departments
|
|
*
|
|
* @param token - Authentication token
|
|
* @param department - Department name
|
|
* @returns Promise with department performance data
|
|
*/
|
|
getDepartmentMetrics: (token: string, department: string) => {
|
|
return api.get(`/api/ai-cases/feedbacks/statistics/department/${department}`, {}, buildHeaders({ token }));
|
|
},
|
|
|
|
/**
|
|
* Get Confidence Score Distribution
|
|
*
|
|
* Purpose: Fetch confidence score distribution for AI predictions
|
|
*
|
|
* @param token - Authentication token
|
|
* @param timeRange - Optional time range filter
|
|
* @returns Promise with confidence score distribution data
|
|
*/
|
|
getConfidenceDistribution: (token: string, timeRange?: 'today' | 'week' | 'month' | 'year') => {
|
|
const params = timeRange ? { timeRange } : {};
|
|
return api.get('/api/ai-cases/feedbacks/statistics/confidence-distribution', params, buildHeaders({ token }));
|
|
},
|
|
|
|
/**
|
|
* Get Urgency Level Distribution
|
|
*
|
|
* Purpose: Fetch urgency level distribution for AI cases
|
|
*
|
|
* @param token - Authentication token
|
|
* @param timeRange - Optional time range filter
|
|
* @returns Promise with urgency level distribution data
|
|
*/
|
|
getUrgencyDistribution: (token: string, timeRange?: 'today' | 'week' | 'month' | 'year') => {
|
|
const params = timeRange ? { timeRange } : {};
|
|
return api.get('/api/ai-cases/feedbacks/statistics/urgency-distribution', params, buildHeaders({ token }));
|
|
},
|
|
|
|
/**
|
|
* Get Feedback Analysis Data
|
|
*
|
|
* Purpose: Fetch feedback analysis and coverage metrics
|
|
*
|
|
* @param token - Authentication token
|
|
* @param timeRange - Optional time range filter
|
|
* @returns Promise with feedback analysis data
|
|
*/
|
|
getFeedbackAnalysis: (token: string, timeRange?: 'today' | 'week' | 'month' | 'year') => {
|
|
const params = timeRange ? { timeRange } : {};
|
|
return api.get('/api/ai-cases/feedbacks/statistics/feedback-analysis', params, buildHeaders({ token }));
|
|
},
|
|
|
|
/**
|
|
* Get Critical Findings Statistics
|
|
*
|
|
* Purpose: Fetch statistics for critical findings and cases
|
|
*
|
|
* @param token - Authentication token
|
|
* @param timeRange - Optional time range filter
|
|
* @returns Promise with critical findings statistics
|
|
*/
|
|
getCriticalFindingsStats: (token: string, timeRange?: 'today' | 'week' | 'month' | 'year') => {
|
|
const params = timeRange ? { timeRange } : {};
|
|
return api.get('/api/ai-cases/feedbacks/statistics/critical-findings', params, buildHeaders({ token }));
|
|
},
|
|
|
|
/**
|
|
* Get Prediction Breakdown Statistics
|
|
*
|
|
* Purpose: Fetch breakdown of AI predictions by category
|
|
*
|
|
* @param token - Authentication token
|
|
* @param timeRange - Optional time range filter
|
|
* @returns Promise with prediction breakdown data
|
|
*/
|
|
getPredictionBreakdown: (token: string, timeRange?: 'today' | 'week' | 'month' | 'year') => {
|
|
const params = timeRange ? { timeRange } : {};
|
|
return api.get('/api/ai-cases/feedbacks/statistics/prediction-breakdown', params, buildHeaders({ token }));
|
|
}
|
|
};
|
|
|
|
/*
|
|
* End of File: dashboardAPI.ts
|
|
* Design & Developed by Tech4Biz Solutions
|
|
* Copyright (c) Spurrin Innovations. All rights reserved.
|
|
*/
|