Improved lab report edge case parsing

This commit is contained in:
Jiang Yio 2022-10-01 01:16:19 -04:00
parent c1ca4ea414
commit 7b4b9ae099

View File

@ -53,6 +53,10 @@ function lab_parse1default(data) {
else x.comment = [line.substring(12)];
} else console.log('DANGLING:', line);
} else if(m = line.match(/^\b(?<name>.*?)\s{2,}(?<value>.*?)(?: (?<flag>L\*|L|H\*|H))?\s+(?:(?<unit>.{10}) (?<range>.*?)(?: \[(?<site>\d+)\])?)?$/)) {
if(m.groups.name.startsWith('COVID-19 SCR (CEPHEID-RAPID)')) {
m = line.substring(28).match(/^(?<value>.*?)(?: (?<flag>L\*|L|H\*|H))?\s+(?:(?<unit>.{10}) (?<range>.*?)(?: \[(?<site>\d+)\])?)?$/);
m.groups.name = 'COVID-19 SCR (CEPHEID-RAPID)';
}
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(/^(?<name>.*?)(?<value>(?:[\d\.]+|positive|negative|reactive|not detected|collected - specimen in lab|test not performed))\s*$/i))) {