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

Add Missing Timezone to RS #17037

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions frontend-react/src/utils/TemporarySettingsAPITypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,22 @@ enum USTimeZone {
ARIZONA = "ARIZONA",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need more research for Zone Name.

CENTRAL = "CENTRAL",
CHAMORRO = "CHAMORRO",
CHUUK = "CHUUK",
EASTERN = "EASTERN",
EAST_INDIANA = "EAST_INDIANA",
HAWAII = "HAWAII",
INDIANA_STARKE = "INDIANA_STARKE",
MAJURO = "MAJURO",
MICHIGAN = "MICHIGAN",
MOUNTAIN = "MOUNTAIN",
NORTHERN_MARIANA_ISLANDS = "NORTHERN_MARIANA_ISLANDS",
PACIFIC = "PACIFIC",
PALAU = "PALAU",
PUERTO_RICO = "PUERTO_RICO",
POHNPEI = "POHNPEI",
KOSRAE = "KOSRAE",
SAMOA = "SAMOA",
US_VIRGIN_ISLANDS = "US_VIRGIN_ISLANDS",
UTC = "UTC",
}

Expand Down
30 changes: 18 additions & 12 deletions prime-router/src/main/kotlin/USTimeZone.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@ package gov.cdc.prime.router

/** The time zones our partners are in */
enum class USTimeZone(val zoneId: String) {
PACIFIC("US/Pacific"),
MOUNTAIN("US/Mountain"),
ARIZONA("US/Arizona"),
CENTRAL("US/Central"),
EASTERN("US/Eastern"),
SAMOA("US/Samoa"),
HAWAII("US/Hawaii"),
EAST_INDIANA("US/East-Indiana"),
INDIANA_STARKE("US/Indiana-Starke"),
MICHIGAN("US/Michigan"),
CHAMORRO("Pacific/Guam"),
ALASKA("US/Alaska"),
PACIFIC("US/Pacific"), // For US Pacific timezone
MOUNTAIN("US/Mountain"), // For US Mountain timezone
ARIZONA("US/Arizona"), // For Arizona timezone (no daylight savings)
CENTRAL("US/Central"), // For US Central timezone
EASTERN("US/Eastern"), // For US Eastern timezone
SAMOA("US/Samoa"), // For American Samoa timezone
HAWAII("US/Hawaii"), // For Hawaii timezone
EAST_INDIANA("US/East-Indiana"), // For Eastern Indiana timezone
INDIANA_STARKE("US/Indiana-Starke"), // For Starke County, Indiana timezone
MICHIGAN("US/Michigan"), // For Michigan timezone
CHAMORRO("Pacific/Guam"), // For Guam and Chamorro timezone
ALASKA("US/Alaska"), // For Alaska timezone
PUERTO_RICO("America/Puerto_Rico"), // For Puerto Rico timezone
US_VIRGIN_ISLANDS("America/St_Thomas"), // For US Virgin Islands timezone
CHUUK("Pacific/Chuuk"), // For Chuuk, Micronesia timezone
POHNPEI("Pacific/Pohnpei"), // For Pohnpei, Micronesia timezone
KOSRAE("Pacific/Kosrae"), // For Kosrae, Micronesia timezone
NORTHERN_MARIANA_ISLANDS("Pacific/Guam"), // For Northern Mariana Islands timezone

// not technically a US time zone but we need it
UTC("UTC"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class CustomTranslationFunctionsTest {
}

@org.junit.jupiter.api.Test
fun `test mojuroTimezone with convertDateTimeToHL7`() {
fun `test MajuroTimezone for Marshall Island timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("Pacific/Majuro")))
val adjustedDateTime =
Expand All @@ -94,6 +94,97 @@ class CustomTranslationFunctionsTest {
assertThat(tmp1).isEqualTo("20150406002211+1200")
}

@org.junit.jupiter.api.Test
fun `test Puerto_RicoTimezone for Puerto Rico timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("America/Puerto_Rico")))
val adjustedDateTime =
CustomFHIRFunctions.changeTimezone(
mutableListOf(DateTimeType("2015-04-05T12:22:11Z")),
timezoneParameters1
)[0] as DateTimeType
val tmp1 = Hl7TranslationFunctions().convertDateTimeToHL7(adjustedDateTime)
assertThat(tmp1).isEqualTo("20150405082211-0400")
}

@org.junit.jupiter.api.Test
fun `test US_Virgin_IslandsTimezone for US Virgin Island timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("America/St_Thomas")))
val adjustedDateTime =
CustomFHIRFunctions.changeTimezone(
mutableListOf(DateTimeType("2015-04-05T12:22:11Z")),
timezoneParameters1
)[0] as DateTimeType
val tmp1 = Hl7TranslationFunctions().convertDateTimeToHL7(adjustedDateTime)
assertThat(tmp1).isEqualTo("20150405082211-0400")
}

@org.junit.jupiter.api.Test
fun `test ChuukTimezone for Micronesia timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("Pacific/Port_Moresby")))
val adjustedDateTime =
CustomFHIRFunctions.changeTimezone(
mutableListOf(DateTimeType("2015-04-05T12:22:11Z")),
timezoneParameters1
)[0] as DateTimeType
val tmp1 = Hl7TranslationFunctions().convertDateTimeToHL7(adjustedDateTime)
assertThat(tmp1).isEqualTo("20150405222211+1000")
}

@org.junit.jupiter.api.Test
fun `test PohnpeiTimezone for Micronesia timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("Pacific/Guadalcanal")))
val adjustedDateTime =
CustomFHIRFunctions.changeTimezone(
mutableListOf(DateTimeType("2015-04-05T12:22:11Z")),
timezoneParameters1
)[0] as DateTimeType
val tmp1 = Hl7TranslationFunctions().convertDateTimeToHL7(adjustedDateTime)
assertThat(tmp1).isEqualTo("20150405232211+1100")
}

@org.junit.jupiter.api.Test
fun `test KosraeTimezone for Micronesia timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("Pacific/Kosrae")))
val adjustedDateTime =
CustomFHIRFunctions.changeTimezone(
mutableListOf(DateTimeType("2015-04-05T12:22:11Z")),
timezoneParameters1
)[0] as DateTimeType
val tmp1 = Hl7TranslationFunctions().convertDateTimeToHL7(adjustedDateTime)
assertThat(tmp1).isEqualTo("20150405232211+1100")
}

@org.junit.jupiter.api.Test
fun `test Northern_Mariana_IslandsTimezone for Northern Mariana Islands timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("Pacific/Saipan")))
val adjustedDateTime =
CustomFHIRFunctions.changeTimezone(
mutableListOf(DateTimeType("2015-04-05T12:22:11Z")),
timezoneParameters1
)[0] as DateTimeType
val tmp1 = Hl7TranslationFunctions().convertDateTimeToHL7(adjustedDateTime)
assertThat(tmp1).isEqualTo("20150405222211+1000")
}

@org.junit.jupiter.api.Test
fun `test PauluTimezone for Palau timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("Pacific/Palau")))
val adjustedDateTime =
CustomFHIRFunctions.changeTimezone(
mutableListOf(DateTimeType("2015-04-05T12:22:11Z")),
timezoneParameters1
)[0] as DateTimeType
val tmp1 = Hl7TranslationFunctions().convertDateTimeToHL7(adjustedDateTime)
assertThat(tmp1).isEqualTo("20150405212211+0900")
}

@org.junit.jupiter.api.Test
fun `test convertDateTimeToHL7 with CustomContext with receiver setting`() {
val receiver = mockkClass(Receiver::class, relaxed = true)
Expand Down
Loading