/** * Feedback UI Components for Detection Accuracy * Provides thumbs-up/down buttons, feedback forms, and missed detection reporting */ (function() { 'use strict'; var Feedback = { // State pendingFeedback: null, feedbackPanelVisible: false, // Event types EventTypes: { BLOB_DETECTION: 'blob_detection', ZONE_TRANSITION: 'zone_transition', FALL_ALERT: 'fall_alert', ANOMALY: 'anomaly' }, // Feedback types FeedbackTypes: { TRUE_POSITIVE: 'TRUE_POSITIVE', FALSE_POSITIVE: 'FALSE_POSITIVE', FALSE_NEGATIVE: 'FALSE_NEGATIVE', WRONG_IDENTITY: 'WRONG_IDENTITY', WRONG_ZONE: 'WRONG_ZONE' }, /** * Initialize the feedback module */ init: function() { this.createFeedbackPanel(); this.createMissedDetectionButton(); console.log('[Feedback] Module initialized'); }, /** * Create the feedback panel (hidden by default) */ createFeedbackPanel: function() { var panel = document.createElement('div'); panel.id = 'feedback-panel'; panel.className = 'feedback-panel'; panel.style.display = 'none'; panel.innerHTML = '\
What was wrong?
\ \\ The system detected motion here because:\ ' + linkName + '\'s signal (deltaRMS: ' + deltaRMS + ') exceeded the motion threshold by\ ' + ratio + 'x at ' + timestamp + '.\
\ '; // Add diagnostic info if available if (diagnosis) { explanationHTML += '\\ Possible cause: Ambient RF interference or environmental changes.\
\ '; } // Add additional contributing links if any if (contributingLinks.length > 1) { var linkNames = contributingLinks.slice(1).map(function(l) { return this.formatLinkID(l.link_id); }.bind(this)).join(', '); explanationHTML += '\\ Contributing links: ' + linkNames + '\
\ '; } // Add correction note explanationHTML += '\\ We\'ve noted this feedback and will apply corrections to improve future detection accuracy.\
\ '; } else { explanationHTML += '\\ The system detected motion based on signal patterns across multiple links.\ We\'ve noted this feedback to improve accuracy.\
\ '; } explanationHTML += '\