diff --git a/src/common/constants.tsx b/src/common/constants.tsx index 20449c65a29..6bf3e151e70 100644 --- a/src/common/constants.tsx +++ b/src/common/constants.tsx @@ -1758,77 +1758,77 @@ export const HEADER_CONTENT_TYPES = { export const ADMIN_USER_TYPES = ["DistrictAdmin", "StateAdmin"] as const; -export const ENCOUNTER_DIET_PREFERENCE = { - encounter_diet_preference__vegetarian: "vegetarian", - encounter_diet_preference__diary_free: "diary_free", - encounter_diet_preference__nut_free: "nut_free", - encounter_diet_preference__gluten_free: "gluten_free", - encounter_diet_preference__vegan: "vegan", - encounter_diet_preference__halal: "halal", - encounter_diet_preference__kosher: "kosher", - encounter_diet_preference__none: "none", -} as const; +export const ENCOUNTER_DIET_PREFERENCE = [ + "vegetarian", + "diary_free", + "nut_free", + "gluten_free", + "vegan", + "halal", + "kosher", + "none", +] as const; -export const ENCOUNTER_STATUS = { - encounter_status__planned: "planned", - encounter_status__in_progress: "in_progress", - encounter_status__on_hold: "on_hold", - encounter_status__discharged: "discharged", - encounter_status__completed: "completed", - encounter_status__cancelled: "cancelled", - encounter_status__discontinued: "discontinued", - encounter_status__entered_in_error: "entered_in_error", - encounter_status__unknown: "unknown", -} as const; +export const ENCOUNTER_STATUS = [ + "planned", + "in_progress", + "on_hold", + "discharged", + "completed", + "cancelled", + "discontinued", + "entered_in_error", + "unknown", +] as const; -export const ENCOUNTER_CLASS = { - encounter_class__imp: "imp", - encounter_class__amb: "amb", - encounter_class__obsenc: "obsenc", - encounter_class__emer: "emer", - encounter_class__vr: "vr", - encounter_class__hh: "hh", -} as const; +export const ENCOUNTER_CLASS = [ + "imp", + "amb", + "obsenc", + "emer", + "vr", + "hh", +] as const; -export const ENCOUNTER_PRIORITY = { - encounter_priority__asap: "ASAP", - encounter_priority__callback_results: "callback_results", - encounter_priority__callback_for_scheduling: "callback_for_scheduling", - encounter_priority__elective: "elective", - encounter_priority__emergency: "emergency", - encounter_priority__preop: "preop", - encounter_priority__as_needed: "as_needed", - encounter_priority__routine: "routine", - encounter_priority__rush_reporting: "rush_reporting", - encounter_priority__stat: "stat", - encounter_priority__timing_critical: "timing_critical", - encounter_priority__use_as_directed: "use_as_directed", - encounter_priority__urgent: "urgent", -} as const; +export const ENCOUNTER_PRIORITY = [ + "ASAP", + "callback_results", + "callback_for_scheduling", + "elective", + "emergency", + "preop", + "as_needed", + "routine", + "rush_reporting", + "stat", + "timing_critical", + "use_as_directed", + "urgent", +] as const; -export const ENCOUNTER_ADMIT_SOURCE = { - encounter_admit_sources__hosp_trans: "hosp_trans", - encounter_admit_sources__emd: "emd", - encounter_admit_sources__outp: "outp", - encounter_admit_sources__born: "born", - encounter_admit_sources__gp: "gp", - encounter_admit_sources__mp: "mp", - encounter_admit_sources__nursing: "nursing", - encounter_admit_sources__psych: "psych", - encounter_admit_sources__rehab: "rehab", - encounter_admit_sources__other: "other", -} as const; +export const ENCOUNTER_ADMIT_SOURCE = [ + "hosp_trans", + "emd", + "outp", + "born", + "gp", + "mp", + "nursing", + "psych", + "rehab", + "other", +] as const; -export const ENCOUNTER_DISCHARGE_DISPOSITION = { - encounter_discharge_disposition__home: "home", - encounter_discharge_disposition__alt_home: "alt_home", - encounter_discharge_disposition__other_hcf: "other_hcf", - encounter_discharge_disposition__hosp: "hosp", - encounter_discharge_disposition__long: "long", - encounter_discharge_disposition__aadvice: "aadvice", - encounter_discharge_disposition__exp: "exp", - encounter_discharge_disposition__psy: "psy", - encounter_discharge_disposition__rehab: "rehab", - encounter_discharge_disposition__snf: "snf", - encounter_discharge_disposition__oth: "oth", -} as const; +export const ENCOUNTER_DISCHARGE_DISPOSITION = [ + "home", + "alt_home", + "other_hcf", + "hosp", + "long", + "aadvice", + "exp", + "psy", + "rehab", + "snf", + "oth", +] as const; diff --git a/src/components/Questionnaire/QuestionTypes/EncounterQuestion.tsx b/src/components/Questionnaire/QuestionTypes/EncounterQuestion.tsx index a81403be26f..de3775fec1c 100644 --- a/src/components/Questionnaire/QuestionTypes/EncounterQuestion.tsx +++ b/src/components/Questionnaire/QuestionTypes/EncounterQuestion.tsx @@ -157,9 +157,9 @@ export function EncounterQuestion({ - {Object.entries(ENCOUNTER_STATUS).map(([key, value]) => ( - - {t(key)} + {ENCOUNTER_STATUS.map((encounterStatus) => ( + + {t(`encounter_status__${encounterStatus}`)} ))} @@ -181,9 +181,9 @@ export function EncounterQuestion({ - {Object.entries(ENCOUNTER_CLASS).map(([key, value]) => ( - - {t(key)} + {ENCOUNTER_CLASS.map((encounterClass) => ( + + {t(`encounter_class__${encounterClass}`)} ))} @@ -205,9 +205,9 @@ export function EncounterQuestion({ - {Object.entries(ENCOUNTER_PRIORITY).map(([key, value]) => ( - - {t(key)} + {ENCOUNTER_PRIORITY.map((priority) => ( + + {t(`encounter_priority__${priority}`)} ))} @@ -284,13 +284,11 @@ export function EncounterQuestion({ - {Object.entries(ENCOUNTER_ADMIT_SOURCE).map( - ([key, value]) => ( - - {t(key)} - - ), - )} + {ENCOUNTER_ADMIT_SOURCE.map((admitSource) => ( + + {t(`encounter_admit_sources__${admitSource}`)} + + ))} @@ -324,10 +322,15 @@ export function EncounterQuestion({ /> - {Object.entries(ENCOUNTER_DISCHARGE_DISPOSITION).map( - ([key, value]) => ( - - {t(key)} + {ENCOUNTER_DISCHARGE_DISPOSITION.map( + (dischargeDisposition) => ( + + {t( + `encounter_discharge_disposition__${dischargeDisposition}`, + )} ), )} @@ -361,13 +364,11 @@ export function EncounterQuestion({ - {Object.entries(ENCOUNTER_DIET_PREFERENCE).map( - ([key, value]) => ( - - {t(key)} - - ), - )} + {ENCOUNTER_DIET_PREFERENCE.map((dietPreference) => ( + + {t(`encounter_diet_preference__${dietPreference}`)} + + ))}