diff --git a/htdocs/reportparser.mjs b/htdocs/reportparser.mjs index 20eef6b..47b0401 100644 --- a/htdocs/reportparser.mjs +++ b/htdocs/reportparser.mjs @@ -52,14 +52,13 @@ function lab_parse1default(data) { if(x.comment) x.comment.push(line.substring(12)); else x.comment = [line.substring(12)]; } else console.log('DANGLING:', line); - } else if((line.startsWith('COVID-19 SCR (CEPHEID-RAPID)')) && (m = line.substring(28).match(/^(?.*?)(?: (?L\*|L|H\*|H))?\s+(?:(?.{10}) (?.{16}) \[(?\d+)\])?$/))) { - if((m.groups.range) && (m.groups.range.startsWith('Ref: '))) m.groups.range = m.groups.range.substring(5); - results.push(x = m.groups); - for(var k in x) if(x[k]) x[k] = x[k] ? x[k].replace(/^\s+|\s+$/g, '') : undefined; - x.name = 'COVID-19 SCR (CEPHEID-RAPID)'; } else if(m = line.match(/^\b(?.*?)\s{2,}(?.*?)(?: (?L\*|L|H\*|H))?\s+(?:(?.{10}) (?.{16}) \[(?\d+)\])?$/)) { if((m.groups.range) && (m.groups.range.startsWith('Ref: '))) m.groups.range = m.groups.range.substring(5); results.push(x = m.groups); + if((x.value === '') && (m = x.name.match(/^(?.*?)(?(?:[\d\.]+|positive|negative|reactive|test not performed))$/i))) { + x.name = m.groups.name; + x.value = m.groups.value; + } for(var k in x) if(x[k]) x[k] = x[k] ? x[k].replace(/^\s+|\s+$/g, '') : undefined; } else if(line.startsWith(' [')) { if(results.length > 0) results[results.length - 1].site = line.split('[')[1].split(']')[0]