UnifiedAnalyticsService._filter_by_role tried queryset.filter(department=...) on
SurveyInstance which has no department FK → FieldError → 500 for dept_manager
and director users accessing the command center.
Fixed: check if the model actually has a department field before filtering;
fall back to hospital-level filtering for models without department.
Also: RBAC matrix test updated with more accurate state-based detection.