Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Engagement/jessica/15541 cli add code to condition #15803

Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
9c06530
Removing AOEs and updating condition filter to include RSV
JessicaWNava Aug 20, 2024
1dad44f
Merging changes
JessicaWNava Aug 20, 2024
d9a10fe
Merge branch 'master' of https://github.com/CDCgov/prime-reportstream
JessicaWNava Aug 22, 2024
2152c10
Merge branch 'master' of https://github.com/CDCgov/prime-reportstream
JessicaWNava Aug 28, 2024
f72074c
Merge branch 'master' of https://github.com/CDCgov/prime-reportstream
JessicaWNava Aug 29, 2024
e6cebab
Merge branch 'master' of https://github.com/CDCgov/prime-reportstream
JessicaWNava Sep 4, 2024
aee1237
Merge branch 'master' of https://github.com/CDCgov/prime-reportstream
JessicaWNava Sep 4, 2024
d4bc0ea
Merge branch 'master' of https://github.com/CDCgov/prime-reportstream
JessicaWNava Sep 6, 2024
ce6fe19
Added code to condition to the fhirdata cli tool
JessicaWNava Sep 6, 2024
c712d7f
Merge branch 'master' into engagement/jessica/15541-cli-add-code-to-c…
JessicaWNava Sep 10, 2024
f22cd8a
Merge branch 'master' into engagement/jessica/15541-cli-add-code-to-c…
JessicaWNava Sep 10, 2024
1389637
Merge branch 'master' into engagement/jessica/15541-cli-add-code-to-c…
JessicaWNava Sep 10, 2024
6619452
Merge branch 'master' into engagement/jessica/15541-cli-add-code-to-c…
JessicaWNava Sep 10, 2024
a3abd0e
Merge branch 'master' into engagement/jessica/15541-cli-add-code-to-c…
JessicaWNava Sep 10, 2024
a3e5314
Merge branch 'master' into engagement/jessica/15541-cli-add-code-to-c…
JessicaWNava Sep 10, 2024
b3e615c
Merge branch 'master' into engagement/jessica/15541-cli-add-code-to-c…
JessicaWNava Sep 10, 2024
a59d0ce
Merge branch 'master' into engagement/jessica/15541-cli-add-code-to-c…
JessicaWNava Sep 10, 2024
39584b6
Merge branch 'master' into engagement/jessica/15541-cli-add-code-to-c…
JessicaWNava Sep 10, 2024
6a73ba9
Merge branch 'master' into engagement/jessica/15541-cli-add-code-to-c…
JessicaWNava Sep 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions prime-router/src/main/kotlin/cli/ProcessFhirCommands.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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().storageEnvVar),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

/**
Expand Down
Loading