Advertisement
El_Chaderino

Clinical q summary generator

Mar 11th, 2024
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 16.27 KB | None | 0 0
  1.  
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5.     <meta charset="UTF-8">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <title>EEG Data Visualization and Interpretation</title>
  8.     <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  9. </head>
  10. <body>
  11.  
  12. <textarea id="dataInput" rows="10" cols="50" placeholder="Paste EEG data here..."></textarea>
  13. <button onclick="generateSummary()">Generate Summary</button>
  14.  
  15. <div style="width:600px; margin-top:20px;">
  16.     <canvas id="eegChart"></canvas>
  17. </div>
  18.  
  19. <div id="interpretation" style="margin-top:20px;"></div>
  20.  
  21. <script>
  22. function parseData(data) {
  23.     const lines = data.split('\n');
  24.     const parsedData = lines.map(line => {
  25.         const parts = line.split('\t').map(part => part.trim());
  26.         return {
  27.             label: parts[0],
  28.             value: parseFloat(parts[1]),
  29.             ratio: parseFloat(parts[2])
  30.         };
  31.     });
  32.     return parsedData.filter(d => !isNaN(d.value)); // Filter out non-numerical entries
  33. }
  34.  
  35. function interpretData(parsedData) {
  36.     let interpretation = "";
  37.     parsedData.forEach(d => {
  38.         switch(d.label) {
  39.             // Flagged interpretations and protocol recommendations for CZ
  40.             case "CZ EO Alpha":
  41.                 interpretation += "<b>CZ Eyes Open Alpha:</b> Indicates the amplitude of alpha waves during eyes open condition.<br>";
  42.                 break;
  43.             case "EC Alpha":
  44.                 interpretation += "<b>CZ Eyes Closed Alpha:</b> Indicates the amplitude of alpha waves during eyes closed condition.<br>";
  45.                 break;
  46.             case "Percent change EO to EC Alpha > 30%":
  47.                 if (d.value > 30) {
  48.                     interpretation += "<b>Flagged Interpretation:</b> Percent change in alpha amplitude from eyes open to eyes closed condition is greater than 30%.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  49.                 }
  50.                 break;
  51.             case "EO Alpha Recovery":
  52.                 interpretation += "<b>Alpha Recovery:</b> Indicates the recovery of alpha amplitude after eyes open condition.<br>";
  53.                 break;
  54.             case "% difference EO Alpha from initial EO after EC < 25%":
  55.                if (d.value < 25) {
  56.                    interpretation += "<b>Flagged Interpretation:</b> Percent difference in alpha amplitude from initial eyes open after eyes closed is less than 25%.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  57.                 }
  58.                 break;
  59.             case "Theta Amplitude EO":
  60.                 interpretation += "<b>Theta Amplitude Eyes Open:</b> Indicates the amplitude of theta waves during eyes open condition.<br>";
  61.                 break;
  62.             case "Beta Amplitude EO":
  63.                 interpretation += "<b>Beta Amplitude Eyes Open:</b> Indicates the amplitude of beta waves during eyes open condition.<br>";
  64.                 break;
  65.             case "EO Theta/Beta < 2.2":
  66.                if (d.value < 2.2) {
  67.                    interpretation += "<b>Flagged Interpretation:</b> Theta/Beta ratio during eyes open condition is less than 2.2.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  68.                 }
  69.                 break;
  70.             case "Theta Amplitude Under Task UT":
  71.                 interpretation += "<b>Theta Amplitude Under Task (UT):</b> Indicates the amplitude of theta waves during a task.<br>";
  72.                 break;
  73.             case "Beta Amplitude UT":
  74.                 interpretation += "<b>Beta Amplitude Under Task (UT):</b> Indicates the amplitude of beta waves during a task.<br>";
  75.                 break;
  76.             case "Theta/Beta UT < 2.2":
  77.                if (d.value < 2.2) {
  78.                    interpretation += "<b>Flagged Interpretation:</b> Theta/Beta ratio during task condition is less than 2.2.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  79.                 }
  80.                 break;
  81.             case "Percent change T/B EO to T/B EO UT < 15%":
  82.                if (d.value < 15) {
  83.                    interpretation += "<b>Flagged Interpretation:</b> Percent change in theta/beta ratio from eyes open to under task condition is less than 15%.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  84.                 }
  85.                 break;
  86.             case "% Beta Increase UT < 15%":
  87.                if (d.value < 15) {
  88.                    interpretation += "<b>Flagged Interpretation:</b> Percent beta increase under task condition is less than 15%.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  89.                 }
  90.                 break;
  91.             case "Total Amplitude < 60":
  92.                if (d.value < 60) {
  93.                    interpretation += "<b>Flagged Interpretation:</b> Total amplitude of brain waves is less than 60.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  94.                 }
  95.                 break;
  96.             case "Theta Amplitude preceding Omni":
  97.                 interpretation += "<b>Theta Amplitude preceding Omni:</b> Indicates the amplitude of theta waves preceding a certain event.<br>";
  98.                 break;
  99.             case "Theta Amplitude with Omni":
  100.                 interpretation += "<b>Theta Amplitude with Omni:</b> Indicates the amplitude of theta waves with a certain event.<br>";
  101.                 break;
  102.             case "Percent change in Theta with Omni > -5%":
  103.                 if (d.value > -5) {
  104.                     interpretation += "<b>Flagged Interpretation:</b> Percent change in theta amplitude with a certain event is greater than -5%.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  105.                 }
  106.                 break;
  107.             case "Alpha Peak Frequency EC >9.5":
  108.                 if (d.value > 9.5) {
  109.                     interpretation += "<b>Flagged Interpretation:</b> Alpha peak frequency during eyes closed condition is greater than 9.5 Hz.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  110.                 }
  111.                 break;
  112.             case "Alpha Peak Frequency EO >9.5":
  113.                 if (d.value > 9.5) {
  114.                     interpretation += "<b>Flagged Interpretation:</b> Alpha peak frequency during eyes open condition is greater than 9.5 Hz.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  115.                 }
  116.                 break;
  117.             case "Theta/SMR EC < 3":
  118.                if (d.value < 3) {
  119.                    interpretation += "<b>Flagged Interpretation:</b> Theta/SMR ratio during eyes closed condition is less than 3.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  120.                 }
  121.                 break;
  122.             // Add more interpretations for CZ here...
  123.  
  124.             // Flagged interpretations and protocol recommendations for O1
  125.             case "O1 Alpha EO":
  126.                 interpretation += "<b>O1 Eyes Open Alpha:</b> Indicates the amplitude of alpha waves at O1 electrode during eyes open condition.<br>";
  127.                 break;
  128.             case "Alpha EC":
  129.                 interpretation += "<b>O1 Eyes Closed Alpha:</b> Indicates the amplitude of alpha waves at O1 electrode during eyes closed condition.<br>";
  130.                 break;
  131.             case "% Change in Alpha EO to EC > 50%":
  132.                 if (d.value > 50) {
  133.                     interpretation += "<b>Flagged Interpretation:</b> Percent change in alpha amplitude from eyes open to eyes closed condition is greater than 50%.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  134.                 }
  135.                 break;
  136.             case "EO Alpha Recovery":
  137.                 interpretation += "<b>Alpha Recovery:</b> Indicates the recovery of alpha amplitude after eyes open condition.<br>";
  138.                 break;
  139.             case "% change EO Alpha to EO Alpha after EC < 25%":
  140.                if (d.value < 25) {
  141.                    interpretation += "<b>Flagged Interpretation:</b> Percent change in alpha amplitude from initial eyes open after eyes closed is less than 25%.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  142.                 }
  143.                 break;
  144.             case "Theta Amplitude EO":
  145.                 interpretation += "<b>Theta Amplitude Eyes Open:</b> Indicates the amplitude of theta waves during eyes open condition.<br>";
  146.                 break;
  147.             case "Beta Amplitude EO":
  148.                 interpretation += "<b>Beta Amplitude Eyes Open:</b> Indicates the amplitude of beta waves during eyes open condition.<br>";
  149.                 break;
  150.             case "Theta/Beta EO 1.8 - 2.2":
  151.                 if (d.value >= 1.8 && d.value <= 2.2) {
  152.                    interpretation += "<b>Theta/Beta ratio during eyes open condition:</b> Indicates a balanced state between theta and beta waves.<br>";
  153.                 }
  154.                 break;
  155.             case "Theta Amplitude EC":
  156.                 interpretation += "<b>Theta Amplitude Eyes Closed:</b> Indicates the amplitude of theta waves during eyes closed condition.<br>";
  157.                 break;
  158.             case "Beta Amplitude EC":
  159.                 interpretation += "<b>Beta Amplitude Eyes Closed:</b> Indicates the amplitude of beta waves during eyes closed condition.<br>";
  160.                 break;
  161.             case "Theta/Beta EC 1.8 - 2.2":
  162.                 if (d.value >= 1.8 && d.value <= 2.2) {
  163.                    interpretation += "<b>Theta/Beta ratio during eyes closed condition:</b> Indicates a balanced state between theta and beta waves.<br>";
  164.                 }
  165.                 break;
  166.             case "% change EO to EC T/B ratio > 25%":
  167.                 if (d.value > 25) {
  168.                     interpretation += "<b>Flagged Interpretation:</b> Percent change in theta/beta ratio from eyes open to eyes closed condition is greater than 25%.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  169.                 }
  170.                 break;
  171.             case "Alpha Peak Frequency EC > 9.5":
  172.                 if (d.value > 9.5) {
  173.                     interpretation += "<b>Flagged Interpretation:</b> Alpha peak frequency during eyes closed condition is greater than 9.5 Hz.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  174.                 }
  175.                 break;
  176.             case "Alpha Peak Frequency EO > 9.5":
  177.                 if (d.value > 9.5) {
  178.                     interpretation += "<b>Flagged Interpretation:</b> Alpha peak frequency during eyes open condition is greater than 9.5 Hz.<br><b>Protocol:</b> Further investigation recommended.<br><br>";
  179.                 }
  180.                 break;
  181.             // Add more interpretations for O1 here...
  182.  
  183.             // Flagged interpretations and protocol recommendations for F3 and F4
  184.             case "F3 and F4 Theta/Beta Ratio":
  185.                     interpretation += "<b>Theta/Beta Ratio at F3 or F4:</b> Indicates the ratio of theta (3-7 Hz) to beta (16-25 Hz) waves at F3 or F4 electrodes.<br>";
  186.                     break;
  187.             case "Negative Percentage Difference Theta/Beta F3-F4":
  188.                     interpretation += "<b>Negative Percentage Difference Theta/Beta F3-F4:</b> Indicates the negative percentage difference between theta/beta ratios at F3 and F4 electrodes.<br>";
  189.                     break;
  190.             case "Alpha Increase Eyes Closed F4":
  191.                     interpretation += "<b>Alpha Increase Eyes Closed at F4:</b> Indicates an increase in alpha (8-12 Hz) amplitude during eyes closed condition at F4 electrode.<br>";
  192.                     break;
  193.             case "Beta Difference F4-F3":
  194.                     interpretation += "<b>Beta Difference between F4 and F3:</b> Indicates the difference in beta (16-25 Hz) amplitude between F4 and F3 electrodes.<br>";
  195.                     break;
  196.             case "Alpha Difference F3-F4":
  197.                     interpretation += "<b>Alpha Difference between F3 and F4:</b> Indicates the difference in alpha (8-12 Hz) amplitude between F3 and F4 electrodes.<br>";
  198.                     break;
  199.             case "Theta/Beta Ratio above 2.2 with Percentage Change":
  200.                     interpretation += "<b>Theta/Beta Ratio above 2.2 with Percentage Change:</b> Indicates theta/beta ratio above 2.2 with a percentage change greater than 15% at F3 or F4 electrodes.<br>";
  201.                     break;
  202.             case "Theta/Beta Ratio Difference above Threshold":
  203.                     interpretation += "<b>Theta/Beta Ratio Difference above Threshold:</b> Indicates a difference in theta/beta ratio above a specific threshold (e.g., 20%) between F3 and F4 electrodes.<br>";
  204.                     break;
  205.             case "Alpha Increase Eyes Closed F3-F4":
  206.                     interpretation += "<b>Alpha Increase Eyes Closed F3-F4:</b> Indicates an increase in alpha (8-12 Hz) amplitude during eyes closed condition between F3 and F4 electrodes.<br>";
  207.                     break;
  208.             case "Lower Theta/Beta Ratio":
  209.                     interpretation += "<b>Lower Theta/Beta Ratio at F3 or F4:</b> Suggests lowering theta/beta ratio (3-7 Hz / 16-25 Hz) to below 2.2 to address cognitive deficiencies, impulse control, and emotional volatility.<br>";
  210.                     break;
  211.             case "Train Alpha Eyes Closed F4":
  212.                     interpretation += "<b>Train Alpha Eyes Closed at F4:</b> Train alpha (8-12 Hz) during eyes closed condition at F4 electrode to between 1.2-1.6 for frontal alpha ADD and improved focus and organization.<br>";
  213.                     break;
  214.             case "Reduce Theta/Beta Percentage Difference":
  215.                     interpretation += "<b>Reduce Theta/Beta Percentage Difference:</b> Reduce percentage difference between theta and beta amplitudes at F3 and F4 electrodes to address emotional volatility and anger management.<br>";
  216.                     break;
  217.             case "Beta Range":
  218.                     interpretation += "<b>Beta Range (16-25 Hz):</b> Associated with active thinking, problem-solving, and focus.<br>";
  219.                     break;
  220.             case "HiBetaGamma Range":
  221.                     interpretation += "<b>HiBetaGamma Range (28-40 Hz):</b> Linked to heightened mental activity and alertness.<br>";
  222.                     break;
  223.  
  224.             // Flagged interpretations and protocol recommendations for FZ
  225.             case "HiBeta/Beta Ratio below Threshold":
  226.                     interpretation += "<b>HiBeta/Beta Ratio below Threshold:</b> Indicates hi-beta/beta ratio (28-40 Hz / 16-25 Hz) below 0.45 at FZ, suggesting excessive passivity.<br>";
  227.                     break;
  228.             case "HiBeta/Beta Ratio above Threshold":
  229.                     interpretation += "<b>HiBeta/Beta Ratio above Threshold:</b> Indicates hi-beta/beta ratio (28-40 Hz / 16-25 Hz) above 0.55 at FZ, associated with stubborn behavior, obsessive-compulsive tendencies, or anxiety.<br>";
  230.                     break;
  231.             case "Sum of HiBeta + Beta above Value":
  232.                     interpretation += "<b>Sum of HiBeta + Beta above Value:</b> Indicates sum of hi-beta and beta amplitudes above a specific value (e.g., 15) at FZ, suggesting perseverative behavior.<br>";
  233.                     break;
  234.             case "LoAlpha/HiAlpha Ratio below Threshold":
  235.                     interpretation += "<b>LoAlpha/HiAlpha Ratio below Threshold:</b> Indicates lo-alpha/hi-alpha ratio (8-9 Hz / 11-12 Hz) below 1.5 at FZ, suggesting cognitive inefficiency, age-related deficits, or sleep disorders.<br>";
  236.                     break;
  237.             case "Train HiBeta/Beta Ratio":
  238.                     interpretation += "<b>Train HiBeta/Beta Ratio at FZ:</b> Train hi-beta/beta ratio (28-40 Hz / 16-25 Hz) at FZ to between 0.45-0.55 to relieve passivity or stubborn behavior.<br>";
  239.                     break;
  240.             case "Decrease Sum of HiBeta + Beta":
  241.                     interpretation += "<b>Decrease Sum of HiBeta + Beta at FZ:</b> Decrease sum of hi-beta and beta amplitudes at FZ to below 15 to address perseverative behavior.<br>";
  242.                     break;
  243.             case "Lower LoAlpha/HiAlpha Ratio":
  244.                     interpretation += "<b>Lower LoAlpha/HiAlpha Ratio at FZ:</b> Lower lo-alpha/hi-alpha ratio (8-9 Hz / 11-12 Hz) at FZ to below 1.5 to improve cognitive efficiency and sleep disorders.<br>";
  245.                     break;
  246.             case "Alpha Range":
  247.                     interpretation += "<b>Alpha Range (8-12 Hz):</b> Associated with relaxation, creativity, and mental imagery.<br>";
  248.                     break;
  249.             case "HiAlpha Range":
  250.                     interpretation += "<b>HiAlpha Range (11-12 Hz):</b> Linked to deep relaxation, meditation, and mental integration.<br>";
  251.                     break;
  252.             case "Beta Range":
  253.                     interpretation += "<b>Beta Range (16-25 Hz):</b> Related to active thinking, problem-solving, and concentration.<br>";
  254.                     break;
  255.  
  256.            
  257.  
  258.             default:
  259.                 break;
  260.         }
  261.     });
  262.     return interpretation;
  263. }
  264.  
  265. function generateSummary() {
  266.     const data = document.getElementById("dataInput").value;
  267.     const parsedData = parseData(data);
  268.     const interpretation = interpretData(parsedData);
  269.     document.getElementById("interpretation").innerHTML = interpretation;
  270. }
  271.  
  272. </script>
  273.  
  274. </body>
  275. </html>
  276.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement