high complexity extracted Organization Configuration & Multi-tenancy Confidence: 100%
8
Components
198
Shared
7
User Stories
Yes
Analyzed

Description

The platform must model fundamentally different organizational structures per tenant. NHF has the most complex hierarchy: 12 national associations, 9 regions, and approximately 1,400 local chapters, with members potentially belonging to up to 5 local chapters simultaneously. HLF and Blindeforbundet have their own regional and local structures. This feature provides the data model and admin UI to configure an organization's hierarchy (levels, names, parent-child relationships) and assign users to one or more nodes within it. The hierarchy drives reporting aggregation (activity data rolls up from local → regional → national), duplicate activity detection (NHF requirement: flag when the same event is registered by multiple coordinators at different levels), and access scoping (coordinators should only see data for their assigned chapter(s)). An admin portal view allows organization administrators to manage the hierarchy without developer intervention.

Analysis

Business Value

Without correct hierarchy modeling, Bufdir reporting aggregation is impossible and coordinators risk seeing or modifying data that belongs to other chapters. For NHF specifically, supporting multi-chapter membership directly unblocks a significant proportion of their active peer mentors who currently cannot be accurately represented in any digital system.

Implementation Notes

Use a recursive adjacency-list table in Supabase (`organization_units` with `parent_id`) to support arbitrary depth. User-to-unit assignments in a junction table with an `is_primary` flag. RLS policies must join through this table for all data access. For the multi-chapter NHF case, the UI should show a chapter-switcher (similar to workspace switching in Slack) rather than merging data across chapters. Duplicate detection can be a Supabase database trigger or a scheduled function comparing activity fingerprints within a time window.

Components (206)

User Interface (4)

Service Layer (1)

Data Layer (1)

Infrastructure (2)

Shared Components

These components are reused across multiple features

User Interface (59)

ui Role Switch Widget medium Shared ui Role-Aware Bottom Navigation medium Shared ui Activity Type Selection Screen low Shared ui Speech-to-Text Field Overlay medium Shared ui Receipt Capture Widget medium Shared ui Peer Mentor Single Selector low Shared ui Proxy Audit Badge Widget low Shared ui Export Period Picker low Shared ui Contact Card Widget low Shared ui Contact Search Bar low Shared ui Peer Mentor Card Widget low Shared ui Activity History List low Shared ui Multi-Chapter Affiliation Chip Widget medium Shared ui Certification Status Badge low Shared ui Duplicate Activity Warning Dialog medium Shared ui Mentor Multi-Select Widget medium Shared ui Map Filter Panel medium Shared ui Claim Status Badge low Shared ui Export Date Range Picker low Shared ui Custom Date Range Picker low Shared ui Duplicate Activity Warning Dialog low Shared ui Proxy Activity Form medium Shared ui Proxy Peer Mentor Selector medium Shared ui Expected Return Date Picker low Shared ui Pause Activation Screen low Shared ui Pause Status Indicator low Shared ui Admin KPI Stat Widget low Shared ui Organisation Hierarchy Navigator high Shared ui Bufdir Period Selector Widget low Shared ui Export History List medium Shared ui Activity Type Donut Chart medium Shared ui Monthly Activity Bar Chart medium Shared ui Statistics Period Filter Bar low Shared ui Statistics Summary Cards low Shared ui Notification Badge Widget low Shared ui Certificate Expiry Status Indicator low Shared ui Animated Stat Card Widget medium Shared ui In-App Notification Banner low Shared ui Accessible Modal Sheet Widget high Shared ui Live Region Announcer medium Shared ui Semantics Wrapper Widget medium Shared ui Sensitive Field Warning Dialog high Shared ui Confirm Before Submit Screen medium Shared ui Inline Contextual Help Widget low Shared ui Labelled Navigation Bar low Shared ui Plain Language Error Display low Shared ui Single-Action Screen Layout medium Shared ui Wizard Progress Indicator low Shared ui Accessible Text Style System medium Shared ui Accessible Touch Target Wrapper low Shared ui Contrast-Safe Color Palette Widget medium Shared ui Accessible Bottom Navigation Bar medium Shared ui Modal Close Button low Shared ui Persistent Back Button low Shared ui Vertical Scroll Container low Shared ui Organization Card Widget low Shared ui Terminology-Aware Text Widget low Shared ui FeatureGate Widget low Shared ui Chapter Switcher medium Shared

Service Layer (52)

