=> {
+ const checks: HealthCheck[] = [];
+
+ // Check Taxonomy endpoint
+ try {
+ const { response: taxonomyResp, data: taxonomyData } = await apiCall('/v1/writer/taxonomy/');
+
+ if (taxonomyResp.ok && taxonomyData?.success !== false) {
+ checks.push({
+ name: 'Taxonomy System',
+ description: 'Content taxonomy endpoint',
+ status: 'healthy',
+ message: `Found ${taxonomyData?.count || 0} taxonomy items`,
+ lastChecked: new Date().toISOString(),
+ });
+ } else {
+ checks.push({
+ name: 'Taxonomy System',
+ description: 'Content taxonomy endpoint',
+ status: 'error',
+ message: taxonomyData?.error || `Failed with ${taxonomyResp.status}`,
+ details: 'Check ContentTaxonomyRelation through model and field mappings',
+ lastChecked: new Date().toISOString(),
+ });
+ }
+ } catch (error: any) {
+ checks.push({
+ name: 'Taxonomy System',
+ description: 'Content taxonomy endpoint',
+ status: 'error',
+ message: error.message || 'Network error',
+ lastChecked: new Date().toISOString(),
+ });
+ }
+
+ return checks;
+ }, []);
+
+ // Run all health checks
+ const runAllChecks = useCallback(async () => {
+ setLoading(true);
+
+ try {
+ // Run schema check first
+ const schemaCheck = await checkDatabaseSchemaMapping();
+
+ // Run module checks in parallel
+ const [writerChecks, plannerChecks, sitesChecks, integrationChecks, contentMgrChecks] = await Promise.all([
+ checkWriterModule(),
+ checkPlannerModule(),
+ checkSitesModule(),
+ checkIntegrationModule(),
+ checkContentManagerModule(),
+ ]);
+
+ // Build module health results
+ const moduleHealthResults: ModuleHealth[] = [
+ {
+ module: 'Database Schema',
+ description: 'Critical database field mapping checks',
+ checks: [schemaCheck],
+ },
+ {
+ module: 'Writer Module',
+ description: 'Content creation and task management',
+ checks: writerChecks,
+ },
+ {
+ module: 'Planner Module',
+ description: 'Keyword clustering and content planning',
+ checks: plannerChecks,
+ },
+ {
+ module: 'Sites Module',
+ description: 'Site management and configuration',
+ checks: sitesChecks,
+ },
+ {
+ module: 'Integration Module',
+ description: 'External platform sync (WordPress, etc.)',
+ checks: integrationChecks,
+ },
+ {
+ module: 'Content Manager',
+ description: 'Taxonomy and content organization',
+ checks: contentMgrChecks,
+ },
+ ];
+
+ setModuleHealths(moduleHealthResults);
+ } catch (error) {
+ console.error('Failed to run health checks:', error);
+ } finally {
+ setLoading(false);
+ }
+ }, [
+ checkDatabaseSchemaMapping,
+ checkWriterModule,
+ checkPlannerModule,
+ checkSitesModule,
+ checkIntegrationModule,
+ checkContentManagerModule,
+ ]);
+
+ // Run checks on mount
+ useEffect(() => {
+ runAllChecks();
+ }, [runAllChecks]);
+
+ // Calculate module status
+ const getModuleStatus = (module: ModuleHealth): 'error' | 'warning' | 'healthy' => {
+ const statuses = module.checks.map(c => c.status);
+ if (statuses.some(s => s === 'error')) return 'error';
+ if (statuses.some(s => s === 'warning')) return 'warning';
+ return 'healthy';
+ };
+
+ // Calculate overall health
+ const getOverallHealth = () => {
+ const allStatuses = moduleHealths.flatMap(m => m.checks.map(c => c.status));
+ const total = allStatuses.length;
+ const healthy = allStatuses.filter(s => s === 'healthy').length;
+ const warning = allStatuses.filter(s => s === 'warning').length;
+ const error = allStatuses.filter(s => s === 'error').length;
+
+ let status: 'error' | 'warning' | 'healthy' = 'healthy';
+ if (error > 0) status = 'error';
+ else if (warning > 0) status = 'warning';
+
+ return { total, healthy, warning, error, status, percentage: total > 0 ? Math.round((healthy / total) * 100) : 0 };
+ };
+
+ const overallHealth = getOverallHealth();
+
+ return (
+ <>
+
+
+
+ {/* Header */}
+
+
+
Debug Status
+
+ Comprehensive health checks for all modules and recent bug fixes
+
+
+
+ {loading ? 'Running Checks...' : 'Refresh All'}
+
+
+
+ {/* Overall Health Summary */}
+
+ Overall System Health
+
+ {getStatusIcon(overallHealth.status)}
+
+
+ }
+ desc={
+ overallHealth.status === 'error'
+ ? `${overallHealth.error} critical issue${overallHealth.error !== 1 ? 's' : ''} detected`
+ : overallHealth.status === 'warning'
+ ? `${overallHealth.warning} warning${overallHealth.warning !== 1 ? 's' : ''} detected`
+ : 'All systems operational'
+ }
+ >
+
+ {/* Health Percentage */}
+
+
+ {overallHealth.percentage}%
+
+
+ {overallHealth.healthy} of {overallHealth.total} checks passed
+
+
+
+ {/* Health Breakdown */}
+
+
+
+ {overallHealth.healthy}
+
+
Healthy
+
+
+
+ {overallHealth.warning}
+
+
Warnings
+
+
+
+ {overallHealth.error}
+
+
Errors
+
+
+
+
+
+ {/* Module Health Cards */}
+
+ {moduleHealths.map((moduleHealth, index) => {
+ const moduleStatus = getModuleStatus(moduleHealth);
+ const healthyCount = moduleHealth.checks.filter(c => c.status === 'healthy').length;
+ const totalCount = moduleHealth.checks.length;
+
+ return (
+
+ {moduleHealth.module}
+
+ {getStatusIcon(moduleStatus)}
+
+
+ }
+ desc={
+ moduleStatus === 'error'
+ ? `Issues detected - ${healthyCount}/${totalCount} checks passed`
+ : moduleStatus === 'warning'
+ ? `Warnings detected - ${healthyCount}/${totalCount} checks passed`
+ : `All ${totalCount} checks passed`
+ }
+ >
+
+
+ {moduleHealth.description}
+
+
+ {/* Health Checks List */}
+ {moduleHealth.checks.map((check, checkIndex) => (
+
+
+
+ {getStatusIcon(check.status)}
+
+
+
+
+ {check.name}
+
+
+ {check.status}
+
+
+
+ {check.description}
+
+ {check.message && (
+
+ {check.message}
+
+ )}
+ {check.details && (
+
+ 💡 {check.details}
+
+ )}
+
+
+
+ ))}
+
+
+ );
+ })}
+
+
+ {/* Help Section */}
+
+
+
+
+ Database Schema Mapping Errors
+
+
+ If you see errors about missing fields like entity_type,
+ cluster_role, or
+ html_content:
+
+
+ Check that model fields have correct db_column attributes
+ Verify database columns exist with SELECT column_name FROM information_schema.columns
+ Review DATABASE_SCHEMA_FIELD_MAPPING_GUIDE.md in repo root
+
+
+
+
+
+ Field Reference Errors in Code
+
+
+ If API endpoints return 500 errors with AttributeError or similar:
+
+
+ Search codebase for old field names: entity_type, cluster_role, html_content
+ Replace with new names: content_type, content_structure, content_html
+ Check views, services, and serializers in writer/planner/integration modules
+
+
+
+
+
+ All Checks Passing?
+
+
+ Great! Your system is healthy. This page will help you quickly diagnose issues if they appear in the future.
+ Bookmark this page and check it first when troubleshooting module-specific problems.
+
+
+
+
+
+ >
+ );
+}
diff --git a/frontend/src/pages/Writer/Tasks.tsx b/frontend/src/pages/Writer/Tasks.tsx
index b4252d9a..39a12904 100644
--- a/frontend/src/pages/Writer/Tasks.tsx
+++ b/frontend/src/pages/Writer/Tasks.tsx
@@ -164,7 +164,7 @@ export default function Tasks() {
setShowContent(true);
setLoading(false);
}
- }, [currentPage, statusFilter, clusterFilter, structureFilter, typeFilter, entityTypeFilter, sortBy, sortDirection, searchTerm, activeSector, pageSize]);
+ }, [currentPage, statusFilter, clusterFilter, structureFilter, typeFilter, sortBy, sortDirection, searchTerm, activeSector, pageSize]);
useEffect(() => {
loadTasks();
@@ -513,7 +513,7 @@ export default function Tasks() {
setTypeFilter,
setCurrentPage,
});
- }, [clusters, activeSector, formData, searchTerm, statusFilter, clusterFilter, structureFilter, typeFilter, sourceFilter, entityTypeFilter]);
+ }, [clusters, activeSector, formData, searchTerm, statusFilter, clusterFilter, structureFilter, typeFilter, sourceFilter]);
// Calculate header metrics
const headerMetrics = useMemo(() => {