From a01fa834aca428167d37bc8553943709f36a5634 Mon Sep 17 00:00:00 2001 From: inportb Date: Sat, 1 Oct 2022 00:35:53 -0400 Subject: [PATCH] Hoist lymphocyte count from manual differential --- htdocs/reportparser.mjs | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/htdocs/reportparser.mjs b/htdocs/reportparser.mjs index da21a60..1932106 100644 --- a/htdocs/reportparser.mjs +++ b/htdocs/reportparser.mjs @@ -87,17 +87,31 @@ function lab_parse1default(data) { results[(x = results[i]).name] = x; if(x.comment) x.comment = x.comment.join('\n'); } - if((res.accession.startsWith('HE ')) && ((results.hasOwnProperty('SEGS')) || (results.hasOwnProperty('BANDS')))) { - results.push(results['NEUTROPHIL%'] = { - name: 'NEUTROPHIL%', unit: '%', range: '42.2 - 75.2', - value: x = (results.hasOwnProperty('SEGS') ? +results.SEGS.value : 0) + (results.hasOwnProperty('BANDS') ? +results.BANDS.value : 0), - flag: (x < 42.2 ? 'L' : x > 75.2 ? 'H' : undefined) - }); - results.push(results['NEUTROPHIL#'] = { - name: 'NEUTROPHIL#', unit: 'K/cmm', range: '1.4 - 6.5', - value: +(x = 0.01*x*results.WBC.value).toFixed(3), - flag: (x < 1.4 ? 'L' : x > 6.5 ? 'H' : undefined) - }); + if(res.accession.startsWith('HE ')) { + if((results.hasOwnProperty('SEGS')) || (results.hasOwnProperty('BANDS'))) { + results.push(results['NEUTROPHIL%'] = { + name: 'NEUTROPHIL%', unit: '%', range: '42.2 - 75.2', + value: x = (results.hasOwnProperty('SEGS') ? +results.SEGS.value : 0) + (results.hasOwnProperty('BANDS') ? +results.BANDS.value : 0), + flag: (x < 42.2 ? 'L' : x > 75.2 ? 'H' : undefined) + }); + results.push(results['NEUTROPHIL#'] = { + name: 'NEUTROPHIL#', unit: 'K/cmm', range: '1.4 - 6.5', + value: +(x = 0.01*x*results.WBC.value).toFixed(3), + flag: (x < 1.4 ? 'L' : x > 6.5 ? 'H' : undefined) + }); + } + if((results.hasOwnProperty('LYMPHS')) || (results.hasOwnProperty('ATYPICAL LYMPHOCYTES'))) { + results.push(results['LYMPHOCYTE%'] = { + name: 'LYMPHOCYTE%', unit: '%', range: '15.0 - 41.0', + value: x = (results.hasOwnProperty('LYMPHS') ? +results.LYMPHS.value : 0) + (results.hasOwnProperty('ATYPICAL LYMPHOCYTES') ? +results['ATYPICAL LYMPHOCYTES'].value : 0), + flag: (x < 15 ? 'L' : x > 41 ? 'H' : undefined) + }); + results.push(results['LYMPHOCYTE#'] = { + name: 'LYMPHOCYTE#', unit: 'K/cmm', range: '1.2 - 3.4', + value: +(x = 0.01*x*results.WBC.value).toFixed(3), + flag: (x < 1.2 ? 'L' : x > 3.4 ? 'H' : undefined) + }); + } } return res; }