File size: 4,169 Bytes
62d9400
 
 
 
 
dddfc9a
62d9400
 
 
7f104ed
 
62d9400
7f104ed
62d9400
 
 
 
 
 
 
 
 
 
 
 
 
 
7f104ed
 
62d9400
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// Function to switch between screens
function showScreen(screenNumber) {
  // Hide all screens
  document.querySelectorAll('.screen').forEach(screen => {
    screen.classList.remove('active');
  });
  
  // Show the requested screen
  document.getElementById('screen' + screenNumber).classList.add('active');
}

// Handle form submission
function handleSubmit() {
  const response = document.getElementById('response').value.trim();
  
  if (response.length < 10) {
    alert('Please provide a more detailed response.');
    return;
  }
  
  // Analyze the response and provide feedback
  const feedback = analyzeResponse(response);
  
  // Display feedback
  document.getElementById('feedbackText').innerHTML = feedback;
  
  // Show feedback screen
  showScreen(4);
}

// Function to analyze caregiver response
function analyzeResponse(response) {
  // Convert to lowercase for easier matching
  const lowercaseResponse = response.toLowerCase();
  
  // Initialize score and feedback
  let score = 0;
  let positiveFeedback = [];
  let improvementFeedback = [];
  
  // Check for positive approaches
  if (lowercaseResponse.includes('calm') || lowercaseResponse.includes('gentle')) {
    score += 1;
    positiveFeedback.push('βœ“ Using a calm and gentle approach');
  } else {
    improvementFeedback.push('βœ— Consider using a calm and gentle tone');
  }
  
  if (lowercaseResponse.includes('distract') || lowercaseResponse.includes('redirect')) {
    score += 2;
    positiveFeedback.push('βœ“ Good use of redirection or distraction techniques');
  } else {
    improvementFeedback.push('βœ— Consider using redirection or distraction');
  }
  
  if (lowercaseResponse.includes('reassure') || lowercaseResponse.includes('comfort')) {
    score += 1;
    positiveFeedback.push('βœ“ Providing reassurance and comfort');
  }
  
  if (lowercaseResponse.includes('listen') || lowercaseResponse.includes('understand')) {
    score += 1;
    positiveFeedback.push('βœ“ Taking time to listen and understand concerns');
  }
  
  if (lowercaseResponse.includes('routine') || lowercaseResponse.includes('familiar')) {
    score += 1;
    positiveFeedback.push('βœ“ Recognizing the importance of routine or familiarity');
  }
  
  // Check for approaches to avoid
  if (lowercaseResponse.includes('force') || lowercaseResponse.includes('insist')) {
    score -= 1;
    improvementFeedback.push('βœ— Avoid forcing or insisting when someone with dementia is agitated');
  }
  
  if (lowercaseResponse.includes('argue') || lowercaseResponse.includes('reason with')) {
    score -= 1;
    improvementFeedback.push('βœ— Avoid arguing or using complex reasoning');
  }
  
  // Generate feedback based on score
  let feedbackHTML = '';
  
  if (score >= 3) {
    feedbackHTML += '<h3 class="feedback-positive">Great approach!</h3>';
  } else if (score >= 1) {
    feedbackHTML += '<h3 class="feedback-neutral">Good start, with room for improvement</h3>';
  } else {
    feedbackHTML += '<h3 class="feedback-negative">Consider a different approach</h3>';
  }
  
  // Add detailed feedback
  feedbackHTML += '<div class="feedback-details">';
  
  if (positiveFeedback.length > 0) {
    feedbackHTML += '<div class="feedback-section"><h4>What you did well:</h4><ul>';
    positiveFeedback.forEach(item => {
      feedbackHTML += `<li>${item}</li>`;
    });
    feedbackHTML += '</ul></div>';
  }
  
  if (improvementFeedback.length > 0) {
    feedbackHTML += '<div class="feedback-section"><h4>Suggestions for improvement:</h4><ul>';
    improvementFeedback.forEach(item => {
      feedbackHTML += `<li>${item}</li>`;
    });
    feedbackHTML += '</ul></div>';
  }
  
  // Add expert tips
  feedbackHTML += `
    <div class="feedback-section">
      <h4>Expert tips:</h4>
      <ul>
        <li>Approach from the front, maintain eye contact</li>
        <li>Use simple language and short sentences</li>
        <li>Allow extra time for responses</li>
        <li>Consider unmet needs (hunger, thirst, pain, toilet)</li>
        <li>Create a calm environment (reduce noise, appropriate lighting)</li>
      </ul>
    </div>
  `;
  
  feedbackHTML += '</div>';
  
  return feedbackHTML;
}