Last Updated: 2025-11-25
Problem: System has BOTH programs and program_modules tables, causing hierarchy confusion
Current State:
- ✅
program_modulestable exists (CORRECT - maps to ClickUp Spaces) - ❌
programstable exists (REDUNDANT - duplicate structure) - ❌ Backend uses
programstable instead ofprogram_modules - ❌ Frontend calls
/api/programswhich queries wrong table
Expected Hierarchy (from mapping doc):
organizations (Top Level)
↓
program_modules (Level 1 - ClickUp Space) ← Should be using this!
↓
sub_programs (Level 2 - ClickUp Folder)
↓
project_components (Level 3 - ClickUp List)
↓
activities (Level 4 - ClickUp Task)
Current Implementation:
programs (WRONG TABLE) ← Backend is using this
↓
??? (No proper connection to sub_programs)
Fix Required:
- Update backend to use
program_modulesinstead ofprograms - Migrate all routes from
/api/programsto/api/program-modulesOR update queries - Update frontend to use correct API endpoints
- Deprecate/remove
programstable after migration - Update foreign keys if any tables reference
programs
Problem: There's a projects table that doesn't fit the hierarchy
Current State:
- ✅
sub_programstable exists (Level 2 - CORRECT) - ❌
projectstable also exists (REDUNDANT - unclear purpose)
Fix Required:
- Determine if
projectstable is in use - Migrate data if needed
- Remove
projectstable to avoid confusion
Table: program_modules
Status: ✅ Database structure CORRECT | ❌ Backend implementation WRONG
- ✅ Correct table structure exists
- ✅ Has organization_id foreign key
- ✅ Has clickup_space_id for sync
- ✅ Contains 5 modules as per spec:
- Food, Water & Environment
- Socio-Economic Empowerment
- Gender, Youth & Peace
- Relief & Charitable Services
- Capacity Building
- ❌ Backend queries
programstable instead ofprogram_modules - ❌ Repository at
backend/modules/programs/program.repository.jsuses wrong table - ❌ Routes at
backend/routes/programs.routes.js(if exists) need update
- ✅ Programs.tsx component exists
- ❌ Fetches from
/api/programs(wrong endpoint) - ✅ Has statistics dashboard
- ✅ Has Settings navigation button
Actions Required:
- Update
program.repository.jsto queryprogram_modules - Update all
FROM programstoFROM program_modules - Test all program-related endpoints
- Verify frontend displays correct data
Table: sub_programs
Status: ✅ IMPLEMENTED CORRECTLY
- ✅ Correct foreign key to
module_id(program_modules) - ✅ Has clickup_folder_id for sync
- ✅ Includes all required fields (budget, dates, manager, etc.)
- ✅ Soft delete support (deleted_at)
- ✅ Backend service implemented
- ✅ CRUD endpoints working
- ✅ Statistics methods implemented
- ✅ SubPrograms.tsx component implemented
- ✅ Create/View/Edit functionality
- ✅ Statistics dashboard showing program-level data
- ✅ Breadcrumb navigation
Actions Required:
- Verify module_id filtering works after fixing Level 1
- Test navigation from program_modules to sub_programs
Table: project_components
Status: ✅ IMPLEMENTED CORRECTLY
- ✅ Correct foreign key to
sub_program_id - ✅ Has clickup_list_id for sync
- ✅ Includes progress tracking
- ✅ Soft delete support
- ✅ Backend service implemented
- ✅ CRUD endpoints working
- ✅ Statistics methods for sub-program level
- ✅ ProjectComponents.tsx component implemented
- ✅ Create/View/Edit functionality
- ✅ Statistics dashboard showing sub-program statistics
- ✅ Breadcrumb navigation
Actions Required:
- Component implementation complete
- Test full hierarchy navigation
Table: activities
Status: ✅ MOSTLY IMPLEMENTED |
- ✅ Correct foreign key to
component_id - ✅ Also has
project_idFK to sub_programs (for direct reference) - ✅ Comprehensive activity fields (location, dates, facilitators, etc.)
- ✅ Approval workflow fields (approval_status, priority)
- ✅ Beneficiary tracking fields
- ✅ Budget tracking
- ✅ Has clickup_list_id for sync (should be clickup_task_id?)
- ❌ Activity date column added but may need index optimization
- ✅ Soft delete support
- ✅ Backend service implemented
- ✅ CRUD endpoints working
- ✅ Approval workflow (submit/approve/reject) implemented
- ✅ Status management
- ✅ Statistics methods for component level
- ✅ Workflow settings validation integrated
- ✅ Activities.tsx component implemented
- ✅ Create/View/Edit functionality via modals
- ✅ ActivityDetailsModal with full activity details
- ✅ AddActivityModal for creation
- ✅ Inline status dropdown for quick changes
- ✅ Submit for approval button
- ✅ View/Edit/Delete actions
- ✅ Statistics dashboard showing component statistics
- ✅ Approval status badges
- ✅ Filtering by status and approval status
- ✅ Breadcrumb navigation
- ✅ Workflow validation before edit
- ✅ Workflow validation before status change
Actions Required:
- Rename
clickup_list_idtoclickup_task_idfor clarity - Implement sub-activities (Level 4.1)
- Implement activity checklists UI (Level 4.2)
Table: sub_activities (mentioned in hierarchy doc)
Status: ❌ NOT IMPLEMENTED
- ❌ Table not found in schema
- ❓ May need to create table structure
CREATE TABLE sub_activities (
id INT PRIMARY KEY AUTO_INCREMENT,
parent_activity_id INT NOT NULL,
name VARCHAR(255) NOT NULL,
description TEXT,
status ENUM('not-started', 'in-progress', 'completed'),
assigned_to VARCHAR(255),
clickup_subtask_id VARCHAR(50),
sync_status ENUM('synced', 'pending', 'error'),
created_at TIMESTAMP,
updated_at TIMESTAMP,
FOREIGN KEY (parent_activity_id) REFERENCES activities(id) ON DELETE CASCADE
);Actions Required:
- Create
sub_activitiestable - Implement backend CRUD for sub-activities
- Add UI to ActivityDetailsModal for managing sub-activities
- Add ClickUp sync support
Table: activity_checklists
Status: ✅ Database exists | ❌ UI not implemented
- ✅ Table exists with correct structure
- ✅ Foreign key to
activity_id - ✅ Has completion tracking (is_completed, completed_at)
- ✅ Has clickup_checklist_id and clickup_checklist_item_id for sync
- ✅ Order index for sorting
- ❌ CRUD endpoints not implemented
- ❌ No service layer for checklists
- ❌ No UI for managing checklists
- ❌ Not shown in ActivityDetailsModal
Actions Required:
- Create backend service for activity_checklists
- Implement CRUD endpoints
- Add checklist UI to ActivityDetailsModal
- Add ability to create/edit/delete checklist items
- Add completion tracking UI
- Show progress based on completed items
Table: beneficiaries
Status: ✅ Database exists | ❌ UI not implemented
- ✅ Comprehensive beneficiary fields
- ✅ Demographics tracking (gender, age, age_group)
- ✅ Location fields (parish, ward, county)
- ✅ Vulnerability tracking
- ✅ JSON fields for extended data
- ❓ Unknown if CRUD endpoints exist
- ❌ No beneficiaries management UI
- ❌ Not linked to activities yet
Actions Required:
- Implement beneficiary management UI
- Create beneficiary registration form
- Link beneficiaries to activities
- Show beneficiary list in activities
- Implement beneficiary search and filtering
Table: activity_beneficiaries
Status: ✅ Database exists | ❌ UI not implemented
- ✅ Junction table with proper foreign keys
- ✅ Role tracking (participant, facilitator, observer)
- ✅ Attendance tracking
- ❌ No UI for linking beneficiaries to activities
- ❌ No attendance tracking UI
Actions Required:
- Add beneficiary selection to activity forms
- Implement attendance tracking UI
- Show linked beneficiaries in ActivityDetailsModal
- Add role assignment (participant/facilitator/observer)
Table: attachments
Status: ✅ Database exists | ❌ UI not implemented
- ✅ Generic attachment system (entity_type, entity_id)
- ✅ Supports multiple entity types (activity, goal, indicator, etc.)
- ✅ File metadata (name, type, size, url)
- ✅ Attachment categorization (photo, document, report, etc.)
- ✅ Has clickup_attachment_id for sync
- ❌ No file upload UI
- ❌ No attachment management
Actions Required:
- Implement file upload functionality
- Add attachment UI to ActivityDetailsModal
- Support photo uploads from field activities
- Add document upload (attendance sheets, reports)
- Implement attachment preview/download
- Add ClickUp sync for attachments
Table: comments
Status: ✅ Database exists | ❌ UI not implemented
- ✅ Generic comment system (entity_type, entity_id)
- ✅ Comment categorization (update, challenge, lesson_learned, etc.)
- ✅ User tracking
- ✅ Has clickup_comment_id for sync
- ❌ No comments UI
- ❌ No activity updates/notes section
Actions Required:
- Add comments section to ActivityDetailsModal
- Implement comment threading
- Add comment categorization UI
- Show comment history
- Add approval feedback as comments
- Sync comments with ClickUp
Table: activity_expenses
Status: ✅ Database exists | ❌ UI not implemented
- ✅ Expense tracking fields
- ✅ Receipt tracking
- ✅ Approval workflow
- ✅ Category and description
- ❌ No expense tracking UI
- ❌ Not shown in activities
Actions Required:
- Add expense tracking UI to ActivityDetailsModal
- Implement expense entry form
- Add receipt upload capability
- Show total expenses vs budget
- Implement expense approval workflow
Table: locations
Status: ✅ Database exists | ❌ Not fully utilized
- ✅ Hierarchical location structure (parent_id)
- ✅ Location types (country, county, sub_county, ward, parish)
- ✅ GPS coordinates support
- ✅ Boundary data (JSON)
- ❌ Activities use text fields for location instead of foreign keys
- ❌ No location management UI
- ❌ No location hierarchy selector
Actions Required:
- Populate locations table with Kenya geographic data
- Create location management UI
- Implement cascading location dropdowns
- Update activities to use location_id instead of text fields
- Add GPS coordinate capture
- Implement location-based reporting
Table: goal_categories
Status: ✅ Database exists | ❌ Not implemented
- ✅ Correct foreign key to organization_id
- ✅ Period tracking
- ✅ Has clickup_goal_folder_id for sync
- ❌ No backend implementation
- ❌ No frontend UI
Actions Required:
- Create goal categories management UI
- Implement CRUD operations
- Add period selectors (Annual, Quarterly, etc.)
Table: strategic_goals
Status: ✅ Database exists | ❌ Not implemented
- Goal name and description
- Owner/manager assignment
- Timeline tracking
- Progress calculation
- Link to goal category
- ClickUp goal sync
Actions Required:
- Create strategic goals UI
- Implement goal creation and management
- Add owner assignment
- Implement progress tracking dashboard
- Link goals to indicators
Table: indicators
Status: ✅ Database exists | ❌ Not implemented
- ✅ Supports 4 indicator types (numeric, financial, binary, activity_linked)
- ✅ Target and current value tracking
- ✅ Progress calculation
- ✅ Unit specification
- ✅ Automatic vs manual tracking
- ✅ Has clickup_target_id for sync
- ❌ No backend implementation
- ❌ No frontend UI
- ❌ Activity linking not implemented
Actions Required:
- Create indicator management UI
- Implement indicator type selector
- Add numeric indicator tracking
- Add financial indicator tracking
- Add binary (Yes/No) indicator tracking
- Add activity-linked indicator auto-calculation
- Implement progress dashboard
- Create indicator reports
Table: indicator_activity_links
Status: ✅ Database exists | ❌ Not implemented
- ✅ Junction table with proper foreign keys
- ✅ Active/inactive tracking
Actions Required:
- Implement UI to link indicators to activities
- Auto-calculate indicator progress from linked activities
- Show linked indicators in activity details
- Update indicator values when activities complete
Status: ✅ IMPLEMENTED
- ✅ Draft → Submitted → Approved/Rejected states
- ✅ Submit for approval button
- ✅ Approval status badges
- ✅ Backend endpoints for approve/reject
- ✅ Approvals page showing pending activities
- ✅ Settings service with validation methods
- ✅ Configurable workflow rules
- ✅ Lock rejected activities (default: ON)
- ✅ Lock approved activities option
- ✅ Require approval before completion option
- ✅ Settings UI page implemented
- ✅ Validation integrated into Activities component
- ✅ Validation integrated into ActivityDetailsModal
- ✅ Validation integrated into Approvals component
Actions Required:
- Add rejection reason display in activity details
- Implement approval notifications
- Add approval history/audit log
- Implement multi-level approval if needed
Table: sync_config
Status: ✅ Database exists | ❌ Not implemented
Actions Required:
- Create sync configuration UI
- Implement ClickUp API token management (encrypted)
- Add webhook secret configuration
- Test ClickUp API connection
- Implement sync status dashboard
Table: clickup_mapping
Status: ✅ Database exists | ❌ Not implemented
- ✅ Maps local entities to ClickUp entities
- ✅ Supports all hierarchy levels
- ✅ Mapping status tracking
- ✅ Verification timestamp
Actions Required:
- Implement initial sync/mapping process
- Create mapping management UI
- Implement sync status verification
- Add broken mapping detection
- Implement re-sync functionality
- Implement program_modules sync
- Map to ClickUp Spaces
- Sync module metadata
- Handle bidirectional updates
- Implement sub_programs sync
- Map to ClickUp Folders within Spaces
- Sync budget and dates
- Handle status updates
- Implement project_components sync
- Map to ClickUp Lists within Folders
- Sync progress percentage
- Handle component updates
- Implement activities sync
- Map to ClickUp Tasks within Lists
- Sync all activity fields as custom fields
- Handle approval status in ClickUp
- Sync activity dates and locations
- Sync beneficiary counts
- Implement sub-activity sync
- Map to ClickUp Subtasks
- Implement checklist sync
- Map to ClickUp Checklist items
- Sync completion status
- Implement goal sync
- Map to ClickUp Goals
- Sync progress automatically
- Implement indicator sync
- Map to ClickUp Targets/Key Results
- Sync current values and progress
- Implement attachment sync
- Upload files to ClickUp
- Sync attachment metadata
- Implement comment sync
- Map to ClickUp Comments
- Handle bidirectional sync
Status: ✅ PARTIALLY IMPLEMENTED
- ✅ Overall statistics dashboard on Programs page
- ✅ Sub-programs count
- ✅ Components count
- ✅ Activities count
- ✅ Overall progress percentage
- ✅ Activity status breakdown
Actions Required:
- Add beneficiary reach statistics
- Add budget utilization charts
- Add geographic coverage map
- Add trend analysis over time
Status: ❌ NOT IMPLEMENTED
Actions Required:
- Monthly activity summary report
- Quarterly progress reports
- Annual performance reports
- Donor-specific reports
- Export to Excel/PDF
Status: ❌ NOT IMPLEMENTED
Actions Required:
- Strategic goals progress dashboard
- Indicator tracking reports
- Target vs actual analysis
- Trend analysis charts
Status: ❌ NOT IMPLEMENTED
Actions Required:
- Data quality assessment reports
- Indicator achievement rates
- Lessons learned compilation
- Best practices documentation
Status: ✅ IMPLEMENTED
- ✅ Breadcrumb navigation at all levels
- ✅ Back buttons
- ✅ Hierarchical drilling (Programs → Sub-Programs → Components → Activities)
Actions Required:
- Add sidebar navigation
- Add quick access menu
- Implement search functionality across hierarchy
Status: ✅ IMPLEMENTED
- ✅ Mobile-responsive design
- ✅ Responsive tables
- ✅ Touch-friendly buttons
- ✅ Responsive modals
Status:
Actions Required:
- Add loading states for all async operations
- Implement toast notifications instead of alerts
- Add confirmation dialogs with better UX
- Implement form validation with clear error messages
- Add success/error feedback for all operations
- Implement keyboard shortcuts
- Add tooltips for complex features
Table: users (mentioned in hierarchy doc)
Status: ❓ UNKNOWN
Actions Required:
- Verify users table exists
- Implement user authentication
- Implement role-based access control (RBAC)
- Add user roles (Admin, M&E Officer, Field Officer, Viewer)
- Implement permission system
- Add user management UI
Status: ❌ NOT IMPLEMENTED
Actions Required:
- Create audit_log table
- Log all create/update/delete operations
- Track user actions
- Log approval/rejection actions
- Implement audit log viewer
Status: ❌ NOT IMPLEMENTED
Actions Required:
- Create time_entries table
- Implement time logging UI
- Track staff hours on activities
- Track volunteer hours
- Generate time reports
- Sync with ClickUp time tracking
Status: ❌ NOT IMPLEMENTED
Actions Required:
- Implement notification system
- Email notifications for approval requests
- Email notifications for rejections
- Email notifications for status changes
- In-app notifications
- Notification preferences (from workflow settings)
- Fix program_modules vs programs table inconsistency
- Update backend to use program_modules
- Update frontend to use correct endpoints
- Test full hierarchy navigation
- Remove redundant tables
- Implement sub-activities
- Implement activity checklists UI
- Implement beneficiary management
- Implement attachments & file uploads
- Implement comments system
- Implement expense tracking
- Improve location management
- Implement goal categories
- Implement strategic goals
- Implement indicators (all 4 types)
- Implement indicator-activity linking
- Implement auto-calculation for activity-linked indicators
- Build performance dashboards
- Build comprehensive dashboards
- Implement report generation
- Add data export functionality
- Implement geographic mapping
- Add trend analysis
- Set up ClickUp API configuration
- Implement sync mapping
- Sync program_modules → Spaces
- Sync sub_programs → Folders
- Sync components → Lists
- Sync activities → Tasks
- Sync sub-activities → Subtasks
- Sync checklists
- Sync goals and indicators
- Sync attachments and comments
- Implement bidirectional sync
- Add webhook handlers
- Implement conflict resolution
- User authentication and RBAC
- Audit logging
- Time tracking
- Notifications system
- Advanced search
- Mobile app (if needed)
- Offline capability
- ✅ Fix workflow settings initialization (COMPLETED)
- ❌ Fix program_modules vs programs table hierarchy mismatch
- ❌ Update all backend queries to use correct tables
- ❌ Test full hierarchy after fix
- ❌ Complete activity-level features (checklists, sub-activities)
- ❌ Implement beneficiary management
- ❌ Implement attachments and file uploads
- ❌ Implement comments system
- ❌ Improve location management with cascading dropdowns
- ❌ Implement strategic goals and performance tracking
- ❌ Build comprehensive reporting and dashboards
- ❌ Implement user authentication and RBAC
- ❌ Implement full ClickUp bidirectional sync
- ❌ Implement webhook handlers
- ❌ Build advanced analytics and insights
The system will be considered complete when:
- ✅ All hierarchy levels properly implemented and aligned
- ✅ Full CRUD operations at all levels
- ✅ Workflow and approval system functioning
- ✅ Beneficiary tracking implemented
- ✅ Attachments and evidence management working
- ✅ Strategic goals and indicators tracking active
- ✅ Comprehensive dashboards and reports available
- ✅ ClickUp sync operational (bidirectional)
- ✅ User authentication and permissions in place
- ✅ System is production-ready and stable
This checklist is a living document and should be updated as implementation progresses.