From 98e0c87764bbf649ad45fcc194ed57ca1819a7cc Mon Sep 17 00:00:00 2001 From: JP Lomas Date: Wed, 6 Nov 2024 14:33:40 +0000 Subject: [PATCH] =?UTF-8?q?Pick=20list=20for=20indications=20=F0=9F=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: JP Lomas --- frontend/index.html | 84 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 4 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 0bc3edb..685c31e 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -35,6 +35,7 @@

NELA API

v-slot="{ field }" @keyup="result = null;" @keypress="isNumber($event, field.type)" + @change="result = null" :type="(field.type === 'integer' || field.type === 'number') ? 'number' : field.type" :rules="validationRule(field)" :name="camelCase(field.name)" @@ -55,6 +56,7 @@

NELA API

id="button-addon" data-bs-target="#setIndications" data-bs-toggle="modal" + @click="result = null" > Set @@ -75,15 +77,29 @@ - +

Result

@@ -132,6 +148,45 @@
Response received:
schema: {}, result: null, request: {}, + chosenIndications: { + Bleeding: [], + Other: [], + Obstruction: [], + Sepsis: [], + 'Iatrogenic injury': [], + Ischaemia: [], + }, + indications: { + Bleeding: ['Haemorrhage'], + Other: ['Abdominal wound dehiscence', 'Abdominal compartment syndrome', 'Planned relook', 'Other'], + Obstruction: [ + 'Tender Small bowel obstruction', + 'Non-Tender Small bowel obstruction', + 'Tender Large bowel obstruction', + 'Non-Tender Large bowel obstruction', + 'Gastric outlet obstruction', + 'Incarcerated/strangulated hernia', + 'Hiatus Hernia/para-oesophageal hernia', + 'Volvulus', + 'Internal hernia', + 'Obstructing incisional hernia', + 'Intussusception', + 'Pseudo-obstruction', + 'Foreign body', + ], + Sepsis: [ + 'Phlegmon', + 'Pneumoperitoneum', + 'Sepsis', + 'Iatrogenic injury', + 'Anastomotic leak', + 'Peritonitis', + 'GI Perforation', + 'Abdominal abscess', + 'Intestinal fistula', + ], + Ischaemia: ['Necrosis', 'Ischaemia/infarction', 'Colitis', 'Acidosis'], + }, }; }, components: { @@ -140,6 +195,27 @@
Response received:
ErrorMessage: VeeValidate.ErrorMessage, }, methods: { + changeInd() { + const weight = { + Bleeding: 1, + Other: 2, + Obstruction: 2, + Sepsis: 3, + Ischaemia: 4, + }; + // get highest weight + let max = 0; + let maxKey = ''; + for (const key in this.chosenIndications) { + for (const option in this.chosenIndications[key]) { + if (this.chosenIndications[key][option]) { + max = weight[key]; + maxKey = key; + } + } + } + this.schema.indicationForSurgery.value = maxKey.toLowerCase(); + }, reset() { this.result = null; }, @@ -222,7 +298,7 @@
Response received:
this.schema = JSON.parse(data).properties; }) .catch((error) => { - console.error('Error fetching test data:', error); + console.error('Error fetching schema data:', error); }); }, }).mount('#app');