A modern React-based business intelligence dashboard for tracking laboratory sample processing throughput with interactive charts and real-time data visualization.
- Node.js: >=18.0.0 (see
.nvmrc) - npm: >=9.0.0 (enforced package manager)
- Git: Latest version
# Clone the repository
git clone <repository-url>
cd bi-dashboard
# Switch to correct Node version
nvm use
# Install dependencies
npm install
# Start development server
npm run devOpen http://localhost:5173 to view the dashboard.
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run test # Run tests
npm run test:watch # Run tests in watch mode
npm run storybook # Start Storybook for component development
npm run lint # Run ESLint
npm run type-check # Run TypeScript type checkingReact 19 + TypeScript + Vite
- React 19: Latest features with improved performance and concurrent rendering
- TypeScript: Strict type safety for better developer experience and fewer runtime errors
- Vite: Fast development server and optimized builds with HMR
Component Architecture
bi-dashboard/
โโโ .husky/ # Git hooks configuration
โโโ .storybook/ # Storybook configuration
โโโ .vscode/ # VS Code workspace settings
โโโ public/ # Static assets
โโโ src/
โ โโโ api/ # Data layer & API integration
โ โ โโโ index.ts # API exports
โ โ โโโ sampleThroughputApi.ts # API client for sample data
โ โ โโโ sample_throughput_data.json # Mock data
โ โ โโโ useSampleThroughput.ts # React hook for data fetching
โ โ
โ โโโ components/ # React components
โ โ โโโ cards/ # Layout & container components
โ โ โ โโโ DashboardCard.tsx # Main dashboard card wrapper
โ โ โ โโโ constants.ts # Card configuration constants
โ โ โ โโโ index.ts # Card exports
โ โ โ โโโ variants.ts # Card styling variants
โ โ โ
โ โ โโโ charts/ # Data visualization components
โ โ โ โโโ LineChart.tsx # Interactive line chart with tooltips
โ โ โ
โ โ โโโ inputs/ # Form & input components
โ โ โ โโโ DateRangePicker/ # Date selection component
โ โ โ
โ โ โโโ layouts/ # Layout components
โ โ โ โโโ DashboardLayout.tsx # Main dashboard layout
โ โ โ โโโ index.ts # Layout exports
โ โ โ
โ โ โโโ Typography/ # Text components
โ โ โ โโโ Typography.tsx # Typography component
โ โ โ โโโ typographyVariants.ts # Typography styles
โ โ โ โโโ index.ts # Typography exports
โ โ โ
โ โ โโโ ui/ # Reusable UI components (shadcn/ui)
โ โ โโโ button/ # Button component
โ โ โโโ calendar.tsx # Calendar component
โ โ โโโ card.tsx # Card component
โ โ โโโ chart.tsx # Chart container
โ โ โโโ label.tsx # Label component
โ โ โโโ popover.tsx # Popover component
โ โ โโโ index.ts # UI exports
โ โ
โ โโโ context/ # Global state management
โ โ โโโ dashboard/ # Dashboard-specific context
โ โ โ โโโ DashboardContext.tsx # Main dashboard context
โ โ โ โโโ useDashboardContext.ts # Context hook
โ โ โ โโโ index.ts # Context exports
โ โ โโโ index.ts # Context exports
โ โ
โ โโโ lib/ # Utilities & helpers
โ โ โโโ auth/ # Authentication utilities
โ โ โ โโโ useMockAuth.ts # Mock authentication hook
โ โ โโโ date.ts # Date formatting utilities
โ โ โโโ utils.ts # General utilities
โ โ
โ โโโ pages/ # Page-level components
โ โ โโโ DashboardPage.tsx # Main dashboard page
โ โ โโโ LoginPage.tsx # Login page
โ โ โโโ UnauthorizedPage.tsx # Unauthorized access page
โ โ
โ โโโ routes/ # Routing configuration
โ โ โโโ applyGuardsAndLayouts.tsx # Route guard application
โ โ โโโ AppRouter.tsx # Main router component
โ โ โโโ layouts.tsx # Layout wrapper
โ โ โโโ paths.ts # Route path constants
โ โ โโโ RouteGuard.tsx # Route protection component
โ โ โโโ routes.tsx # Route definitions
โ โ โโโ index.ts # Route exports
โ โ
โ โโโ test/ # Test configuration
โ โ โโโ setup.ts # Test setup file
โ โ
โ โโโ App.css # App-specific styles
โ โโโ App.tsx # Main application component
โ โโโ index.css # Global styles & CSS variables
โ โโโ main.tsx # Application entry point
โ โโโ vite-env.d.ts # Vite type definitions
โ
โโโ .eslintrc.js # ESLint configuration
โโโ .nvmrc # Node version specification
โโโ .npmrc # npm configuration
โโโ .prettierrc # Prettier configuration
โโโ components.json # shadcn/ui configuration
โโโ package.json # Dependencies & scripts
โโโ tailwind.config.ts # Tailwind CSS configuration
โโโ tsconfig.json # TypeScript configuration
โโโ tsconfig.app.json # App-specific TypeScript config
โโโ tsconfig.node.json # Node-specific TypeScript config
โโโ vite.config.ts # Vite configuration
โโโ vitest.shims.d.ts # Vitest type definitions
Tailwind CSS v4 with OKLCH Colors
- OKLCH Color Space: Better color perception and accessibility
- Design Tokens: Consistent spacing, typography, and color variables
- Responsive Design: Mobile-first approach with breakpoint system
shadcn/ui Component Library
- Accessible Components: Built with ARIA standards and keyboard navigation
- Customizable: Themeable through CSS variables
- Type-Safe: Full TypeScript support with proper prop types
Chart System
- Recharts: React-native charting library with accessibility features
- Custom Tooltips: Enhanced with detailed information and ARIA labels
- Responsive: Adapts to different screen sizes and orientations
API Layer
interface SampleThroughputData {
date: string;
lab: string;
sample_type: string;
count: number;
status: 'complete' | 'processing' | 'pending' | 'failed';
}State Management
- React Context: For global dashboard state (date ranges, filters)
- Custom Hooks: For data fetching and transformation
- Local State: Component-specific state with useState/useReducer
Vitest + Testing Library
- Unit Tests: Component behavior and utility functions
- Accessibility Tests: ARIA compliance and keyboard navigation
Storybook
- Component Documentation: Interactive examples and prop documentation
- Visual Testing: Component variations and edge cases
- Design System: Living documentation of UI components
-
Data Visualization Enhancements
- Add more chart types (bar charts, pie charts, heatmaps)
- Implement data aggregation and filtering
- Add export functionality (CSV, PDF reports)
- Real-time data updates with WebSocket integration
-
Performance Optimizations
- Implement virtual scrolling for large datasets
- Add data caching with React Query
- Optimize bundle size with code splitting
- Add service worker for offline functionality
-
User Experience
- Add loading states and skeleton screens
- Implement error boundaries and retry mechanisms
- Add keyboard shortcuts for power users
- Improve mobile responsiveness
-
Testing
- Playwright with E2E/integration tests.
-
Advanced Analytics
- Trend analysis and forecasting
- Statistical summaries and KPIs
- Custom dashboard builder
-
Accessibility & Internationalization
- Full i18n support with react-intl
- Enhanced screen reader support
- High contrast mode
-
Backend Integration
- Real API endpoints with authentication
- Database integration (PostgreSQL/MongoDB)
- Caching layer (Redis)
- API rate limiting and monitoring
-
Data Structure
- Sample data follows a consistent format with date, lab, sample_type, count, and status
- Status values are limited to: complete, processing, pending, failed
- Count values are always positive integers
-
User Requirements
- Users need to view sample throughput over time
- Detailed information (lab, sample type, status) is important for tooltips
- Color-coded status indicators improve data comprehension
-
Performance Requirements
- Initial load time should be under 3 seconds
- Chart interactions should be smooth (60fps)
- Mobile devices should be supported
-
Accessibility Requirements
- WCAG 2.1 AA compliance
- Keyboard navigation support
- Screen reader compatibility
- Color contrast ratios meet standards
Development Assistance
-
GitHub Copilot: Used extensively for code completion and boilerplate generation
- React component structure and TypeScript interfaces
- Test file generation and assertions
- Documentation
-
ChatGPT (Claude): Used for architectural decisions and problem-solving
- Chart component design and Recharts implementation
- Accessibility improvements and ARIA attributes
- Color scheme selection and OKLCH color space
- Testing strategies and best practices
Specific AI Contributions
-
LineChart Component
- AI helped design the tooltip structure with proper accessibility
- Assisted with Recharts configuration and customization
-
Accessibility Improvements
- AI identified missing ARIA attributes and semantic HTML
- Suggested proper heading hierarchy and screen reader support
-
Styling and Design
- AI recommended OKLCH color space for better accessibility
Responsible AI Usage
- Code Review: All AI-generated code was reviewed and modified as needed
- Understanding: Ensured comprehension of all implemented solutions
- Customization: Adapted AI suggestions to fit project requirements
- Testing: Verified AI-generated code with proper tests
- Documentation: Documented AI contributions transparently
AI Tools Used
- GitHub Copilot: Real-time code completion and suggestions
- ChatGPT/Claude: Problem-solving and architectural guidance
- VS Code Extensions: AI-powered linting and formatting
- Real-time data visualization with hover tooltips
- Monthly and daily view options
- Color-coded status indicators
- Responsive design for all screen sizes
- Detailed information display (lab, sample type, count, status)
- Accessibility features with ARIA labels
- Color-coded status badges
- Semantic HTML structure
- Responsive card-based layout
- Loading states and error handling
- Date range selection
- Clean, modern UI design
- Type-safe API integration
- Custom React hooks for data fetching
- Efficient data transformation and aggregation
- Error handling
- Unit Tests: Component behavior and utility functions
- Integration Tests: API interactions and data flow
- Accessibility Tests: ARIA compliance and keyboard navigation
- Visual Tests: Component rendering and styling
- Storybook: Interactive component documentation