Appearance
Connection Management
This document provides a comprehensive overview of the connection management system in Family Shapes, including the data model, implementation details, and key features.
Overview
The connection system is a core component of Family Shapes, enabling the representation of relationships between people, donors, and families. It supports various relationship types and provides the foundation for family tree visualization.
Data Model
Connections in Family Shapes are represented by the following key tables:
- connections: Core relationship data between people
- connection_types: Defines the types of relationships (parent-child, donor-recipient, etc.)
- connection_metadata: Additional data associated with connections
- connection_visibility: Controls who can see specific connections
Key Features
Connection Creation and Management
- Standardized Connection Interface: Unified interface for creating and managing connections
- Relationship Type Support: Support for various relationship types including biological, donor, and social relationships
- Bidirectional Relationships: Automatic creation of reciprocal relationships when appropriate
- Validation Rules: Ensures data integrity and prevents invalid relationships
Connection Visualization
- Family Tree Integration: Connections form the basis of family tree visualization
- Layout Algorithms: Support for different layout algorithms based on connection types
- Interactive Editing: Real-time editing of connections in the family tree view
- Filtering Options: Ability to filter connections by type, visibility, and other criteria
Connection Data Consolidation
- Duplicate Detection: Identification and resolution of duplicate connections
- Data Normalization: Ensures consistent representation of relationships
- Migration Support: Tools for migrating legacy connection data to the new model
Implementation Details
Connection Service
The ConnectionService provides the following key methods:
typescript
// Create a new connection between two people
createConnection(fromPersonId: string, toPersonId: string, type: ConnectionType, metadata?: ConnectionMetadata): Promise<Connection>
// Get all connections for a person
getConnectionsForPerson(personId: string, options?: ConnectionQueryOptions): Promise<Connection[]>
// Get all connections for a family tree
getConnectionsForFamilyTree(treeId: string): Promise<Connection[]>
// Update an existing connection
updateConnection(connectionId: string, updates: Partial<Connection>): Promise<Connection>
// Delete a connection
deleteConnection(connectionId: string): Promise<void>
// Clean up duplicate connections
cleanupDuplicateConnections(personId: string): Promise<CleanupResult>Connection Types
The system supports the following connection types:
- Biological Parent-Child: Biological relationship between parent and child
- Donor-Recipient: Relationship between donor and recipient
- Social Parent-Child: Non-biological parenting relationship
- Partner: Relationship between partners (marriage, domestic partnership, etc.)
- Sibling: Relationship between siblings
- Half-Sibling: Relationship between half-siblings
- Donor-Sibling: Relationship between people who share a donor
Connection Visibility
Connections can have different visibility settings:
- Public: Visible to all users with access to the family tree
- Private: Visible only to the people directly involved in the connection
- Organization: Visible only to members of the organization
- Custom: Visibility controlled by custom rules
Performance Considerations
- Efficient Querying: Optimized database queries for connection retrieval
- Caching Strategy: React Query caching for frequently accessed connections
- Batch Operations: Support for batch creation and updates of connections
- Lazy Loading: Loading connections on demand to improve performance
Future Enhancements
- Advanced Filtering: More sophisticated filtering options for connections
- Temporal Connections: Support for time-based relationship changes
- Connection Templates: Predefined connection patterns for common family structures
- Bulk Editing: Tools for editing multiple connections simultaneously