service Authentication Service medium Shared service Authentication Session Manager medium Shared service Biometric Authentication Service medium Shared service Biometric Authentication Service medium Shared service Biometric Authentication Service medium Shared service Permission Checker Service medium Shared service Role State Manager medium Shared service No-Access Route Guard low Shared service Activity Type Metadata Resolver low Shared service Chapter Scope Resolver medium Shared service Organisation Hierarchy Resolver medium Shared service Coordinator Notification Service medium Shared service Duplicate Activity Detection Service high Shared service Mentor Filter Service low Shared service Receipt Threshold Validator low Shared service Approval Status Notification Service medium Shared service Threshold Evaluation Service medium Shared service Declaration Encryption Service high Shared service Organization Feature Flag Service low Shared service Participant Deduplication Service high Shared service Reporting Period Service medium Shared service Activity Attribution Service low Shared service Proxy Duplicate Detection Service medium Shared service Pause Management Service medium Shared service Pause Notification Service medium Shared service Admin Export Service medium Shared service Admin Row-Level Security Guard high Shared service Organisation Hierarchy Service high Shared service User Management Service high Shared service Role Access Validator low Shared service Peer Mentor Stats Aggregator medium Shared service Push Notification Dispatcher medium Shared service Notification Preference Service low Shared service Scenario Deep-Link Router medium Shared service Scenario Notification Content Builder medium Shared service Badge Criteria Integration medium Shared service Activity Summary Aggregator low Shared service Focus Management Service medium Shared service Screen Reader Detection Service medium Shared service Sensitive Field Privacy Guard high Shared service Plain Language Content Service medium Shared service Wizard State Manager medium Shared service Tab State Manager medium Shared service Organization Route Guard medium Shared service Tenant Context Service high Shared service Label Key Resolver Service low Shared service Organization Labels Notifier medium Shared service FeatureFlagProvider (Riverpod) medium Shared service Access Scope Service high Shared service Hierarchy Aggregation Service high Shared service Hierarchy Service high Shared service Unit Assignment Service medium Shared

Data Layer (33)

Infrastructure (54)

infrastructure Keyboard-Aware Layout Utility low Shared infrastructure Supabase Auth Client low Shared infrastructure Deep Link / OAuth Redirect Handler medium Shared infrastructure Secure Storage Adapter low Shared infrastructure Supabase Session Manager medium Shared infrastructure URL Launcher Utility low Shared infrastructure Local Storage Adapter low Shared infrastructure Supabase Activity Client low Shared infrastructure Organization Labels Provider low Shared infrastructure Supabase Client low Shared infrastructure Organisation Field Config Loader medium Shared infrastructure Speech-to-Text Adapter medium Shared infrastructure File Download Handler low Shared infrastructure Duplicate Reviewed Flag Middleware low Shared infrastructure Contact RLS Query Builder low Shared infrastructure Contact Form Validator low Shared infrastructure Design Token Theme low Shared infrastructure Organization Labels Provider low Shared infrastructure Supabase Client Provider low Shared infrastructure Search Debounce Utility low Shared infrastructure Expense Type Analytics Tracker low Shared infrastructure Receipt Image Picker Integration low Shared infrastructure CSV / JSON File Generator medium Shared infrastructure Coordinator Role Guard low Shared infrastructure Nightly Job Scheduler medium Shared infrastructure Supabase RLS Policy Configuration high Shared infrastructure Export File Storage Adapter low Shared infrastructure Supabase Storage Adapter low Shared infrastructure Peer Mentor Pause Management Service medium Shared infrastructure Push Notification Service medium Shared infrastructure fl_chart Adapter medium Shared infrastructure Push Notification Service low Shared infrastructure FCM Push Notification Sender medium Shared infrastructure FCM Notification Dispatcher medium Shared infrastructure Push Notification Dispatcher medium Shared infrastructure Supabase Realtime Subscription Service medium Shared infrastructure Organisation Data Isolation Guard low Shared infrastructure Push Notification Dispatcher medium Shared infrastructure Deep Link Handler medium Shared infrastructure QR Code Generator low Shared infrastructure Share Sheet Bridge low Shared infrastructure Semantics Service Facade medium Shared infrastructure Accessibility Design Token Enforcer medium Shared infrastructure Accessible Theme Builder medium Shared infrastructure Navigation Route Configuration medium Shared infrastructure Accessibility Live Region Announcer low Shared infrastructure Feature Flag Provider low Shared infrastructure Secure Storage Adapter low Shared infrastructure Supabase RLS Tenant Scope Configurator medium Shared infrastructure Label Key Registry low Shared infrastructure Terminology Riverpod Providers low Shared infrastructure WCAG Semantics Label Resolver low Shared infrastructure Feature Flag Key Constants low Shared infrastructure RLS Policy Manager high Shared

User Stories (7)

Validate Hierarchy Integrity Before Structural Changes
medium 5 pts

As a As an Organization Administrator

I want to receive automatic validation feedback before committing structural changes to the organizational hierarchy

So that I do not accidentally create orphaned units, circular references, or invalid organizational configurations that would break reporting and access control

