Calculated variables
This commit is contained in:
@@ -3,8 +3,11 @@
|
||||
<label class="form-check form-check-inline form-switch form-check-label" v-for="report in reports">
|
||||
<input class="form-check-input" type="checkbox" v-model="report.selected" /> {{report.name}}
|
||||
</label>
|
||||
<label class="form-check form-check-inline form-switch form-check-label">
|
||||
<input class="form-check-input" type="checkbox" v-model="calculate" /> Calculate
|
||||
</label>
|
||||
</div>
|
||||
<ViewData :resultset="resultset" :daily="true" :reports="reports_selected" />
|
||||
<ViewData :resultset="resultset" :daily="true" :constants="calculate ? constants : []" :calculations="calculate ? calculations : []" :reports="reports_selected" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -12,10 +15,19 @@
|
||||
|
||||
import ViewData from './ViewData.vue';
|
||||
|
||||
const time_min = new Date(1700, 0, 1);
|
||||
|
||||
const calculations = [
|
||||
{ name: 'Age', unit: 'yr', deps: ['Time', 'DOB'], calc(Time, DOB, prev) { var x = Math.floor((Time - DOB.getTime())/3.15576e10); return x != prev ? x : undefined; } },
|
||||
{ name: 'BMI', unit: 'kg/m²', rangeL: 18.5, rangeH: 24.9, range: '18.5 - 24.9', deps: ['Ht', 'Wt'], calc: (Ht, Wt) => (10000*Wt/(Ht*Ht)).toPrecision(3) },
|
||||
{ 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) }
|
||||
];
|
||||
|
||||
const reports = [
|
||||
{ name: 'Vitals', value: ['T', 'P', 'R', 'SBP', 'DBP', 'Pulse Oximetry', 'Wt', 'Ht', 'Pain'], selected: true },
|
||||
{ name: 'Vitals', value: ['T', 'P', 'R', 'SBP', 'DBP', 'Pulse Oximetry', 'Wt', 'Ht', 'BMI', 'BSA', 'Pain'], selected: true },
|
||||
{ name: 'CBC', value: ['HGB', 'MCV', 'PLT', 'WBC', 'NEUTROPHIL#'], selected: false },
|
||||
{ name: 'Renal', value: ['CREATININE', 'UREA NITROGEN', 'EGFR CKD-EPI 2021', 'Estimated GFR dc\'d 3/30/2022'], selected: false },
|
||||
{ name: 'Renal', value: ['CREATININE', 'UREA NITROGEN', 'EGFR CKD-EPI 2021', 'Estimated GFR dc\'d 3/30/2022', 'CrCl'], selected: false },
|
||||
{ name: 'Hepatic', value: ['SGOT', 'SGPT', 'LDH', 'ALKALINE PHOSPHATASE', 'GAMMA-GTP', 'TOT. BILIRUBIN', 'DIR. BILIRUBIN', 'ALBUMIN'], selected: false },
|
||||
{ name: 'Electrolytes', value: ['SODIUM', 'CHLORIDE', 'CO2', 'CALCIUM', 'IONIZED CALCIUM (LABCORP)', 'POTASSIUM', 'MAGNESIUM', 'PO4', 'ANION GAP', 'OSMOBLD'], selected: false },
|
||||
{ name: 'Coagulation', value: ['PT', 'INR', 'PTT'], selected: false },
|
||||
@@ -71,20 +83,29 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
patientinfo: null,
|
||||
resultset: null,
|
||||
reports
|
||||
calculate: true,
|
||||
calculations, reports
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
params() {
|
||||
return { dfn: this.dfn, date_begin: strftime_vista(this.date_begin), date_end: strftime_vista(this.date_end) };
|
||||
},
|
||||
constants() {
|
||||
return this.patientinfo ? {
|
||||
DOB: { time: time_min, value: strptime_vista(this.patientinfo.dob) },
|
||||
Sex: { time: time_min, value: this.patientinfo.sex }
|
||||
} : {};
|
||||
},
|
||||
reports_selected() {
|
||||
return this.reports.filter(x => x.selected).map(x => x.value);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
async params(value, oldvalue) {
|
||||
this.patientinfo = await this.client.ORWPT16_ID_INFO(value.dfn);
|
||||
this.resultset = vitals_normalize(await this.client.GMV_EXTRACT_REC(value.dfn, value.date_end, value.date_begin)).concat(labs_normalize(await this.client.ORWLRR_INTERIM_RESULTS(value.dfn, value.date_end, value.date_begin)));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user