From e8025be0a9c756743cd09bb7d71ac0c5115103ac Mon Sep 17 00:00:00 2001 From: victor-chaparro <117938212+victor-chaparro@users.noreply.github.com> Date: Wed, 11 Dec 2024 08:54:24 -0700 Subject: [PATCH] Adding some missing transforms from azure and fixing Message Testing API (#16777) --- prime-router/settings/organizations.yml | 2 +- prime-router/src/main/kotlin/azure/ReportFunction.kt | 2 +- .../src/main/kotlin/cli/ProcessFhirCommands.kt | 12 ++++++------ .../SimpleReport/simple-report-sender-transform.yml | 4 ++++ .../receivers/STLTs/PA/PA-receiver-transform.yml | 5 ++++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/prime-router/settings/organizations.yml b/prime-router/settings/organizations.yml index 95eeaa775e8..3b823ffa627 100644 --- a/prime-router/settings/organizations.yml +++ b/prime-router/settings/organizations.yml @@ -1161,7 +1161,7 @@ conditionFilter: # Accept all conditions except Covid results in the LIVD look up table # Covid flows through the Covid pipeline - - "%resource.livdTableLookup('Component').contains('coronavirus').not()" + - "%resource.interpretation.coding.code = 'A' and (%resource.code.coding.extension('https://reportstream.cdc.gov/fhir/StructureDefinition/condition-code').value.where(code in ('840539006')).exists())" timing: operation: MERGE numberPerDay: 1440 # Every minute diff --git a/prime-router/src/main/kotlin/azure/ReportFunction.kt b/prime-router/src/main/kotlin/azure/ReportFunction.kt index 5f4d8bd0a69..44c13ef3075 100644 --- a/prime-router/src/main/kotlin/azure/ReportFunction.kt +++ b/prime-router/src/main/kotlin/azure/ReportFunction.kt @@ -192,7 +192,7 @@ class ReportFunction( null } val bundle = if (result.bundle != null) { - result.bundle.toString() + FhirTranscoder.encode(result.bundle!!) } else { null } diff --git a/prime-router/src/main/kotlin/cli/ProcessFhirCommands.kt b/prime-router/src/main/kotlin/cli/ProcessFhirCommands.kt index 694601cace9..c1a91a09b92 100644 --- a/prime-router/src/main/kotlin/cli/ProcessFhirCommands.kt +++ b/prime-router/src/main/kotlin/cli/ProcessFhirCommands.kt @@ -260,7 +260,7 @@ class ProcessFhirCommands : CliktCommand( val senderSchemaName = when { senderSchema != null -> senderSchema - senderSchemaParam != null -> senderSchemaParam + isCli && senderSchemaParam != null -> senderSchemaParam else -> null } @@ -272,7 +272,7 @@ class ProcessFhirCommands : CliktCommand( receiver != null && receiver.enrichmentSchemaNames.isNotEmpty() -> { receiver.enrichmentSchemaNames.joinToString(",") } - enrichmentSchemaNames != null -> enrichmentSchemaNames + isCli && enrichmentSchemaNames != null -> enrichmentSchemaNames else -> null } @@ -470,19 +470,19 @@ class ProcessFhirCommands : CliktCommand( } val receiverTransformSchemaName = when { - receiver != null && receiver.schemaName.isNotEmpty() -> receiver.enrichmentSchemaNames.joinToString(",") - receiverSchema != null -> receiverSchema + receiver != null && receiver.schemaName.isNotEmpty() -> receiver.schemaName + isCli && receiverSchema != null -> receiverSchema else -> null } if (receiverTransformSchemaName != null) { val message = FhirToHl7Converter( - receiverSchema!!, + receiverTransformSchemaName, BlobAccess.BlobContainerMetadata.build("metadata", Environment.get().storageEnvVar), context = FhirToHl7Context( CustomFhirPathFunctions(), config = HL7TranslationConfig( - hl7Configuration, + hl7Configuration = hl7Configuration, receiver ), translationFunctions = CustomTranslationFunctions(), diff --git a/prime-router/src/main/resources/metadata/fhir_transforms/senders/SimpleReport/simple-report-sender-transform.yml b/prime-router/src/main/resources/metadata/fhir_transforms/senders/SimpleReport/simple-report-sender-transform.yml index 5e3ee512e1e..98295485b30 100644 --- a/prime-router/src/main/resources/metadata/fhir_transforms/senders/SimpleReport/simple-report-sender-transform.yml +++ b/prime-router/src/main/resources/metadata/fhir_transforms/senders/SimpleReport/simple-report-sender-transform.yml @@ -6,6 +6,10 @@ constants: patient: 'Bundle.entry.resource.ofType(Patient)' specimen: 'Bundle.entry.resource.ofType(Specimen)' elements: + - name: sender-identifier + resource: 'Bundle.entry.resource.ofType(MessageHeader)' + bundleProperty: '%resource.extension("https://reportstream.cdc.gov/fhir/StructureDefinition/sender-id").value[x]' + value: [ '"SimpleReport"' ] # MSH - name: sending-application-target-msh3-extension diff --git a/prime-router/src/main/resources/metadata/hl7_mapping/receivers/STLTs/PA/PA-receiver-transform.yml b/prime-router/src/main/resources/metadata/hl7_mapping/receivers/STLTs/PA/PA-receiver-transform.yml index 6c31b1c22b1..350e1ab9d53 100644 --- a/prime-router/src/main/resources/metadata/hl7_mapping/receivers/STLTs/PA/PA-receiver-transform.yml +++ b/prime-router/src/main/resources/metadata/hl7_mapping/receivers/STLTs/PA/PA-receiver-transform.yml @@ -61,4 +61,7 @@ elements: resource: 'Bundle.entry.resource.ofType(Patient).extension("http://ibm.com/fhir/cdm/StructureDefinition/local-race-cd")' condition: '%resource.value[x].coding[0].code = "UNK" or %resource.value.coding[0].code = "ASKU"' value: [ '"U"' ] - hl7Spec: [ '%{PID}-10-1' ] \ No newline at end of file + hl7Spec: [ '%{PID}-10-1' ] + + - name: observation-result-with-aoe + resource: "Bundle.entry.resource.ofType(Observation).where(code.coding.extension('https://reportstream.cdc.gov/fhir/StructureDefinition/condition-code').value.where(code in ('AOE')).exists().not())" \ No newline at end of file