Acceptance Criteria
  • Given I attempt to set a unit's parent to one of its own descendants, when I try to save, then validation blocks the save and displays a 'circular reference detected' error specifying the conflicting units
  • Given I deactivate a regional node that has active child chapters, when validation runs, then I receive a list of all child chapters that will be without a parent and must be reassigned before the change can be committed
  • Given I make a structural change that would invalidate existing RLS policies, when validation runs, then I am warned which user access scopes will be affected and given the option to review before proceeding
  • +2 more
View Full Story →
Detect and Resolve Duplicate Activity Registrations Across Chapters
medium 8 pts

As a As an Organization Administrator

I want to view and resolve cases where the same activity has been registered by multiple coordinators across different chapters

So that Bufdir reports and internal statistics are not inflated by duplicate activity counts

Acceptance Criteria
  • Given activities have been registered across multiple chapters, when the duplicate detector runs, then it surfaces records where the same peer mentor, date, activity type, and approximate duration appear in more than one chapter's activity log
  • Given a duplicate set is detected, when I open the duplicate review interface, then I see a side-by-side comparison of the duplicate records including which coordinator submitted each
  • Given I review a duplicate pair, when I mark one record as the canonical version, then the other is flagged as a duplicate and excluded from statistics and Bufdir aggregations
  • +2 more
View Full Story →
Assign and Reassign Users to Organizational Units
high 5 pts

As a As an Organization Administrator

I want to assign coordinators, peer mentors, and members to specific organizational units and reassign them as needed

So that each user's activities, access rights, and reporting are correctly scoped to the organizational unit they belong to

Acceptance Criteria
  • Given I am managing a peer mentor's profile, when I open the unit assignment panel, then I see all current organizational unit affiliations for that user
  • Given I add a new unit affiliation for a peer mentor, when the assignment is saved, then the peer mentor can immediately register activities attributed to the new unit
  • Given a peer mentor belongs to multiple chapters, when I view their activity history, then each activity is tagged with the chapter it was attributed to
  • +2 more
View Full Story →
Switch Active Chapter Context During Session
high 5 pts

As a As an Organization Administrator

I want to switch my active chapter context during a working session without logging out and back in

So that I can efficiently manage multiple chapters or regions in sequence without interrupting my workflow

Acceptance Criteria
  • Given I am an org admin overseeing multiple chapters, when I open the chapter switcher, then I see a list of all chapters I am authorized to administer
  • Given I select a different chapter from the switcher, when the selection is confirmed, then all data views (contacts, activities, statistics) refresh to show data scoped to the selected chapter
  • Given I have switched to a specific chapter context, when I register an activity or view reports, then all operations are attributed to or filtered by the active chapter
  • +2 more
View Full Story →
Edit Organizational Hierarchy Nodes and Structure
high 8 pts

As a As an Organization Administrator

I want to add, rename, move, and deactivate organizational units (chapters, regions, associations) within the hierarchy editor

So that I can keep the organizational structure accurate as local chapters merge, split, rename, or become inactive over time

Acceptance Criteria
  • Given I am viewing a hierarchy node, when I tap the edit action, then I can rename the unit, change its parent unit, or deactivate it
  • Given I attempt to deactivate a node that has active child units, when I confirm the action, then I receive a warning listing all child units that will be affected before proceeding
  • Given I add a new local chapter, when I save it, then it appears as a child of the selected parent region and is immediately visible in the hierarchy tree
  • +2 more
View Full Story →
Aggregate Statistics Across the Full Organizational Hierarchy
high 8 pts

As a As an Organization Administrator

I want to view aggregated activity statistics rolled up across all levels of the organizational hierarchy

So that I can assess overall organizational performance, identify underperforming units, and produce the data needed for national reporting

Acceptance Criteria
  • Given I am viewing the admin statistics dashboard, when I select a time period, then I see total activity counts, unique peer mentors active, and total hours logged rolled up across all chapters in my scope
  • Given I see a national or regional aggregated figure, when I tap on it, then I drill down to see the breakdown by child units contributing to that total
  • Given multiple organizations share the same backend, when I view aggregated statistics, then data from other organizations is never included in my organization's totals
  • +2 more
View Full Story →
View and Navigate Full Organizational Hierarchy Tree
critical 8 pts

As a As an Organization Administrator

I want to view and navigate the complete organizational hierarchy tree showing all national associations, regions, and local chapters

So that I can understand the full structural landscape of the organization and quickly locate any unit for management or reporting purposes

Acceptance Criteria
  • Given I am logged in as an org admin, when I navigate to the hierarchy admin portal, then I see the full organizational tree rendered with all levels (national → region → local chapter)
  • Given the hierarchy tree is displayed, when I tap on a parent node, then it expands to show all direct child units
  • Given the hierarchy tree is displayed, when I use the search input, then the tree filters to show only units whose name matches my search term with ancestors shown for context
  • +2 more
View Full Story →