Feature Specification: Organizational Chart Visualizer
1. Overview & Vision
The Org Chart Visualizer provides a clear, interactive representation of the company's reporting structure. It transforms flat employee data into a dynamic hierarchy, helping employees discover colleagues and understand departmental boundaries within the VENI-AI ecosystem.
2. Personas & Stakeholders
| Persona | Goal |
|---|---|
| Employee | Understand the company hierarchy and find reporting lines. |
| HR Admin | Audit reporting structures and identify gaps in management. |
| Executive | Visualize the entire organization for strategic planning. |
3. User Stories
- As an employee, I want to see who reports to the CTO so I can identify the right engineering manager to contact.
- As an HR Admin, I want to export the org chart to a PDF for our board meeting.
- As a user, I want to search for "Jane Doe" and have the chart automatically pan and zoom to her node.
4. Functional Requirements (FR)
- REQ-OC-001: Interactive top-down or left-to-right hierarchy tree.
- REQ-OC-002: Search within the chart with auto-focus/zoom.
- REQ-OC-003: Mini-profile cards on node click (Name, Title, Avatar).
- REQ-OC-004: Expand/Collapse branches for large organizations.
- REQ-OC-005: Drag-and-drop node repositioning — HR can reassign department membership and reporting lines directly on the chart canvas.
5. Non-Functional Requirements (NFR)
- Rendering: Smooth performance for up to 500 nodes (D3.js).
- Interactivity: Zoom and Pan MUST feel fluid (60fps).
6. Business Logic & Rules
- Data Transformation: The frontend builds a hierarchical JSON from a flat array using
managerIdreferences. - Root Discovery: The system automatically identifies the root node (employee with
managerId = null). - Isolation: Only active employees are shown in the chart by default.
- Drag-and-Drop Persistence: Dropping an employee node onto a new manager triggers a
PATCH /employees/:idcall updatingmanagerIdanddepartmentId; the chart re-renders optimistically.
7. User Interface (UI/UX)
- Canvas: Full-screen SVG drawing area.
- Controls: Floating toolbar for Search, Zoom In/Out, and Recenter.
- Node Design: Rounded cards with color-coded borders by department.
8. Information Architecture
- "Org Chart" link in the primary HRM navigation.
- Mini-chart preview on the Organization Settings page.
9. Data Model & Persistence
- Uses the core
employeesanddepartmentstables. - No dedicated table for the chart (computed in real-time).
10. API & Service Layer
GET /employees/org-chartEmployeeService.getOrgChart()performs a recursive database fetch or bulk fetch + frontend stratification.
11. Integration Patterns
- Library: Uses D3.js for the tree layout and force-directed positioning (optional).
- Navigation: Clicking "View Full Profile" on a node navigates to the Employee Profile feature.
12. Security & Permissions
- RBAC:
employees:readrequired to view the chart. - Privacy: Hidden employees (e.g., sensitive roles) are excluded from the JSON response.
13. Error Handling & Resilience
- Circular Check: Detects and alerts if circular reporting is found in the data.
- Empty State: Friendly message if no employees are registered.
14. Performance & Scalability
- Large charts use "Level of Detail" (LOD) to hide avatars when zoomed far out.
- Incremental loading for organizations with 1000+ employees (planned).
15. Globalization & i18n
- Localized search and UI controls.
16. Accessibility (a11y)
- Screen reader support for searching and selecting nodes.
- High-contrast mode for the SVG connections.
17. Observability & Analytics
- Tracking of "Most Visited Branches" to understand internal discovery patterns.
18. Testing & Quality
- Visual regression testing for node layouts.
- Performance profiling for large-tree rendering.
19. Constraints & Assumptions
- Assumes every employee (except the CEO) has a valid
managerId.
20. Future Enhancements
- Export to PNG/PDF.
- Matrix management (dotted-line reporting).
- Historical "Time Travel" view (org structure as of Date X).