From 63256a4b89be3dfb874b0ceab4dee62a14ff02f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20K=C3=BCttner?= Date: Wed, 9 Oct 2024 11:34:51 +0200 Subject: [PATCH 1/2] added mapping of labormapping in patientfinder condition.groovy --- .../projects/patientfinder/allergyIntolerance.groovy | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/groovy/projects/patientfinder/allergyIntolerance.groovy b/src/main/groovy/projects/patientfinder/allergyIntolerance.groovy index 04456828..10098a59 100644 --- a/src/main/groovy/projects/patientfinder/allergyIntolerance.groovy +++ b/src/main/groovy/projects/patientfinder/allergyIntolerance.groovy @@ -17,7 +17,7 @@ allergyIntolerance { id = "AllergyIntolerance/" + context.source[laborMapping().laborFinding().id()] - final List labFinLabVals = context.source[laborMapping().laborFinding().laborFindingLaborValues()] + final List labFinLabVals = context.source[laborMapping().laborFinding().laborFindingLaborValues()] as List final def lvClinicalStatus = findLabFindLabVal(labFinLabVals, "Allergen.Status") if (lvClinicalStatus) { @@ -43,11 +43,11 @@ allergyIntolerance { final def lflvOnsetStart = findLabFindLabVal(labFinLabVals, "Start") final def lflvOnsetEnd = findLabFindLabVal(labFinLabVals, "Finish") - if (lflvOnsetStart && !lflvOnsetEnd) { + if ((lflvOnsetStart && lflvOnsetStart[DATE_VALUE]) && (!lflvOnsetEnd || !lflvOnsetEnd[DATE_VALUE])) { onsetDateTime { date = lflvOnsetStart[DATE_VALUE][PrecisionDate.DATE] } - } else if (lflvOnsetStart && lflvOnsetEnd) { + } else if ((lflvOnsetStart && lflvOnsetStart[DATE_VALUE]) && (lflvOnsetEnd && lflvOnsetEnd[DATE_VALUE])) { onsetPeriod { start { date = lflvOnsetStart[DATE_VALUE][PrecisionDate.DATE] @@ -59,7 +59,8 @@ allergyIntolerance { } final def lflvRecordedDate = findLabFindLabVal(labFinLabVals, "Record date") - if (lflvRecordedDate) { + + if (lflvRecordedDate && lflvRecordedDate[DATE_VALUE]) { recordedDate = lflvRecordedDate[DATE_VALUE] } From fddbe3ff9ce00facfcdf83f1cae9f4f45464ecb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20K=C3=BCttner?= Date: Wed, 9 Oct 2024 11:37:12 +0200 Subject: [PATCH 2/2] fixed allergyIntolerance script --- src/main/groovy/projects/patientfinder/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/groovy/projects/patientfinder/README.md b/src/main/groovy/projects/patientfinder/README.md index 971b6e4a..1119ce93 100644 --- a/src/main/groovy/projects/patientfinder/README.md +++ b/src/main/groovy/projects/patientfinder/README.md @@ -13,6 +13,9 @@ The following imported data sets are supported/tested: # Change log +## 2024-10-09 +* Fixed AllergyIntolerance script to avoid NPEs when DateValue is null in Finding + ## 2024-06-06 * Disabled diagnostic reports for Hull as long as Bahia has no data mapped to it.