From a917b3804ef3bccf050702f2ec152127d7957482 Mon Sep 17 00:00:00 2001 From: Ross Date: Sun, 10 Jul 2022 23:19:14 +0100 Subject: [PATCH] . --- atlas/templates/atlas/series_form.html | 50 ++++++++++++++++++++++++++ templates/generic_form.html | 4 +-- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/atlas/templates/atlas/series_form.html b/atlas/templates/atlas/series_form.html index 77f01c27..0ce2e51b 100755 --- a/atlas/templates/atlas/series_form.html +++ b/atlas/templates/atlas/series_form.html @@ -333,9 +333,59 @@ var study_description = dataSet.string('x00081030').toLowerCase(); var accession_number = dataSet.string('x00080050').toLowerCase(); var patient_id = dataSet.string('x00100020').toLowerCase(); + var modality = dataSet.string('x00080060'); + var projection = dataSet.string('x00185101'); + var plate = dataSet.string('x00180022'); console.log("STUDY", study_description); console.log("acc", accession_number); console.log("pid", patient_id); + console.log("projection", projection); + console.log("plane", plane); + + + modality_map = { + "DX": "Radiograph", + "CR": "Radiograph", + "CT": "CT", + "MR": "MR", + "RF": "Fluroscopy", + "US": "Ultrasound", + } + + if (modality in modality_map) { + let modality_select_object = document.getElementsByName("modality")[0] + const $options = Array.from(modality_select_object.options); + const optionToSelect = $options.find(item => item.text === modality_map[modality]); + optionToSelect.selected = true; + + + + } else { + toastr.info(`Unable to automatically set modality: ${modality}`) + } + + to_replace = ["lt", "rt", "constrast"] + + for (let i = 0; i < to_replace.length; i++) { + + study_description = study_description.replace(to_replace[i], ""); + } + + let select_object = document.getElementsByName("examination")[0] + + if (select_object.value == "") { + $.get(`${select_object.dataset.autocompleteLightUrl}?q=${study_description}`, (data) => { + console.log(data) + if (data.results.length==1){ + + $(select_object).select2("trigger","select", { + data: data.results[0] + }) + + } + }) + + } not_anon = false; diff --git a/templates/generic_form.html b/templates/generic_form.html index 4a0f7318..a74da9ed 100644 --- a/templates/generic_form.html +++ b/templates/generic_form.html @@ -2,5 +2,5 @@ {% csrf_token %} {{ form }} - - \ No newline at end of file + + \ No newline at end of file