Skip to content

Commit

Permalink
Add GMT+12 MOJURO TimeZone to ReportStream (#16864)
Browse files Browse the repository at this point in the history
* Add GMT+12 MOJURO TimeZone to ReportStream

* Added the enrichment schema for MAJURO timezone

* Fixed Test name
  • Loading branch information
oslynn authored Dec 24, 2024
1 parent 55854a0 commit cd454b9
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 10 deletions.
14 changes: 4 additions & 10 deletions frontend-react/src/utils/TemporarySettingsAPITypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ enum USTimeZone {
EAST_INDIANA = "EAST_INDIANA",
HAWAII = "HAWAII",
INDIANA_STARKE = "INDIANA_STARKE",
MAJURO = "MAJURO",
MICHIGAN = "MICHIGAN",
MOUNTAIN = "MOUNTAIN",
PACIFIC = "PACIFIC",
Expand Down Expand Up @@ -139,10 +140,7 @@ class SampleFilterObject extends SampleObject {

getAllEnums(): Map<string, string[]> {
return new Map<string, string[]>([
[
"Available Filters",
Array.from(Object.values(ReportStreamFilterDefinition)),
],
["Available Filters", Array.from(Object.values(ReportStreamFilterDefinition))],
]);
}

Expand Down Expand Up @@ -221,9 +219,7 @@ class SampleTranslationObj extends SampleObject {
schemaName = "schema";

getAllEnums(): Map<string, string[]> {
return new Map<string, string[]>([
["format", Array.from(Object.values(Format))],
]);
return new Map<string, string[]>([["format", Array.from(Object.values(Format))]]);
}

description(): string {
Expand Down Expand Up @@ -265,9 +261,7 @@ class SampleTransportObject extends SampleObject {
};

getAllEnums(): Map<string, string[]> {
return new Map<string, string[]>([
["GAEN.uuidFormat", Array.from(Object.values(GAENUUIDFormat))],
]);
return new Map<string, string[]>([["GAEN.uuidFormat", Array.from(Object.values(GAENUUIDFormat))]]);
}

description(): string {
Expand Down
3 changes: 3 additions & 0 deletions prime-router/src/main/kotlin/USTimeZone.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
Original file line number Diff line number Diff line change
@@ -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')"]
8 changes: 8 additions & 0 deletions prime-router/src/test/kotlin/ReceiverTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ class CustomTranslationFunctionsTest {
assertThat(tmp).isEqualTo("20150405212211+0900")
}

@org.junit.jupiter.api.Test
fun `test mojuroTimezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
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)
Expand Down

0 comments on commit cd454b9

Please sign in to comment.