Foundation for order entry
This commit is contained in:
@@ -53,7 +53,7 @@ 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(x = line.match(/^\b(?<name>.*?)(?<value>(?:positive|negative|reactive|not detected|collected - specimen in lab|test not performed))(?: (?<flag>L\*|L|H\*|H))?\s+(?:(?<unit>.{10}) (?<range>.*?)(?: \[(?<site>\d+)\])?)?$/i)) m = x;
|
||||
if(x = line.match(/^\b(?<name>.*?)(?<value>(?:positive|negative|reactive|nonreactive|not detected|collected - specimen in lab|test not performed))(?: (?<flag>L\*|L|H\*|H))?\s+(?:(?<unit>.{10}) (?<range>.*?)(?: \[(?<site>\d+)\])?)?$/i)) m = x;
|
||||
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))) {
|
||||
@@ -61,7 +61,7 @@ function lab_parse1default(data) {
|
||||
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(m = line.match(/^\b(?<name>.*?)(?<value>(?:[\d\.]+|positive|negative|reactive|not detected|collected - specimen in lab|test not performed))\s*$/i)) {
|
||||
} else if(m = line.match(/^\b(?<name>.*?)(?<value>(?:[\d\.]+|positive|negative|reactive|nonreactive|not detected|collected - specimen in lab|test not performed))\s*$/i)) {
|
||||
results.push(x = m.groups);
|
||||
for(var k in x) if(x[k]) x[k] = x[k] ? x[k].replace(/^\s+|\s+$/g, '') : undefined;
|
||||
} else if(line.startsWith(' [')) {
|
||||
@@ -88,7 +88,7 @@ function lab_parse1default(data) {
|
||||
results[(x = results[i]).name] = x;
|
||||
if(x.comment) x.comment = x.comment.join('\n');
|
||||
}
|
||||
if(res.accession.startsWith('HE ')) {
|
||||
if((res.accession) && (res.accession.startsWith('HE '))) {
|
||||
if((results.hasOwnProperty('SEGS')) || (results.hasOwnProperty('BANDS'))) {
|
||||
results.push(results['NEUTROPHIL%'] = {
|
||||
name: 'NEUTROPHIL%', unit: '%', range: '42.2 - 75.2',
|
||||
@@ -181,7 +181,7 @@ export function measurement_parse(data) {
|
||||
return res;
|
||||
}
|
||||
|
||||
export function order_parse(data) {
|
||||
export function orderinfo_parse(data) {
|
||||
var res = [], item, line;
|
||||
for(var i = 0; i < data.length; ++i) {
|
||||
if((line = data[i]).startsWith('~')) {
|
||||
@@ -213,3 +213,35 @@ export function order_parse(data) {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
export function orderoverrides_parse(data) {
|
||||
var res = [], item, line;
|
||||
for(var i = 0; i < data.length; ++i) {
|
||||
if((line = data[i]).startsWith('~')) {
|
||||
res.push(item = line.substring(1).split('^'));
|
||||
item.promptIEN = item[0];
|
||||
item.instance = item[1];
|
||||
item.promptID = item[2];
|
||||
} else if(item) {
|
||||
if(line.startsWith('i')) item.iValue = line.substring(1);
|
||||
else if(line.startsWith('e')) item.eValue = line.substring(1);
|
||||
else if(line.startsWith('t')) {
|
||||
item.eValue = (item.hasOwnProperty('eValue')) && (item.eValue.length > 0) ? item.eValue + '\r\n' + line.substring(1) : line.substring(1);
|
||||
item.iValue = '^WP^';
|
||||
} else console.log('INVALID:', line);
|
||||
} else console.log('INVALID:', line);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
export function orderoptions_parse(data) {
|
||||
var res = {}, item, type, line;
|
||||
for(var i = 0; i < data.length; ++i) {
|
||||
if((line = data[i]).startsWith('~')) item = res[line.substring(1)] = {};
|
||||
else if(item) {
|
||||
type = { d: 'default', t: 'text', i: 'items' }[line.charAt(0)];
|
||||
item[type] = (item.hasOwnProperty(type)) && (item[type].length > 0) ? item[type] + '\r\n' + line.substring(1) : line.substring(1);
|
||||
} else console.log('INVALID:', line);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
Reference in New Issue
Block a user