Compare commits
6 Commits
4708e5e0eb
...
main
Author | SHA1 | Date | |
---|---|---|---|
46ef48b0ae | |||
1d276e7bec | |||
18d6b6f19c | |||
5d2a8f464f | |||
fcd8447658 | |||
e648988b53 |
@ -53,8 +53,8 @@
|
||||
}
|
||||
|
||||
function timeshift_month(date, diff) {
|
||||
var month = date.getMonth() + diff;
|
||||
return new Date(date.getFullYear() + Math.floor(month/12), month >= 0 ? (month%12) : (month%12 + 12), date.getDate());
|
||||
var month = date.getMonth() + diff, month_mod12 = month%12;
|
||||
return new Date(date.getFullYear() + Math.floor(month/12), month_mod12 >= 0 ? (month_mod12) : (month_mod12 + 12), date.getDate());
|
||||
}
|
||||
|
||||
function datecalc(date, range, direction) {
|
||||
|
@ -226,7 +226,7 @@
|
||||
},
|
||||
watch: {
|
||||
async resultset(value) {
|
||||
this.$nextTick(() => this.$refs.headers ? this.$refs.headers.scrollIntoView({ block: 'nearest', inline: 'end' }) : null);
|
||||
this.$nextTick(() => (this.$refs.headers) && (this.$refs.headers.length > 0) ? this.$refs.headers[this.$refs.headers.length - 1].scrollIntoView({ block: 'nearest', inline: 'end' }) : null);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -23,7 +23,8 @@
|
||||
{ name: 'BSA', unit: 'm²', deps: ['Ht', 'Wt'], calc: (Ht, Wt) => (0.007184*Math.pow(Ht, 0.725)*Math.pow(Wt, 0.425)).toPrecision(3) },
|
||||
{ name: 'CrCl', unit: 'mL/min', deps: ['Age', 'Sex', 'Wt', 'CREATININE'], calc: (Age, Sex, Wt, CREATININE) => (((140 - Age) * Wt)/(72*CREATININE)*(Sex == 'M' ? 1 : 0.85)).toPrecision(4) },
|
||||
{ name: 'RETICYLOCYTE#', unit: 'K/cmm', rangeL: 50, rangeH: 100, range: '50 - 100', deps: ['RBC', 'RETICULOCYTES'], calc: (RBC, RETICULOCYTES) => (10*RBC*RETICULOCYTES).toPrecision(3) },
|
||||
{ name: 'CALCIUM CORRECTED', unit: 'mg/dL', rangeL: 8.9, rangeH: 10.3, range: '8.9 - 10.3', deps: ['CALCIUM', 'ALBUMIN'], calc: (CALCIUM, ALBUMIN) => ALBUMIN < 4 ? (+CALCIUM + 0.8*(4 - ALBUMIN)).toPrecision(3) : undefined }
|
||||
{ name: 'CALCIUM CORRECTED', unit: 'mg/dL', rangeL: 8.9, rangeH: 10.3, range: '8.9 - 10.3', deps: ['CALCIUM', 'ALBUMIN'], calc: (CALCIUM, ALBUMIN) => ALBUMIN < 4 ? (+CALCIUM + 0.8*(4 - ALBUMIN)).toPrecision(3) : undefined },
|
||||
{ name: 'IRON SATURATION', unit: '%', rangeL: 15, rangeH: 55, range: '15 - 55', comment: 'IRON/TIBC', deps: ['IRON', 'TIBC'], calc: (IRON, TIBC) => (100*IRON/TIBC).toPrecision(3) },
|
||||
];
|
||||
|
||||
const reports = [
|
||||
@ -33,7 +34,7 @@
|
||||
{ name: 'Hepatic', value: ['SGOT', 'SGPT', 'LDH', 'ALKALINE PHOSPHATASE', 'GAMMA-GTP', 'TOT. BILIRUBIN', 'DIR. BILIRUBIN', 'ALBUMIN'], selected: false },
|
||||
{ name: 'Electrolytes', value: ['SODIUM', 'CHLORIDE', 'CO2', 'CALCIUM', 'CALCIUM CORRECTED', 'IONIZED CALCIUM (LABCORP)', 'POTASSIUM', 'MAGNESIUM', 'PO4', 'ANION GAP', 'OSMOBLD'], selected: false },
|
||||
{ name: 'Coagulation', value: ['PT', 'INR', 'PTT'], selected: false },
|
||||
{ name: 'Vitamins', value: ['FERRITIN', 'IRON', 'TIBC', 'B 12', 'FOLATE', 'VITAMIN D TOTAL 25-OH'], selected: false },
|
||||
{ name: 'Vitamins', value: ['FERRITIN', 'IRON', 'TIBC', 'IRON SATURATION', 'B 12', 'FOLATE', 'VITAMIN D TOTAL 25-OH'], selected: false },
|
||||
{ name: 'Thyroid', value: ['TSH', 'T4 (THYROXINE)'], selected: false },
|
||||
{ name: 'Myeloma', value: ['PROTEIN,TOT SER (LC)', 'ALBUMIN [for SPEP](LC)', 'ALPHA-1 GLOBULIN S (LC)', 'ALPHA-2 GLOBULIN S (LC)', 'BETA GLOBULIN S (LC)', 'GAMMA GLOBULIN S (LC)', 'GLOBULIN,TOTAL S (LC)', 'A/G RATIO S (LC)', 'M-SPIKE S (LC)', 'IMMUNOFIXATION SERUM (LC)', 'FREE KAPPA LT CHAIN, S (LC)', 'FREE LAMBDA LT CHAIN, S (LC)', 'KAPPA/LAMBDA RATIO, S (LC)', 'KLRATIO', 'IMMUNOGLOBULIN G,QN (LC)', 'IMMUNOGLOBULIN A,QN (LC)', 'IMMUNOGLOBULIN M,QN (LC)', 'IGG', 'IGA', 'IGM', 'ALBUMIN [for RAND UR](LC):U', 'ALPHA-1 GLOB RAND UR(LC):U', 'ALPHA-2 GLOB RAND UR(LC):U', 'BETA GLOB RAND UR(LC):U', 'GAMMA GLOB RAND UR(LC):U', 'M-SPIKE% RAND UR(LC):U', 'PROTEIN,TOT UR(LC):U', 'FKLCUR:U', 'FLLCUR:U', 'KAPPA/LAMBDA RATIO, UR (LC):U', 'KLRATIO:U', 'PROTEIN,24H CALC(LC):U', 'ALBUMIN [for 24UPEP](LC):U', 'ALPHA-1 GLOBULIN 24H(LC):U', 'ALPHA-2 GLOBULIN 24H(LC):U', 'BETA GLOBULIN 24H(LC):U', 'GAMMA GLOBULIN 24H(LC):U', 'M-SPIKE% 24H(LC):U', 'M-SPIKE mg/24hr(LC):U', 'FR KAPPA LTCH:U', 'FR LAMBDA LTCH:U'], selected: false }
|
||||
];
|
||||
@ -48,13 +49,14 @@
|
||||
|
||||
function vitals_normalize(rs) {
|
||||
return rs.map(function(x) {
|
||||
var comment = x.comment && x.comment.replace(/^\s+|\s+$/g, '').replace(/\s+/g, ' ');
|
||||
var res = {
|
||||
time: x.datetime,
|
||||
name: x.name,
|
||||
unit: x.unit,
|
||||
value: x.value,
|
||||
flag: x.flag,
|
||||
comment: x.user
|
||||
comment: comment ? x.user + ' • ' + comment : x.user
|
||||
};
|
||||
return vitals_mapping[x.name] ? Object.assign(res, vitals_mapping[x.name]) : res;
|
||||
});
|
||||
|
@ -53,15 +53,15 @@ 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|nonreactive|not detected|comment|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|detected|not detected|comment|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|comment|collected - specimen in lab|test not performed))\s*$/i))) {
|
||||
if((x.value === '') && (m = x.name.match(/^(?<name>.*?)(?<value>(?:[\d\.]+|positive|negative|reactive|detected|not detected|comment|collected - specimen in lab|test not performed))\s*$/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(m = line.match(/^\b(?<name>.*?)(?<value>(?:[\d\.]+|positive|negative|reactive|nonreactive|not detected|comment|collected - specimen in lab|test not performed))\s*$/i)) {
|
||||
} else if(m = line.match(/^\b(?<name>.*?)(?<value>(?:[\d\.]+|positive|negative|reactive|nonreactive|detected|not detected|comment|collected - specimen in lab|test not performed))(?: (?<flag>L\*|L|H\*|H))?\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(' [')) {
|
||||
@ -95,7 +95,7 @@ function lab_parse1default(data) {
|
||||
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#'] = {
|
||||
if(results.WBC) 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)
|
||||
@ -107,7 +107,7 @@ function lab_parse1default(data) {
|
||||
value: x = +results.EOSINO.value,
|
||||
flag: (x < 0 ? 'L' : x > 10 ? 'H' : undefined)
|
||||
});
|
||||
results.push(results['EOSINOPHIL#'] = {
|
||||
if(results.WBC) results.push(results['EOSINOPHIL#'] = {
|
||||
name: 'EOSINOPHIL#', unit: 'K/cmm', range: '0.0 - 0.7',
|
||||
value: +(x = 0.01*x*results.WBC.value).toFixed(3),
|
||||
flag: (x < 0 ? 'L' : x > 0.7 ? 'H' : undefined)
|
||||
@ -119,7 +119,7 @@ function lab_parse1default(data) {
|
||||
value: x = +results.BASO.value,
|
||||
flag: (x < 0 ? 'L' : x > 2 ? 'H' : undefined)
|
||||
});
|
||||
results.push(results['BASOPHIL#'] = {
|
||||
if(results.WBC) results.push(results['BASOPHIL#'] = {
|
||||
name: 'BASOPHIL#', unit: 'K/cmm', range: '0.0 - 0.2',
|
||||
value: +(x = 0.01*x*results.WBC.value).toFixed(3),
|
||||
flag: (x < 0 ? 'L' : x > 0.2 ? 'H' : undefined)
|
||||
@ -131,7 +131,7 @@ function lab_parse1default(data) {
|
||||
value: x = +results.MONOS.value,
|
||||
flag: (x < 1.7 ? 'L' : x > 9.3 ? 'H' : undefined)
|
||||
});
|
||||
results.push(results['MONOCYTE#'] = {
|
||||
if(results.WBC) results.push(results['MONOCYTE#'] = {
|
||||
name: 'MONOCYTE#', unit: 'K/cmm', range: '0.11 - 0.59',
|
||||
value: +(x = 0.01*x*results.WBC.value).toFixed(3),
|
||||
flag: (x < 0.11 ? 'L' : x > 0.59 ? 'H' : undefined)
|
||||
@ -143,7 +143,7 @@ function lab_parse1default(data) {
|
||||
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#'] = {
|
||||
if(results.WBC) 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)
|
||||
@ -195,12 +195,27 @@ export function measurement_parse(data) {
|
||||
res.name = row.substring(idx + 3, idx = row.indexOf(': ', idx));
|
||||
value = row.substring(idx + 4, idx = row.indexOf(' _', idx));
|
||||
res.user = row.substring(idx + 2);
|
||||
m = value.match(/^(?:(.*?)(?: (\S+))?)(\*)?(?: \((?:(.*?)(?: (\S+))?)\))?\s*$/);
|
||||
res.value = m[4] ? m[4] : m[1];
|
||||
res.unit = m[4] ? m[5] : m[2];
|
||||
res.flag = m[3];
|
||||
res.value_american = m[4] ? m[1] : m[4];
|
||||
res.unit_american = m[4] ? m[2] : m[5];
|
||||
if(m = value.match(/(?:^(?<value>[\d\.\/%]+)(?: (?<unit>\w+) \((?<value2>[\d\.\/%]+) (?<unit2>\w+)\))?(?<flag>\*)? (?: (?<comment>.*))?$)|(?:^(?<value3>[\d\.\/%]+)(?<flag3>\*)?\s*(?<comment3>.*)$)/)) {
|
||||
if(m.groups.value2) {
|
||||
res.value = m.groups.value2;
|
||||
res.unit = m.groups.unit2;
|
||||
res.value_american = m.groups.value;
|
||||
res.unit_american = m.groups.unit;
|
||||
res.flag = m.groups.flag;
|
||||
res.comment = m.groups.comment;
|
||||
} else if(m.groups.value) {
|
||||
res.value = m.groups.value;
|
||||
res.unit = m.groups.unit;
|
||||
res.flag = m.groups.flag;
|
||||
res.comment = m.groups.comment;
|
||||
} else if(m.groups.value3) {
|
||||
res.value = m.groups.value3;
|
||||
res.flag = m.groups.flag3;
|
||||
res.comment = m.groups.comment3;
|
||||
} else res.comment = value;
|
||||
if(res.comment) res.comment = res.comment.replace(/^\s+|\s+$/g, '').replace(/\s+/g, ' ');
|
||||
}
|
||||
if(res.value) {
|
||||
if(res.value.charAt(res.value.length - 1) == '%') {
|
||||
res.unit = '%';
|
||||
res.value = res.value.substring(0, res.value.length - 1);
|
||||
@ -210,6 +225,7 @@ export function measurement_parse(data) {
|
||||
extras.push({...res, name: 'SBP', range: '90 - 120', unit: 'mmHg', value: bpsplit[0] });
|
||||
extras.push({...res, name: 'DBP', range: '60 - 80', unit: 'mmHg', value: bpsplit[1] });
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}).filter(x => x);
|
||||
|
Reference in New Issue
Block a user