$ show catmaid/CATMAID
CATMAID (Collaborative Annotation Toolkit for Massive Amounts of Image Data) is a full-stack web application for collaborative connectomics research. It enables neuroscientists to trace neuron skeletons, annotate synapses, and analyze neural circuits across massive image stacks. The backend is a Django monolith with a REST API, PostgreSQL/PostGIS database, Celery for async tasks, and WebSockets for real-time collaboration. The frontend is a large JavaScript codebase using jQuery, Three.js, Pixi.js, D3, and custom widget system. Key features include skeleton tracing tools, 3D visualization, NBLAST neuron similarity, connectivity matrices, and review workflows. The codebase is well-structured with many reusable client-side utilities (event system, command pattern, caching, settings manager) and demonstrates strong engineering practices with CI/CD, tests, and Docker deployment. However, it carries some technical debt from vendored libraries and complex database migrations.
The LLM identified 6 files worth highlighting for reuse:
Implements optimistic concurrency control for collaborative editing by tracking edition times of objects. Provides GenericState, LocalState, NoCheckState classes that encapsulate state validation logic. Reusable in any collaborative application requiring conflict detection.
Provides an EventSource mixin that adds on/off/trigger methods to any object. Used throughout CATMAID for decoupled communication between widgets. Generic and extractable.
Implements an LRU cache with configurable maximum size, item lifetime, and memory-aware eviction (MemoryAwareLRUCache). Generic caching utility suitable for any JavaScript application.
Implements the Command pattern with Command, CommandHistory, and CommandStore classes. Supports undo/redo with ID mapping and state serialization. Generic undo/redo infrastructure.
Implements a cascading settings manager with scopes (default, global, project, user, session) and persistence via backend datastore. Supports migrations and locking. Reusable for any application needing layered configuration.
Implements a density hill clustering algorithm for partitioning points on a tree structure based on distance and density. Computes segregation index. The algorithm is generic and could be applied to any tree-structured data with spatial points.