diff --git a/frontend-react/src/utils/TemporarySettingsAPITypes.ts b/frontend-react/src/utils/TemporarySettingsAPITypes.ts index b004941d1d7..c2fec0ebc39 100644 --- a/frontend-react/src/utils/TemporarySettingsAPITypes.ts +++ b/frontend-react/src/utils/TemporarySettingsAPITypes.ts @@ -66,6 +66,7 @@ enum USTimeZone { EAST_INDIANA = "EAST_INDIANA", HAWAII = "HAWAII", INDIANA_STARKE = "INDIANA_STARKE", + MAJURO = "MAJURO", MICHIGAN = "MICHIGAN", MOUNTAIN = "MOUNTAIN", PACIFIC = "PACIFIC", @@ -139,10 +140,7 @@ class SampleFilterObject extends SampleObject { getAllEnums(): Map { return new Map([ - [ - "Available Filters", - Array.from(Object.values(ReportStreamFilterDefinition)), - ], + ["Available Filters", Array.from(Object.values(ReportStreamFilterDefinition))], ]); } @@ -221,9 +219,7 @@ class SampleTranslationObj extends SampleObject { schemaName = "schema"; getAllEnums(): Map { - return new Map([ - ["format", Array.from(Object.values(Format))], - ]); + return new Map([["format", Array.from(Object.values(Format))]]); } description(): string { @@ -265,9 +261,7 @@ class SampleTransportObject extends SampleObject { }; getAllEnums(): Map { - return new Map([ - ["GAEN.uuidFormat", Array.from(Object.values(GAENUUIDFormat))], - ]); + return new Map([["GAEN.uuidFormat", Array.from(Object.values(GAENUUIDFormat))]]); } description(): string { diff --git a/prime-router/src/main/kotlin/USTimeZone.kt b/prime-router/src/main/kotlin/USTimeZone.kt index 7d0d61d0395..ab26dfd0d0c 100644 --- a/prime-router/src/main/kotlin/USTimeZone.kt +++ b/prime-router/src/main/kotlin/USTimeZone.kt @@ -17,4 +17,7 @@ enum class USTimeZone(val zoneId: String) { // not technically a US time zone but we need it UTC("UTC"), + + // Marshall Island timezone (UTC+12) + MAJURO("Pacific/Majuro"), } \ No newline at end of file diff --git a/prime-router/src/main/resources/metadata/fhir_transforms/common/datetime-to-local-majuro.yml b/prime-router/src/main/resources/metadata/fhir_transforms/common/datetime-to-local-majuro.yml new file mode 100644 index 00000000000..d72e00f11a2 --- /dev/null +++ b/prime-router/src/main/resources/metadata/fhir_transforms/common/datetime-to-local-majuro.yml @@ -0,0 +1,12 @@ +elements: + - name: hl7-datetime-to-local + resource: "Bundle.descendants().where(url='https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time')" + bundleProperty: "%resource.value[x]" + value: ["%resource.value.changeTimezone('Pacific/Majuro')"] + + + - name: message-date-time-to-local + resource: 'Bundle.entry.resource.ofType(MessageHeader).extension("https://reportstream.cdc.gov/fhir/StructureDefinition/msh-message-header").extension("MSH.7")' + condition: '%resource.value.exists()' + bundleProperty: '%resource.value[x]' + value: ["%resource.value.changeTimezone('Pacific/Majuro')"] diff --git a/prime-router/src/test/kotlin/ReceiverTests.kt b/prime-router/src/test/kotlin/ReceiverTests.kt index 084dc7059d2..a1933b36fc9 100644 --- a/prime-router/src/test/kotlin/ReceiverTests.kt +++ b/prime-router/src/test/kotlin/ReceiverTests.kt @@ -3,6 +3,7 @@ package gov.cdc.prime.router import assertk.assertThat import assertk.assertions.isEqualTo import assertk.assertions.isFalse +import assertk.assertions.isNotEqualTo import assertk.assertions.isNull import assertk.assertions.isTrue import gov.cdc.prime.router.unittest.UnitTestUtils @@ -273,4 +274,11 @@ internal class ReceiverTests { val receiver = Receiver("elr", "IGNORE", Topic.COVID_19, CustomerStatus.INACTIVE, translatorConfig) assertThat(receiver.transportType.type).isEqualTo("NULL") } + + @Test + fun `test MAJURO receiver timezone`() { + val shouldWork1 = + ZonedDateTime.of(2024, 12, 20, 0, 0, 0, 0, ZoneId.of(USTimeZone.MAJURO.zoneId)).toOffsetDateTime() + assertThat(shouldWork1).isNotEqualTo("2024-12-20T00:00+12:00") + } } \ No newline at end of file diff --git a/prime-router/src/test/kotlin/fhirengine/engine/CustomTranslationFunctionsTest.kt b/prime-router/src/test/kotlin/fhirengine/engine/CustomTranslationFunctionsTest.kt index d9ad4230a21..7826db3bf88 100644 --- a/prime-router/src/test/kotlin/fhirengine/engine/CustomTranslationFunctionsTest.kt +++ b/prime-router/src/test/kotlin/fhirengine/engine/CustomTranslationFunctionsTest.kt @@ -81,6 +81,19 @@ class CustomTranslationFunctionsTest { assertThat(tmp).isEqualTo("20150405212211+0900") } + @org.junit.jupiter.api.Test + fun `test mojuroTimezone with convertDateTimeToHL7`() { + val timezoneParameters1: MutableList> = + mutableListOf(mutableListOf(StringType("Pacific/Majuro"))) + val adjustedDateTime = + CustomFHIRFunctions.changeTimezone( + mutableListOf(DateTimeType("2015-04-05T12:22:11Z")), + timezoneParameters1 + )[0] as DateTimeType + val tmp1 = Hl7TranslationFunctions().convertDateTimeToHL7(adjustedDateTime) + assertThat(tmp1).isEqualTo("20150406002211+1200") + } + @org.junit.jupiter.api.Test fun `test convertDateTimeToHL7 with CustomContext with receiver setting`() { val receiver = mockkClass(Receiver::class, relaxed = true)