From 57832e4af3cb07121a2184034cbc7d88404a7f56 Mon Sep 17 00:00:00 2001 From: zaliqarosli Date: Thu, 7 Sep 2023 14:39:20 -0400 Subject: [PATCH 1/6] add match for visit label --- modules/imaging_uploader/jsx/UploadForm.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/imaging_uploader/jsx/UploadForm.js b/modules/imaging_uploader/jsx/UploadForm.js index 3b2fe0251a1..02f1581ac13 100644 --- a/modules/imaging_uploader/jsx/UploadForm.js +++ b/modules/imaging_uploader/jsx/UploadForm.js @@ -67,9 +67,21 @@ class UploadForm extends Component { formData.candID = ids[1]; formData.pSCID = ids[0]; // visitLabel can contain underscores - // join the remaining elements of patientName and use as visitLabel + // join the remaining elements of patientName and pattern match + // against each visit label. Use as visitLabel the best (longest) match ids.splice(0, 2); - formData.visitLabel = ids.join('_'); + suffix = ids.join('_'); + visitLabels = form.visitLabel.options.keys; + bestMatch = ''; + visitLabels.map((visitLabel) => { + if (suffix.match(visitLabel) !== null) { + // consider the first match only + if (suffix.match(visitLabel)[0].length > bestMatch.length) { + bestMatch = suffix.match(visitLabel)[0]; + } + } + }); + formData.visitLabel = bestMatch; } } From 1102e875f885fd91c71c6e091e926193b9af6496 Mon Sep 17 00:00:00 2001 From: zaliqarosli Date: Thu, 7 Sep 2023 15:24:26 -0400 Subject: [PATCH 2/6] fix --- modules/imaging_uploader/jsx/UploadForm.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/modules/imaging_uploader/jsx/UploadForm.js b/modules/imaging_uploader/jsx/UploadForm.js index 02f1581ac13..5dfd8eb3544 100644 --- a/modules/imaging_uploader/jsx/UploadForm.js +++ b/modules/imaging_uploader/jsx/UploadForm.js @@ -70,9 +70,9 @@ class UploadForm extends Component { // join the remaining elements of patientName and pattern match // against each visit label. Use as visitLabel the best (longest) match ids.splice(0, 2); - suffix = ids.join('_'); - visitLabels = form.visitLabel.options.keys; - bestMatch = ''; + const suffix = ids.join('_'); + const visitLabels = Object.keys(form.visitLabel.options); + let bestMatch = ''; visitLabels.map((visitLabel) => { if (suffix.match(visitLabel) !== null) { // consider the first match only @@ -94,9 +94,21 @@ class UploadForm extends Component { formData.candID = ids[1]; formData.pSCID = ids[0]; // visitLabel can contain underscores - // join the remaining elements of patientName and use as visitLabel + // join the remaining elements of patientName and pattern match + // against each visit label. Use as visitLabel the best (longest) match ids.splice(0, 2); - formData.visitLabel = ids.join('_'); + const suffix = ids.join('_'); + const visitLabels = Object.keys(form.visitLabel.options); + let bestMatch = ''; + visitLabels.map((visitLabel) => { + if (suffix.match(visitLabel) !== null) { + // consider the first match only + if (suffix.match(visitLabel)[0].length > bestMatch.length) { + bestMatch = suffix.match(visitLabel)[0]; + } + } + }); + formData.visitLabel = bestMatch; } } From fe737bdb0555267a03ed0bfa50398d262fba95fe Mon Sep 17 00:00:00 2001 From: Zaliqa Date: Thu, 7 Sep 2023 15:44:10 -0400 Subject: [PATCH 3/6] Update modules/imaging_uploader/jsx/UploadForm.js --- modules/imaging_uploader/jsx/UploadForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imaging_uploader/jsx/UploadForm.js b/modules/imaging_uploader/jsx/UploadForm.js index 5dfd8eb3544..eedee72de22 100644 --- a/modules/imaging_uploader/jsx/UploadForm.js +++ b/modules/imaging_uploader/jsx/UploadForm.js @@ -66,7 +66,7 @@ class UploadForm extends Component { let ids = patientName.split('_'); formData.candID = ids[1]; formData.pSCID = ids[0]; - // visitLabel can contain underscores + // visitLabel can contain underscores, filename can have suffix appended to patientName // join the remaining elements of patientName and pattern match // against each visit label. Use as visitLabel the best (longest) match ids.splice(0, 2); From 2ce1697d9ca31f2d9a8e1ab828f55ed179b63190 Mon Sep 17 00:00:00 2001 From: Zaliqa Date: Thu, 7 Sep 2023 15:44:32 -0400 Subject: [PATCH 4/6] Update modules/imaging_uploader/jsx/UploadForm.js --- modules/imaging_uploader/jsx/UploadForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imaging_uploader/jsx/UploadForm.js b/modules/imaging_uploader/jsx/UploadForm.js index eedee72de22..18cd2320943 100644 --- a/modules/imaging_uploader/jsx/UploadForm.js +++ b/modules/imaging_uploader/jsx/UploadForm.js @@ -93,7 +93,7 @@ class UploadForm extends Component { let ids = patientName.split('_'); formData.candID = ids[1]; formData.pSCID = ids[0]; - // visitLabel can contain underscores + // visitLabel can contain underscores, filename can have suffix appended to patientName // join the remaining elements of patientName and pattern match // against each visit label. Use as visitLabel the best (longest) match ids.splice(0, 2); From 7d8a61b717d43d8331415b4ae87d92158a340b87 Mon Sep 17 00:00:00 2001 From: Zaliqa Date: Thu, 7 Sep 2023 15:45:51 -0400 Subject: [PATCH 5/6] Update modules/imaging_uploader/jsx/UploadForm.js --- modules/imaging_uploader/jsx/UploadForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imaging_uploader/jsx/UploadForm.js b/modules/imaging_uploader/jsx/UploadForm.js index 18cd2320943..2c7da5eaa4e 100644 --- a/modules/imaging_uploader/jsx/UploadForm.js +++ b/modules/imaging_uploader/jsx/UploadForm.js @@ -66,7 +66,7 @@ class UploadForm extends Component { let ids = patientName.split('_'); formData.candID = ids[1]; formData.pSCID = ids[0]; - // visitLabel can contain underscores, filename can have suffix appended to patientName + // visitLabel can contain underscores, filename can have suffix appended to PSCID_CandID_VisitLabel // join the remaining elements of patientName and pattern match // against each visit label. Use as visitLabel the best (longest) match ids.splice(0, 2); From abf9c5c4e1954b530b9e1da8bd0bb97c25c06944 Mon Sep 17 00:00:00 2001 From: Zaliqa Date: Thu, 7 Sep 2023 15:46:11 -0400 Subject: [PATCH 6/6] Update modules/imaging_uploader/jsx/UploadForm.js --- modules/imaging_uploader/jsx/UploadForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imaging_uploader/jsx/UploadForm.js b/modules/imaging_uploader/jsx/UploadForm.js index 2c7da5eaa4e..1561f009b20 100644 --- a/modules/imaging_uploader/jsx/UploadForm.js +++ b/modules/imaging_uploader/jsx/UploadForm.js @@ -93,7 +93,7 @@ class UploadForm extends Component { let ids = patientName.split('_'); formData.candID = ids[1]; formData.pSCID = ids[0]; - // visitLabel can contain underscores, filename can have suffix appended to patientName + // visitLabel can contain underscores, filename can have suffix appended to PSCID_CandID_VisitLabel // join the remaining elements of patientName and pattern match // against each visit label. Use as visitLabel the best (longest) match ids.splice(0, 2);