-
Notifications
You must be signed in to change notification settings - Fork 515
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
diet preference value moved to constants as snake_case #9859
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request introduces new constants related to encounter management in the application, including dietary preferences, statuses, classes, priorities, admit sources, and discharge dispositions. Additionally, the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/common/constants.tsx
(1 hunks)src/components/Questionnaire/QuestionTypes/EncounterQuestion.tsx
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: cypress-run (1)
🔇 Additional comments (3)
src/components/Questionnaire/QuestionTypes/EncounterQuestion.tsx (2)
14-14
: LGTM! Clean import of diet preferences constant.The import statement is well-placed with other imports from the common directory.
396-400
: LGTM! Clean implementation of dynamic diet preferences.The dynamic mapping of diet preferences from constants improves maintainability and follows React best practices.
src/common/constants.tsx (1)
1761-1764
: LGTM! Well-documented deprecated constant.The deprecated constant is properly documented with JSDoc comment and points to the new location.
src/common/constants.tsx
Outdated
export const DIET_PREFERENCE_OPTIONS = [ | ||
{ label: "Vegetarian", value: "vegetarian" }, | ||
{ label: "Dairy Free", value: "diary_free" }, | ||
{ label: "Nut Free", value: "nut_free" }, | ||
{ label: "Gluten Free", value: "gluten_free" }, | ||
{ label: "Vegan", value: "vegan" }, | ||
{ label: "Halal", value: "halal" }, | ||
{ label: "Kosher", value: "kosher" }, | ||
{ label: "None", value: "none" }, | ||
] as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typo in diet preference value.
There's a typo in the "dairy_free" value (currently spelled as "diary_free").
Apply this diff to fix the typo:
- { label: "Dairy Free", value: "diary_free" },
+ { label: "Dairy Free", value: "dairy_free" },
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
export const DIET_PREFERENCE_OPTIONS = [ | |
{ label: "Vegetarian", value: "vegetarian" }, | |
{ label: "Dairy Free", value: "diary_free" }, | |
{ label: "Nut Free", value: "nut_free" }, | |
{ label: "Gluten Free", value: "gluten_free" }, | |
{ label: "Vegan", value: "vegan" }, | |
{ label: "Halal", value: "halal" }, | |
{ label: "Kosher", value: "kosher" }, | |
{ label: "None", value: "none" }, | |
] as const; | |
export const DIET_PREFERENCE_OPTIONS = [ | |
{ label: "Vegetarian", value: "vegetarian" }, | |
{ label: "Dairy Free", value: "dairy_free" }, | |
{ label: "Nut Free", value: "nut_free" }, | |
{ label: "Gluten Free", value: "gluten_free" }, | |
{ label: "Vegan", value: "vegan" }, | |
{ label: "Halal", value: "halal" }, | |
{ label: "Kosher", value: "kosher" }, | |
{ label: "None", value: "none" }, | |
] as const; |
src/common/constants.tsx
Outdated
export const DIET_PREFERENCE_OPTIONS = [ | ||
{ label: "Vegetarian", value: "vegetarian" }, | ||
{ label: "Dairy Free", value: "diary_free" }, | ||
{ label: "Nut Free", value: "nut_free" }, | ||
{ label: "Gluten Free", value: "gluten_free" }, | ||
{ label: "Vegan", value: "vegan" }, | ||
{ label: "Halal", value: "halal" }, | ||
{ label: "Kosher", value: "kosher" }, | ||
{ label: "None", value: "none" }, | ||
] as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only the value list is needed, the label can be kept in i18n texts. Refer README for translation guidelines.
src/common/constants.tsx
Outdated
/** | ||
* @deprecated use `LocalStorageKeys.patientTokenKey` instead | ||
*/ | ||
export const CarePatientTokenKey = LocalStorageKeys.patientTokenKey; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
Do the same for all things present in EncounterQuestion and not just diet preference. Also add i18n translations for all literal strings in the file |
9c6fbd2
to
e3c3e78
Compare
src/common/constants.tsx
Outdated
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_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_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_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_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_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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's just keep an array instead of object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refer how it's done on existing codebase
e3c3e78
to
e0fa855
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/common/constants.tsx (2)
1784-1791
: Add JSDoc comments to explain abbreviations.The encounter class values use abbreviations that may not be immediately clear to other developers. Consider adding JSDoc comments to explain what each abbreviation means (e.g., imp = inpatient, amb = ambulatory, etc.).
+/** + * Encounter class types + * imp - Inpatient encounter + * amb - Ambulatory encounter + * obsenc - Observation encounter + * emer - Emergency encounter + * vr - Virtual encounter + * hh - Home health encounter + */ export const ENCOUNTER_CLASS = [ "imp", "amb", "obsenc", "emer", "vr", "hh", ] as const;
1793-1807
: Standardize casing format for priority values.The priority values mix uppercase ("ASAP") with snake_case format. Standardize all values to use snake_case for consistency.
export const ENCOUNTER_PRIORITY = [ - "ASAP", + "asap", "callback_results", "callback_for_scheduling", "elective", "emergency", "preop", "as_needed", "routine", "rush_reporting", "stat", "timing_critical", "use_as_directed", "urgent", ] as const;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
public/locale/en.json
(10 hunks)src/common/constants.tsx
(1 hunks)src/components/Questionnaire/QuestionTypes/EncounterQuestion.tsx
(12 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/components/Questionnaire/QuestionTypes/EncounterQuestion.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: cypress-run (1)
- GitHub Check: OSSAR-Scan
🔇 Additional comments (5)
src/common/constants.tsx (4)
1772-1782
: LGTM! Well-structured encounter status values.The status values follow a logical progression and use consistent snake_case formatting.
1809-1820
: LGTM! Consistent admit source values.The admit source values use consistent snake_case formatting and are well-organized.
1822-1834
: LGTM! Well-structured discharge disposition values.The discharge disposition values use consistent snake_case formatting and are logically organized.
1761-1770
: 🛠️ Refactor suggestion
⚠️ Potential issueFix typo and refactor to array format.
- Fix the typo in "diary_free" value.
- Refactor to use array format for consistency with existing patterns.
-export const ENCOUNTER_DIET_PREFERENCE = [ - "vegetarian", - "diary_free", - "nut_free", - "gluten_free", - "vegan", - "halal", - "kosher", - "none", -] as const; +export const ENCOUNTER_DIET_PREFERENCE = [ + "vegetarian", + "dairy_free", + "nut_free", + "gluten_free", + "vegan", + "halal", + "kosher", + "none" +] as const;Likely invalid or redundant comment.
public/locale/en.json (1)
351-351
: LGTM! Complete and well-organized translations.All encounter-related constants have corresponding translations with proper naming conventions.
Also applies to: 719-719, 725-725, 816-816, 884-884, 1061-1061, 1120-1120, 1179-1179, 1565-1565, 1696-1696, 1698-1698, 1702-1702, 1703-1703, 1718-1718, 1723-1723
Proposed Changes
@ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit
New Features
Refactor