Handle long lab test names
This commit is contained in:
parent
6e6f27bb5c
commit
01644ef384
@ -52,14 +52,13 @@ function lab_parse1default(data) {
|
|||||||
if(x.comment) x.comment.push(line.substring(12));
|
if(x.comment) x.comment.push(line.substring(12));
|
||||||
else x.comment = [line.substring(12)];
|
else x.comment = [line.substring(12)];
|
||||||
} else console.log('DANGLING:', line);
|
} else console.log('DANGLING:', line);
|
||||||
} else if((line.startsWith('COVID-19 SCR (CEPHEID-RAPID)')) && (m = line.substring(28).match(/^(?<value>.*?)(?: (?<flag>L\*|L|H\*|H))?\s+(?:(?<unit>.{10}) (?<range>.{16}) \[(?<site>\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(?<name>.*?)\s{2,}(?<value>.*?)(?: (?<flag>L\*|L|H\*|H))?\s+(?:(?<unit>.{10}) (?<range>.{16}) \[(?<site>\d+)\])?$/)) {
|
} else if(m = line.match(/^\b(?<name>.*?)\s{2,}(?<value>.*?)(?: (?<flag>L\*|L|H\*|H))?\s+(?:(?<unit>.{10}) (?<range>.{16}) \[(?<site>\d+)\])?$/)) {
|
||||||
if((m.groups.range) && (m.groups.range.startsWith('Ref: '))) m.groups.range = m.groups.range.substring(5);
|
if((m.groups.range) && (m.groups.range.startsWith('Ref: '))) m.groups.range = m.groups.range.substring(5);
|
||||||
results.push(x = m.groups);
|
results.push(x = m.groups);
|
||||||
|
if((x.value === '') && (m = x.name.match(/^(?<name>.*?)(?<value>(?:[\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;
|
for(var k in x) if(x[k]) x[k] = x[k] ? x[k].replace(/^\s+|\s+$/g, '') : undefined;
|
||||||
} else if(line.startsWith(' [')) {
|
} else if(line.startsWith(' [')) {
|
||||||
if(results.length > 0) results[results.length - 1].site = line.split('[')[1].split(']')[0]
|
if(results.length > 0) results[results.length - 1].site = line.split('[')[1].split(']')[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user