Skip to content

Commit

Permalink
dropdown values stored as array instead of object
Browse files Browse the repository at this point in the history
  • Loading branch information
arhamathar committed Jan 12, 2025
1 parent dfa2851 commit d89e462
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 96 deletions.
138 changes: 69 additions & 69 deletions src/common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
55 changes: 28 additions & 27 deletions src/components/Questionnaire/QuestionTypes/EncounterQuestion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ export function EncounterQuestion({
<SelectValue placeholder={t("select_status")} />
</SelectTrigger>
<SelectContent>
{Object.entries(ENCOUNTER_STATUS).map(([key, value]) => (
<SelectItem key={key} value={value}>
{t(key)}
{ENCOUNTER_STATUS.map((encounterStatus) => (
<SelectItem key={encounterStatus} value={encounterStatus}>
{t(`encounter_status__${encounterStatus}`)}
</SelectItem>
))}
</SelectContent>
Expand All @@ -181,9 +181,9 @@ export function EncounterQuestion({
<SelectValue placeholder={t("select_class")} />
</SelectTrigger>
<SelectContent>
{Object.entries(ENCOUNTER_CLASS).map(([key, value]) => (
<SelectItem key={key} value={value}>
{t(key)}
{ENCOUNTER_CLASS.map((encounterClass) => (
<SelectItem key={encounterClass} value={encounterClass}>
{t(`encounter_class__${encounterClass}`)}
</SelectItem>
))}
</SelectContent>
Expand All @@ -205,9 +205,9 @@ export function EncounterQuestion({
<SelectValue placeholder={t("select_priority")} />
</SelectTrigger>
<SelectContent>
{Object.entries(ENCOUNTER_PRIORITY).map(([key, value]) => (
<SelectItem key={key} value={value}>
{t(key)}
{ENCOUNTER_PRIORITY.map((priority) => (
<SelectItem key={priority} value={priority}>
{t(`encounter_priority__${priority}`)}
</SelectItem>
))}
</SelectContent>
Expand Down Expand Up @@ -284,13 +284,11 @@ export function EncounterQuestion({
<SelectValue placeholder={t("select_admit_source")} />
</SelectTrigger>
<SelectContent>
{Object.entries(ENCOUNTER_ADMIT_SOURCE).map(
([key, value]) => (
<SelectItem key={key} value={value}>
{t(key)}
</SelectItem>
),
)}
{ENCOUNTER_ADMIT_SOURCE.map((admitSource) => (
<SelectItem key={admitSource} value={admitSource}>
{t(`encounter_admit_sources__${admitSource}`)}
</SelectItem>
))}
</SelectContent>
</Select>
</div>
Expand Down Expand Up @@ -324,10 +322,15 @@ export function EncounterQuestion({
/>
</SelectTrigger>
<SelectContent>
{Object.entries(ENCOUNTER_DISCHARGE_DISPOSITION).map(
([key, value]) => (
<SelectItem key={key} value={value}>
{t(key)}
{ENCOUNTER_DISCHARGE_DISPOSITION.map(
(dischargeDisposition) => (
<SelectItem
key={dischargeDisposition}
value={dischargeDisposition}
>
{t(
`encounter_discharge_disposition__${dischargeDisposition}`,
)}
</SelectItem>
),
)}
Expand Down Expand Up @@ -361,13 +364,11 @@ export function EncounterQuestion({
<SelectValue placeholder={t("select_diet_preference")} />
</SelectTrigger>
<SelectContent>
{Object.entries(ENCOUNTER_DIET_PREFERENCE).map(
([key, value]) => (
<SelectItem key={key} value={value}>
{t(key)}
</SelectItem>
),
)}
{ENCOUNTER_DIET_PREFERENCE.map((dietPreference) => (
<SelectItem key={dietPreference} value={dietPreference}>
{t(`encounter_diet_preference__${dietPreference}`)}
</SelectItem>
))}
</SelectContent>
</Select>
</div>
Expand Down

0 comments on commit d89e462

Please sign in to comment.