From fc044e59c006bf178785cab60a04bc45c7652e9e Mon Sep 17 00:00:00 2001 From: Christian Ohr Date: Fri, 24 Jan 2025 12:25:58 +0100 Subject: [PATCH] #464: fix "unknown" gender translation between HL7v2 and HL7v3 --- .../translation/AbstractHl7TranslatorV2toV3.groovy | 12 +++++++++--- .../translation/PixFeedRequest3to2Translator.groovy | 2 ++ .../pixfeed/v2/PIX_FEED_REV_Maximal_Request.hl7 | 2 +- .../pixfeed/v3/PIX_FEED_REV_Maximal_Request.xml | 2 +- .../test/resources/translation/pixsource/v2/A04.hl7 | 2 +- .../translation/pixsource/v3/A04_Response.xml | 2 +- src/site/changes.xml | 3 +++ 7 files changed, 18 insertions(+), 7 deletions(-) diff --git a/commons/ihe/hl7v3/src/main/groovy/org/openehealth/ipf/commons/ihe/hl7v3/translation/AbstractHl7TranslatorV2toV3.groovy b/commons/ihe/hl7v3/src/main/groovy/org/openehealth/ipf/commons/ihe/hl7v3/translation/AbstractHl7TranslatorV2toV3.groovy index 882a9cba21..5bd771d03f 100644 --- a/commons/ihe/hl7v3/src/main/groovy/org/openehealth/ipf/commons/ihe/hl7v3/translation/AbstractHl7TranslatorV2toV3.groovy +++ b/commons/ihe/hl7v3/src/main/groovy/org/openehealth/ipf/commons/ihe/hl7v3/translation/AbstractHl7TranslatorV2toV3.groovy @@ -102,12 +102,18 @@ abstract class AbstractHl7TranslatorV2toV3 implements Hl7TranslatorV2toV3 { translateTelecom(builder, pid[13], homePhoneCode) translateTelecom(builder, pid[14], workPhoneCode) - String gender = (pid[8].value ?: '').mapReverse('hl7v2v3-bidi-administrativeGender-administrativeGender') + if (pid[8].value == 'U') { + builder.administrativeGenderCode(nullFlavor: 'UNK') + } else { + String gender = (pid[8].value ?: '').mapReverse('hl7v2v3-bidi-administrativeGender-administrativeGender') + if (gender) + builder.administrativeGenderCode(code: gender) + } + String maritalStatus = (pid[16].value ?: '').mapReverse('hl7v2v3-patient-maritalStatus') String religiousAffiliation = pid[17].value ?: '' - if (gender) - builder.administrativeGenderCode(code: gender) + if (pid[7][1].value) builder.birthTime(value: pid[7][1].value) diff --git a/commons/ihe/hl7v3/src/main/groovy/org/openehealth/ipf/commons/ihe/hl7v3/translation/PixFeedRequest3to2Translator.groovy b/commons/ihe/hl7v3/src/main/groovy/org/openehealth/ipf/commons/ihe/hl7v3/translation/PixFeedRequest3to2Translator.groovy index 36a3dad5f5..b92382279d 100644 --- a/commons/ihe/hl7v3/src/main/groovy/org/openehealth/ipf/commons/ihe/hl7v3/translation/PixFeedRequest3to2Translator.groovy +++ b/commons/ihe/hl7v3/src/main/groovy/org/openehealth/ipf/commons/ihe/hl7v3/translation/PixFeedRequest3to2Translator.groovy @@ -213,6 +213,8 @@ class PixFeedRequest3to2Translator implements Hl7TranslatorV3toV2 { grp.PID[7][1].value = dropTimeZone(person.birthTime.@value.text()) if (person.administrativeGenderCode.@code.text()) { grp.PID[8].value = person.administrativeGenderCode.@code.text().map('hl7v2v3-bidi-administrativeGender-administrativeGender') + } else if (person.administrativeGenderCode.@nullFlavor.text() == "UNK") { + grp.PID[8].value = 'U' } if (person.raceCode) { diff --git a/commons/ihe/hl7v3/src/test/resources/translation/pixfeed/v2/PIX_FEED_REV_Maximal_Request.hl7 b/commons/ihe/hl7v3/src/test/resources/translation/pixfeed/v2/PIX_FEED_REV_Maximal_Request.hl7 index b52e4795ec..86ac31b9f0 100644 --- a/commons/ihe/hl7v3/src/test/resources/translation/pixfeed/v2/PIX_FEED_REV_Maximal_Request.hl7 +++ b/commons/ihe/hl7v3/src/test/resources/translation/pixfeed/v2/PIX_FEED_REV_Maximal_Request.hl7 @@ -1 +1 @@ -MSH|^~\&|1.2.840.114350.1.13.99998.8734^1.2.840.114350.1.13.99998.8734^ISO|unknown|1.2.840.114350.1.13.99999.4567^1.2.840.114350.1.13.99999.4567^ISO|unknown|20091112115139||ADT^A08|678@21acf7be-007c-41e6-b176-d0969794983b|P^T|2.3.1 EVN|A08|20091112115139 PID|||PIX10515W3^^^HIMSS2005&1.3.6.1.4.1.21367.2005.1.1&ISO~PIX10515W4^^^&1.2.3.4.5.1000&ISO~PIX10515W5^^^domain2~""^^^&1.12.23.34.45&ISO||WASHINGTON-UPDATE^MARY^ROSE^II^Dr.^^L~^ANNE^^^^^L~DEAN^^^^^^B||19771208|F||1004-1~1004-2|1 UPDATE ADDRESS^^CHICAGO^IL^60523^US~100 JORIE BLVD^^CHICAGO^IL^60555||012-0001^PRN^PH~012-0003^PRN^CP~012-0004^PRN^FX~marywash@gmx.de^NET^Internet|012-0002^WPN^PH|eng|M|1022|100-09-123456^^^&1.2.3&ISO|100-09-1234|||2178-2~2178-3|Chicago PV1||O \ No newline at end of file +MSH|^~\&|1.2.840.114350.1.13.99998.8734^1.2.840.114350.1.13.99998.8734^ISO|unknown|1.2.840.114350.1.13.99999.4567^1.2.840.114350.1.13.99999.4567^ISO|unknown|20091112115139||ADT^A08|678@21acf7be-007c-41e6-b176-d0969794983b|P^T|2.3.1 EVN|A08|20091112115139 PID|||PIX10515W3^^^HIMSS2005&1.3.6.1.4.1.21367.2005.1.1&ISO~PIX10515W4^^^&1.2.3.4.5.1000&ISO~PIX10515W5^^^domain2~""^^^&1.12.23.34.45&ISO||WASHINGTON-UPDATE^MARY^ROSE^II^Dr.^^L~^ANNE^^^^^L~DEAN^^^^^^B||19771208|U||1004-1~1004-2|1 UPDATE ADDRESS^^CHICAGO^IL^60523^US~100 JORIE BLVD^^CHICAGO^IL^60555||012-0001^PRN^PH~012-0003^PRN^CP~012-0004^PRN^FX~marywash@gmx.de^NET^Internet|012-0002^WPN^PH|eng|M|1022|100-09-123456^^^&1.2.3&ISO|100-09-1234|||2178-2~2178-3|Chicago PV1||O \ No newline at end of file diff --git a/commons/ihe/hl7v3/src/test/resources/translation/pixfeed/v3/PIX_FEED_REV_Maximal_Request.xml b/commons/ihe/hl7v3/src/test/resources/translation/pixfeed/v3/PIX_FEED_REV_Maximal_Request.xml index 1994349146..8115800907 100644 --- a/commons/ihe/hl7v3/src/test/resources/translation/pixfeed/v3/PIX_FEED_REV_Maximal_Request.xml +++ b/commons/ihe/hl7v3/src/test/resources/translation/pixfeed/v3/PIX_FEED_REV_Maximal_Request.xml @@ -57,7 +57,7 @@ - +