From 9c06530c3ceffd5df5181aa2ac5a068923ef7b41 Mon Sep 17 00:00:00 2001 From: Jessica Willis Date: Tue, 20 Aug 2024 12:30:29 -0700 Subject: [PATCH 1/2] Removing AOEs and updating condition filter to include RSV --- prime-router/settings/STLTs/LA/la-doh.yml | 4 ++-- .../receivers/STLTs/LA/LA-receiver-transform.yml | 6 +++++- .../datatests/FHIR_to_HL7/sample_LA_20240806-0001.hl7 | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/prime-router/settings/STLTs/LA/la-doh.yml b/prime-router/settings/STLTs/LA/la-doh.yml index 3ed991f1d09..dadee90004c 100644 --- a/prime-router/settings/STLTs/LA/la-doh.yml +++ b/prime-router/settings/STLTs/LA/la-doh.yml @@ -77,8 +77,8 @@ - "(Bundle.entry.resource.ofType(MessageHeader).meta.tag.where(system = 'http://terminology.hl7.org/CodeSystem/v2-0103').code = 'P')" reverseTheQualityFilter: false conditionFilter: - # Accept COVID only - - "(%resource.code.coding.extension('https://reportstream.cdc.gov/fhir/StructureDefinition/condition-code').value.where(code in ('840539006')).exists())" + # Accept positive and negative COVID and accepts positive RSV + - "(%resource.code.coding.extension('https://reportstream.cdc.gov/fhir/StructureDefinition/condition-code').value.where(code in ('840539006')).exists()) or (%resource.interpretation.coding.code = 'A' and %resource.code.coding.extension('https://reportstream.cdc.gov/fhir/StructureDefinition/condition-code').value.where(code in ('55735004')).exists())" mappedConditionFilter: [] deidentify: false deidentifiedValue: "" diff --git a/prime-router/src/main/resources/metadata/hl7_mapping/receivers/STLTs/LA/LA-receiver-transform.yml b/prime-router/src/main/resources/metadata/hl7_mapping/receivers/STLTs/LA/LA-receiver-transform.yml index 58e8178b397..abc5e5854a4 100644 --- a/prime-router/src/main/resources/metadata/hl7_mapping/receivers/STLTs/LA/LA-receiver-transform.yml +++ b/prime-router/src/main/resources/metadata/hl7_mapping/receivers/STLTs/LA/LA-receiver-transform.yml @@ -65,4 +65,8 @@ elements: - name: la-patient-county-codes condition: 'Bundle.entry.resource.ofType(Patient).address.district.empty().not() and Bundle.entry.resource.ofType(Patient).address.state.empty().not()' hl7Spec: [ '/PATIENT_RESULT/PATIENT/PID-11-9' ] - value: ["FIPSCountyLookup(Bundle.entry.resource.ofType(Patient).address.district,Bundle.entry.resource.ofType(Patient).address.state)[0]"] \ No newline at end of file + value: ["FIPSCountyLookup(Bundle.entry.resource.ofType(Patient).address.district,Bundle.entry.resource.ofType(Patient).address.state)[0]"] + + - name: observation-result-with-aoe + # LA does not want AOEs at all, so this is overridden to prevent identified AOEs from mapping to an HL7 segment + resource: '%resource.result.resolve()' \ No newline at end of file diff --git a/prime-router/src/testIntegration/resources/datatests/FHIR_to_HL7/sample_LA_20240806-0001.hl7 b/prime-router/src/testIntegration/resources/datatests/FHIR_to_HL7/sample_LA_20240806-0001.hl7 index 7bc5c53c8f0..5e9f64ab108 100644 --- a/prime-router/src/testIntegration/resources/datatests/FHIR_to_HL7/sample_LA_20240806-0001.hl7 +++ b/prime-router/src/testIntegration/resources/datatests/FHIR_to_HL7/sample_LA_20240806-0001.hl7 @@ -1 +1 @@ -MSH|^~\&|CDC PRIME - Atlanta, Georgia (Dekalb)^2.16.840.1.114222.4.1.237821^ISO|Testing Lab^12D4567890^CLIA|LA-ELR^LA-ELR^ISO|LADOH^LADOH^ISO|20240605185501+0000||ORU^R01^ORU_R01|0bab3f94-feb4-4915-939d-1adc5da201f3|P|2.5.1|||NE|NE|USA|UNICODE UTF-8|ENG^English^ISO||PHLabReport-NoAck^ELR_Receiver^2.16.840.1.113883.9.11^ISO SFT|Centers for Disease Control and Prevention|0.2-SNAPSHOT|PRIME ReportStream|0.2-SNAPSHOT||20240605154252+0000 PID|1||7c0d1de9-270e-4d9c-a4ec-af92560cec67^^^Testing Lab&12D4567890&CLIA^PI^Testing Lab&12D4567890&CLIA||Granger^Hermione^^^^^L||19900721|F||2028-9^asian^HL70005^^^^2.5.1^^asian|53 Buttonwood Ave^^Brooklyn^LA^11224^USA^^^22011||(212) 555 1234^PRS^CP^^1^212^5551234^^^^^(212) 555 1234|||||||||N^Not Hispanic or Latino^HL70189^^^^2.9^^Not Hispanic or Latino||||||||N ORC|RE|0bab3f94-feb4-4915-939d-1adc5da201f3^Testing Lab^12D4567890^CLIA|0bab3f94-feb4-4915-939d-1adc5da201f3^Testing Lab^12D4567890^CLIA|||||||||1245319599^McTester^Phil^^^^^^NPI&2.16.840.1.113883.4.6&ISO^L^^^NPI||(530) 867 5309^WPN^PH^^1^530^8675309^^^^^(530) 867 5309|20240605185458+0000||||||Testing Lab^L^^^^CLIA&2.16.840.1.113883.4.7&ISO^XX^^^12D4567890|123 Beach Way^^Denver^LA^80210^USA|(530) 867 5309^WPN^PH^^1^530^8675309^^^^^(530) 867 5309|321 Ocean Drive^^Denver^LA^80210^USA OBR|1|0bab3f94-feb4-4915-939d-1adc5da201f3^Testing Lab^12D4567890^CLIA|0bab3f94-feb4-4915-939d-1adc5da201f3^Testing Lab^12D4567890^CLIA|94531-1^SARS-CoV-2 (COVID-19) RNA panel - Respiratory system specimen by NAA with probe detection^LN|||20240605183958+0000|||||||||1245319599^McTester^Phil^^^^^^NPI&2.16.840.1.113883.4.6&ISO^L^^^NPI|(530) 867 5309^WPN^PH^^1^530^8675309^^^^^(530) 867 5309|||||20240605185501+0000|||F OBX|1|CWE|94500-6^SARS-CoV-2 (COVID-19) RNA [Presence] in Respiratory system specimen by NAA with probe detection^LN^^^^^^COVID-19||260373001^Detected^SCT||Not detected|A^Abnormal^HL70078^^^^2.7|||F|||20240605183958+0000|12D4567890^Testing Lab^CLIA||CareStart COVID-19 MDx RT-PCR_Access Bio, Inc.^CareStart COVID-19 MDx RT-PCR^^^^^^^CareStart COVID-19 MDx RT-PCR_Access Bio, Inc.|^^MNI|20240605185458+0000||||Testing Lab^L^^^^CLIA&2.16.840.1.113883.4.7&ISO^XX^^^12D4567890|123 Beach Way^^Denver^LA^80210^USA OBX|2|CWE|95419-8^Has symptoms related to condition of interest^LN^^^^2.69^^Has symptoms related to condition of interest||Y^Yes^HL70136||||||F|||20240605183958+0000|12D4567890^Testing Lab^CLIA||||||||Testing Lab^L^^^^CLIA&2.16.840.1.113883.4.7&ISO^XX^^^12D4567890|123 Beach Way^^Denver^LA^80210^USA|||||QST OBX|3|DT|11368-8^Illness or injury onset date and time^LN^^^^^^Illness or injury onset date and time||20240601000000+0000||||||F|||20240605183958+0000|12D4567890^Testing Lab^CLIA||||||||Testing Lab^L^^^^CLIA&2.16.840.1.113883.4.7&ISO^XX^^^12D4567890|123 Beach Way^^Denver^LA^80210^USA|||||QST OBX|4|CWE|82810-3^Pregnancy status^LN^^^^2.68^^Pregnancy status||60001007^Not pregnant^SCT||||||F|||20240605183958+0000|12D4567890^Testing Lab^CLIA||||||||Testing Lab^L^^^^CLIA&2.16.840.1.113883.4.7&ISO^XX^^^12D4567890|123 Beach Way^^Denver^LA^80210^USA|||||QST OBX|5|CWE|95418-0^Employed in a healthcare setting^LN^^^^2.69^^Employed in a healthcare setting||Y^Yes^HL70136||||||F|||20240605183958+0000|12D4567890^Testing Lab^CLIA||||||||Testing Lab^L^^^^CLIA&2.16.840.1.113883.4.7&ISO^XX^^^12D4567890|123 Beach Way^^Denver^LA^80210^USA|||||QST OBX|6|CWE|95421-4^Resides in a congregate care setting^LN^^^^2.69^^Resides in a congregate care setting||Y^Yes^HL70136||||||F|||20240605183958+0000|12D4567890^Testing Lab^CLIA||||||||Testing Lab^L^^^^CLIA&2.16.840.1.113883.4.7&ISO^XX^^^12D4567890|123 Beach Way^^Denver^LA^80210^USA|||||QST SPM|1|0bab3f94-feb4-4915-939d-1adc5da201f3&Testing Lab&12D4567890&CLIA^0bab3f94-feb4-4915-939d-1adc5da201f3&Testing Lab&12D4567890&CLIA||258500001^Nasopharyngeal swab^SCT^^^^2.67^^Nasopharyngeal swab||||87100004^Topography unknown (body structure)^SCT^^^^^^Topography unknown (body structure)|||||||||20240605183958+0000|20240605183958+0000 \ No newline at end of file +MSH|^~\&|CDC PRIME - Atlanta, Georgia (Dekalb)^2.16.840.1.114222.4.1.237821^ISO|Testing Lab^12D4567890^CLIA|LA-ELR^LA-ELR^ISO|LADOH^LADOH^ISO|20240605185501+0000||ORU^R01^ORU_R01|0bab3f94-feb4-4915-939d-1adc5da201f3|P|2.5.1|||NE|NE|USA|UNICODE UTF-8|ENG^English^ISO||PHLabReport-NoAck^ELR_Receiver^2.16.840.1.113883.9.11^ISO SFT|Centers for Disease Control and Prevention|0.2-SNAPSHOT|PRIME ReportStream|0.2-SNAPSHOT||20240605154252+0000 PID|1||7c0d1de9-270e-4d9c-a4ec-af92560cec67^^^Testing Lab&12D4567890&CLIA^PI^Testing Lab&12D4567890&CLIA||Granger^Hermione^^^^^L||19900721|F||2028-9^asian^HL70005^^^^2.5.1^^asian|53 Buttonwood Ave^^Brooklyn^LA^11224^USA^^^22011||(212) 555 1234^PRS^CP^^1^212^5551234^^^^^(212) 555 1234|||||||||N^Not Hispanic or Latino^HL70189^^^^2.9^^Not Hispanic or Latino||||||||N ORC|RE|0bab3f94-feb4-4915-939d-1adc5da201f3^Testing Lab^12D4567890^CLIA|0bab3f94-feb4-4915-939d-1adc5da201f3^Testing Lab^12D4567890^CLIA|||||||||1245319599^McTester^Phil^^^^^^NPI&2.16.840.1.113883.4.6&ISO^L^^^NPI||(530) 867 5309^WPN^PH^^1^530^8675309^^^^^(530) 867 5309|20240605185458+0000||||||Testing Lab^L^^^^CLIA&2.16.840.1.113883.4.7&ISO^XX^^^12D4567890|123 Beach Way^^Denver^LA^80210^USA|(530) 867 5309^WPN^PH^^1^530^8675309^^^^^(530) 867 5309|321 Ocean Drive^^Denver^LA^80210^USA OBR|1|0bab3f94-feb4-4915-939d-1adc5da201f3^Testing Lab^12D4567890^CLIA|0bab3f94-feb4-4915-939d-1adc5da201f3^Testing Lab^12D4567890^CLIA|94531-1^SARS-CoV-2 (COVID-19) RNA panel - Respiratory system specimen by NAA with probe detection^LN|||20240605183958+0000|||||||||1245319599^McTester^Phil^^^^^^NPI&2.16.840.1.113883.4.6&ISO^L^^^NPI|(530) 867 5309^WPN^PH^^1^530^8675309^^^^^(530) 867 5309|||||20240605185501+0000|||F OBX|1|CWE|94500-6^SARS-CoV-2 (COVID-19) RNA [Presence] in Respiratory system specimen by NAA with probe detection^LN^^^^^^COVID-19||260373001^Detected^SCT||Not detected|A^Abnormal^HL70078^^^^2.7|||F|||20240605183958+0000|12D4567890^Testing Lab^CLIA||CareStart COVID-19 MDx RT-PCR_Access Bio, Inc.^CareStart COVID-19 MDx RT-PCR^^^^^^^CareStart COVID-19 MDx RT-PCR_Access Bio, Inc.|^^MNI|20240605185458+0000||||Testing Lab^L^^^^CLIA&2.16.840.1.113883.4.7&ISO^XX^^^12D4567890|123 Beach Way^^Denver^LA^80210^USA SPM|1|0bab3f94-feb4-4915-939d-1adc5da201f3&Testing Lab&12D4567890&CLIA^0bab3f94-feb4-4915-939d-1adc5da201f3&Testing Lab&12D4567890&CLIA||258500001^Nasopharyngeal swab^SCT^^^^2.67^^Nasopharyngeal swab||||87100004^Topography unknown (body structure)^SCT^^^^^^Topography unknown (body structure)|||||||||20240605183958+0000|20240605183958+0000 \ No newline at end of file From ce6fe19f8a6ab797f825189caa173e2a0e513060 Mon Sep 17 00:00:00 2001 From: Jessica Willis Date: Fri, 6 Sep 2024 12:44:30 -0400 Subject: [PATCH 2/2] Added code to condition to the fhirdata cli tool --- .../main/kotlin/cli/ProcessFhirCommands.kt | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/prime-router/src/main/kotlin/cli/ProcessFhirCommands.kt b/prime-router/src/main/kotlin/cli/ProcessFhirCommands.kt index 95b2ebf85f4..572d88a10a2 100644 --- a/prime-router/src/main/kotlin/cli/ProcessFhirCommands.kt +++ b/prime-router/src/main/kotlin/cli/ProcessFhirCommands.kt @@ -18,8 +18,11 @@ import fhirengine.engine.CustomFhirPathFunctions import fhirengine.engine.CustomTranslationFunctions import gov.cdc.prime.router.ActionLogger import gov.cdc.prime.router.Hl7Configuration +import gov.cdc.prime.router.Metadata import gov.cdc.prime.router.MimeFormat import gov.cdc.prime.router.azure.BlobAccess +import gov.cdc.prime.router.azure.ConditionStamper +import gov.cdc.prime.router.azure.LookupTableConditionMapper import gov.cdc.prime.router.cli.helpers.HL7DiffHelper import gov.cdc.prime.router.common.Environment import gov.cdc.prime.router.common.JacksonMapperUtilities @@ -33,6 +36,7 @@ import gov.cdc.prime.router.fhirengine.translation.hl7.utils.CustomContext import gov.cdc.prime.router.fhirengine.translation.hl7.utils.FhirPathUtils import gov.cdc.prime.router.fhirengine.utils.FhirTranscoder import gov.cdc.prime.router.fhirengine.utils.HL7Reader +import gov.cdc.prime.router.fhirengine.utils.getObservations import org.hl7.fhir.r4.model.Base import org.hl7.fhir.r4.model.Bundle import org.hl7.fhir.r4.model.Extension @@ -155,6 +159,10 @@ class ProcessFhirCommands : CliktCommand( else -> { val bundle = applySenderTransforms(fhirMessage) + val stamper = ConditionStamper(LookupTableConditionMapper(Metadata.getInstance())) + fhirMessage.getObservations().forEach { observation -> + stamper.stampObservation(observation) + } FhirToHl7Converter( receiverSchema!!, BlobAccess.BlobContainerMetadata.build("metadata", Environment.get().blobEnvVar), @@ -183,6 +191,10 @@ class ProcessFhirCommands : CliktCommand( */ private fun convertFhirToFhir(jsonString: String): Bundle { var fhirMessage = FhirTranscoder.decode(jsonString) + val stamper = ConditionStamper(LookupTableConditionMapper(Metadata.getInstance())) + fhirMessage.getObservations().forEach { observation -> + stamper.stampObservation(observation) + } fhirMessage = applyEnrichmentSchemas(fhirMessage) if (receiverSchema == null && senderSchema == null) { // Must have at least one schema or else why are you doing this @@ -220,10 +232,17 @@ class ProcessFhirCommands : CliktCommand( } val hl7profile = HL7Reader.getMessageProfile(hl7message.toString()) // search hl7 profile map and create translator with config path if found - return when (val configPath = HL7Reader.profileDirectoryMap[hl7profile]) { - null -> Pair(HL7toFhirTranslator(inputSchema).translate(hl7message), hl7message) - else -> Pair(HL7toFhirTranslator(configPath).translate(hl7message), hl7message) + val fhirMessage = when (val configPath = HL7Reader.profileDirectoryMap[hl7profile]) { + null -> HL7toFhirTranslator(inputSchema).translate(hl7message) + else -> HL7toFhirTranslator(configPath).translate(hl7message) } + + val stamper = ConditionStamper(LookupTableConditionMapper(Metadata.getInstance())) + fhirMessage.getObservations().forEach { observation -> + stamper.stampObservation(observation) + } + + return Pair(fhirMessage, hl7message) } /**