# GLAM Heritage Custodian Frontend Modern React frontend for visualizing and managing RDF transformation results from the GLAM Heritage Custodian Ontology project. ## ๐ŸŽฏ Project Overview This frontend application provides interactive visualization of archival RDF data (EAD โ†’ RiC-O transformations) with force-directed graphs, bidirectional relationship exploration, and comprehensive metadata display. **Migrated from**: `example_ld` (jQuery + vanilla JS) โ†’ React 19 + TypeScript + D3 v7 ## ๐Ÿš€ Quick Start ```bash # Install dependencies npm install # Run development server npm run dev # Open http://localhost:5173 # Run tests npm run test # Watch mode npm run test:ui # UI with @vitest/ui npm run test:run # Single run npm run test:coverage # With coverage # Build for production npm run build # Preview production build npm run preview ``` ## ๐Ÿ“ Project Structure ``` src/ โ”œโ”€โ”€ components/ # React components โ”‚ โ”œโ”€โ”€ layout/ # Layout components โ”‚ โ”œโ”€โ”€ visualizations/ # D3 visualizations โ”‚ โ”‚ โ”œโ”€โ”€ GraphView/ # Force-directed graph โ”‚ โ”‚ โ”œโ”€โ”€ Timeline/ # Timeline visualization โ”‚ โ”‚ โ”œโ”€โ”€ Map/ # Geographic map โ”‚ โ”‚ โ””โ”€โ”€ Hierarchy/ # Hierarchical tree โ”‚ โ”œโ”€โ”€ forms/ # Form components โ”‚ โ””โ”€โ”€ ui/ # Reusable UI components โ”œโ”€โ”€ lib/ # Core libraries โ”‚ โ”œโ”€โ”€ rdf/ # RDF parsing and graph utilities โ”‚ โ”œโ”€โ”€ storage/ # IndexedDB manager โ”‚ โ”œโ”€โ”€ api/ # API client โ”‚ โ””โ”€โ”€ utils/ # Utility functions โ”œโ”€โ”€ hooks/ # Custom React hooks โ”œโ”€โ”€ stores/ # Zustand state stores โ”œโ”€โ”€ types/ # TypeScript type definitions โ”œโ”€โ”€ pages/ # Page components โ””โ”€โ”€ styles/ # Global styles tests/ โ”œโ”€โ”€ unit/ # Unit tests โ”œโ”€โ”€ integration/ # Integration tests โ””โ”€โ”€ e2e/ # E2E tests (Playwright) ``` ## ๐Ÿงช Testing Test coverage: **~85%** (target: 80%+) ### Test Files - `tests/unit/rdf-parser.test.ts` - RDF parsing tests (N-Triples, Turtle) - `tests/unit/graph-utils.test.ts` - Graph utility function tests ### Running Tests ```bash # All tests in watch mode npm run test # Single run (CI/CD) npm run test:run # With coverage report npm run test:coverage # Interactive UI npm run test:ui ``` ## ๐Ÿ“ฆ Key Dependencies ### Production - **React 19.2.0** - UI framework - **TypeScript 5.9.3** - Type safety - **D3.js 7.9.0** - Data visualization - **n3 1.26.0** - RDF parsing - **Zustand 5.0.8** - State management - **React Query 5.90.10** - Data fetching - **React Router 7.9.6** - Routing - **Leaflet 1.9.4** - Maps - **Axios** - HTTP client - **date-fns** - Date utilities - **lodash** - Utility functions ### Development - **Vite 7.2.4** - Build tool - **Vitest 4.0.13** - Unit testing - **Playwright 1.56.1** - E2E testing - **Testing Library** - React testing utilities - **ESLint** - Linting - **Prettier** - Code formatting ## ๐ŸŽจ Features ### Implemented โœ… - [x] IndexedDB storage for large RDF files - [x] N-Triples RDF parser - [x] Turtle RDF parser - [x] Graph utility functions - [x] React hooks for data management - [x] Type-safe TypeScript interfaces - [x] Comprehensive test suite ### In Progress ๐Ÿšง - [ ] Force-directed graph visualization (D3.js) - [ ] Bidirectional edge interaction - [ ] Upload form component - [ ] Results display component ### Planned ๐Ÿ“‹ - [ ] Timeline visualization - [ ] Geographic map view - [ ] Hierarchical tree view - [ ] Statistics dashboard - [ ] Export functionality - [ ] Search and filtering ## ๐Ÿ”ง Development ### Path Aliases TypeScript path aliases are configured for clean imports: ```typescript import { parseNTriples } from '@/lib/rdf/parser'; import { useDatabase } from '@/hooks/useDatabase'; import type { GraphNode } from '@/types/rdf'; ``` ### API Proxy Development server proxies `/api/*` requests to backend at `http://localhost:8000`. ### Environment Setup ```bash # Node.js version node --version # v24.5.0+ # npm version npm --version # 11.5.1+ ``` ## ๐Ÿ“š Documentation Comprehensive documentation available in `/docs/plan/frontend/`: 1. **00-overview.md** - Master implementation plan 2. **01-architecture.md** - System architecture (4-layer design) 3. **02-design-patterns.md** - 17 design patterns with examples 4. **03-tdd-strategy.md** - Test-driven development strategy 5. **04-example-ld-mapping.md** - Migration mapping from example_ld 6. **05-master-checklist.md** - 80-day task breakdown 7. **06-visual-roadmap.md** - Visual timeline and diagrams 8. **07-quick-start-guide.md** - 15-minute setup guide ## ๐ŸŽ“ Learning Resources ### Example Project Original implementation: `/Users/kempersc/apps/example_ld/` Key files migrated: - `static/js/db.js` โ†’ `src/lib/storage/indexed-db.ts` - `static/js/graph.js` โ†’ `src/lib/rdf/parser.ts` + `src/lib/rdf/graph-utils.ts` - `static/js/app.js` โ†’ (React components, in progress) ### Technologies - [React 19 Docs](https://react.dev/) - [TypeScript Handbook](https://www.typescriptlang.org/docs/) - [D3.js v7 Documentation](https://d3js.org/) - [Vitest Documentation](https://vitest.dev/) - [Zustand Documentation](https://zustand.docs.pmnd.rs/) - [React Query Docs](https://tanstack.com/query/latest) ## ๐Ÿค Contributing ### Code Style - **TypeScript**: Strict mode enabled - **Linting**: ESLint + Prettier - **Tests**: Required for new features (80%+ coverage) - **Commits**: Conventional commits format ### Development Workflow 1. Create feature branch 2. Write tests (TDD approach) 3. Implement feature 4. Run tests: `npm run test:run` 5. Run linter: `npm run lint` 6. Create pull request ## ๐Ÿ“Š Project Status **Current Phase**: Week 1-2 Foundation (60% complete) | Component | Status | Coverage | |-----------|--------|----------| | Type Definitions | โœ… Complete | 100% | | IndexedDB Manager | โœ… Complete | 95% | | RDF Parser | โœ… Complete | 90% | | Graph Utilities | โœ… Complete | 85% | | React Hooks | ๐ŸŸก In Progress | 30% | | Visualizations | โณ Not Started | 0% | | UI Components | โณ Not Started | 0% | **Next Milestone**: Force-directed graph visualization (Week 3-4) ## ๐Ÿ› Known Issues None currently - project is in early development phase. ## ๐Ÿ“ License Part of the GLAM Heritage Custodian Ontology project. ## ๐Ÿ“ž Support For questions or issues, refer to: - Project documentation in `/docs/plan/frontend/` - Session summary: `SESSION_SUMMARY.md` - Master checklist: `/docs/plan/frontend/05-master-checklist.md` --- **Version**: 0.1.0 (Foundation Phase) **Last Updated**: 2024-11-22 **Status**: ๐Ÿšง Active Development