System Details
Calculations
Pulse Score Calculation - Done
11 min
this outlines the procedure for calculating the "pulse" score, a composite satisfaction metric, each time a survey response is submitted input the function receives three inputs representing the survey response data faceratings array\<number | null> an array of numeric values representing responses to the face rating questions (up to 10 questions) each element corresponds to a single question and can have one of the following values 100 positive (happy face) 50 neutral (meh face) 0 negative (unhappy face) 1 n/a (circle with dash) null question was not answered npsscore number an integer between 0 and 10 (inclusive), representing the respondent's answer to the "would you refer" (nps) question comments array\<string> an array of strings, representing any comments provided by the respondent the array can be empty (no comments) or contain one or more strings output pulsescore number a floating point number between 0 and 100 (inclusive), representing the overall satisfaction percentage (the pulse score) calculating pulse score (individual response) calculation steps note only calculate based on score 0 100 do not include n/a or null questions in calculations calculate face score initialize facesum = 0 initialize facecount = 0 iterate through the faceratings array for each rating in faceratings if rating !== null facesum += rating facecount++ if facecount > 0 facescore = facesum / facecount else facescore = 0 // handle cases where no face rating questions were answered calculate nps score (0 100 scale) convert the raw npsscore to a 0 100 scale ( npsscore100 ) based on the following mapping switch (npsscore) { case 0 case 1 case 2 case 3 case 4 case 5 case 6 npsscore100 = 0; break; case 7 case 8 npsscore100 = 50; break; case 9 case 10 npsscore100 = 100; break; default npsscore100 = 0; // or handle invalid input appropriately } calculate comment sentiment score initialize commentsentimentscore = 0 initialize commentcount = 0 if comments length > 0 // check if comments array is not empty iterate through the comments array for each comment in comments sentiment = analyzesentiment(comment) // call external sentiment analysis function if sentiment !== null // check if sentiment analysis was successful commentsentimentscore += sentiment commentcount++ if commentcount > 0 commentsentimentscore = commentsentimentscore / commentcount calculate overall pulse score (with re weighting) initial weights wf = 0 4 // face rating weight wn = 0 4 // nps weight wc = 0 2 // comment sentiment weight handle missing comment sentiment (re weighting) if commentcount === 0 // no comments or sentiment analysis failed wc = 0 newwf = wf / (wf + wn) newwn = wn / (wf + wn) else newwf = wf newwn = wn final calculation pulsescore = (newwf facescore) + (newwn npsscore100) + (wc commentsentimentscore) return pulsescore sentinment analysis prompt you are tasked with analyzing customer sentiment of a comment associated with a survey question your goal is to provide a sentiment score between 0 and 100, where 0 represents extremely negative sentiment, 50 represents neutral sentiment, and 100 represents extremely positive sentiment here is the customer comment you need to analyze \<suvrey question> \<question>how satisfied are you with the speed at which our helpdesk team responds to your requests?\</question> \<answer>happy face\</answer> \<comment> {{comment}} \</comment> \</suvrey question> carefully read and consider the comment above pay attention to the words used, the overall tone, and any specific positive or negative expressions to determine the sentiment score, follow these guidelines 1\ identify key positive and negative words or phrases 2\ consider the overall context and tone of the comment 3\ evaluate any specific complaints or praises 4\ assess the intensity of the sentiment expressed before providing the final score, explain your reasoning for the sentiment analysis consider the following questions in your justification \ what specific words or phrases influenced your analysis? \ is the overall tone primarily positive, negative, or neutral? \ are there any mixed sentiments present? \ how intense is the sentiment expressed? provide your justification and final score in the following format \<justification> \[write your reasoning here, explaining how you arrived at the sentiment score] \</justification> \<score> \[provide only the numeric score between 0 and 100, or null if sentiment cannot be determined] \</score> remember, if the sentiment cannot be determined from the given comment, return null as the score javascript calculation function calculatepulsescore(faceratings, npsscore, comments) { // 1 calculate face score let facesum = 0; let facecount = 0; for (const rating of faceratings) { if (rating !== null) { facesum += rating; facecount++; } } const facescore = facecount > 0 ? facesum / facecount 0; // 2 calculate nps score let npsscore100; switch (npsscore) { case 0 case 1 case 2 case 3 case 4 case 5 case 6 npsscore100 = 0; break; case 7 case 8 npsscore100 = 50; break; case 9 case 10 npsscore100 = 100; break; default npsscore100 = 0; // handle invalid input } // 3 calculate comment sentiment score let commentsentimentscore = 0; let commentcount = 0; if (comments length > 0) { for (const comment of comments) { const sentiment = analyzesentiment(comment); // assume this function exists if (sentiment !== null) { commentsentimentscore += sentiment; commentcount++; } } commentsentimentscore = commentcount > 0 ? commentsentimentscore / commentcount 0; } // 4 calculate overall pulse score (with re weighting) const wf = 0 4; const wn = 0 4; let wc = 0 2; let newwf, newwn; if (commentcount === 0) { wc = 0; newwf = wf / (wf + wn); newwn = wn / (wf + wn); } else { newwf = wf; newwn = wn; } const pulsescore = (newwf facescore) + (newwn npsscore100) + (wc commentsentimentscore); return pulsescore; } calculating pulse score (aggregate) to calculate an aggregated pulse score for a group (e g , a company, department, or team), we use a simple arithmetic mean of all individual pulse scores formula the aggregated pulse score is calculated as aggregated pulse = sum of all individual pulse scores / number of respondents or more simply aggregated pulse = (pulse₁ + pulse₂ + + pulseₙ) / n where n is the total number of respondents example a team of 5 people with the following individual pulse scores person a 75 person b 82 person c 68 person d 90 person e 71 calculation aggregated pulse (75 + 82 + 68 + 90 + 71) / 5 = 77 2 > rounded = 77 important notes incomplete or missing responses the aggregation only includes actual responses respondents who did not complete the survey are not counted in the calculation rounding display the final aggregated pulse score rounded to a whole number