From bffe45781caa7a3ed09e5526ed3275c026fabab5 Mon Sep 17 00:00:00 2001 From: Ross Date: Sat, 30 Oct 2021 23:44:56 +0100 Subject: [PATCH] . --- rapids/templates/rapids/rapid_form.html | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/rapids/templates/rapids/rapid_form.html b/rapids/templates/rapids/rapid_form.html index 84480823..451ee02b 100755 --- a/rapids/templates/rapids/rapid_form.html +++ b/rapids/templates/rapids/rapid_form.html @@ -53,6 +53,7 @@ // Check if we have selected a examination type if (!$("#id_examination_to option").length) { + // Yes we do read the file twice (here and where loading it in the viewer) var reader = new FileReader(); reader.onload = function (file) { console.log("READ EXAMINIANS", file) @@ -389,8 +390,19 @@ // To access the data for an element, we need to know its type and its tag. // We will get the sopInstanceUid from the file which is a string and // has the tag (0020,000D) - var study_description = dataSet.string('x00081030'); - console.log("STUDY", study_description) + var study_description = dataSet.string('x00081030').toLowerCase(); + console.log("STUDY", study_description); + + // try to match with a study description + option = $(`#id_examination_from option[title*='${study_description}' i]`); + + if (option.length) { + option.appendTo($("#id_examination_to")); + toastr.success(`Examination set to ${option.attr('title')} from dicom data`); + } else { + toastr.warning(`Unable to set examination ${option.attr('title')} from dicom data (it needs creating)`); + + } } catch (err) {