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

Fix: Date of Birth to Year of Birth on Patient Details Page when DOB is Missing #9242

Conversation

AdityaJ2305
Copy link
Contributor

@AdityaJ2305 AdityaJ2305 commented Nov 28, 2024

Proposed Changes

@ohcnetwork/care-fe-code-reviewers

Screenshot

Screenshot 2024-11-29 at 3 51 51 AM

Merge Checklist

  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews

Summary by CodeRabbit

  • New Features

    • Added a new label for "Year of Birth" to enhance localization.
    • Updated the display logic in the Demography component to show either the formatted date of birth or the year of birth based on available data.
  • Bug Fixes

    • Corrected capitalization for "Date of Birth" for consistency in the user interface.

@AdityaJ2305 AdityaJ2305 requested a review from a team as a code owner November 28, 2024 22:26
Copy link
Contributor

coderabbitai bot commented Nov 28, 2024

Walkthrough

The changes include updates to the localization JSON file for English, correcting the capitalization of "date_of_birth" and adding a new key "year_of_birth." Additionally, the Demography component in the PatientDetailsTab has been modified to conditionally display either the formatted date of birth or the calculated year of birth based on the availability of the date. This ensures that if the date of birth is missing, the year of birth will be displayed instead.

Changes

File Path Change Summary
public/locale/en.json - Updated "date_of_birth" from "Date of birth" to "Date of Birth".
- Added new key "year_of_birth" with value "Year of Birth".
src/components/Patient/PatientDetailsTab/Demography.tsx - Imported patientAgeInYears function.
- Updated logic to conditionally display date of birth or calculated year of birth.

Assessment against linked issues

Objective Addressed Explanation
Change Date of Birth to Year of Birth on Patient Details Page when DOB is Missing (#[9241])

Possibly related PRs

Suggested labels

tested, needs review

Suggested reviewers

  • rithviknishad
  • khavinshankar
  • Jacobjeevan

Poem

🐰 In the land of code where rabbits play,
We fixed the words, brightened the day.
"Date of Birth" now stands tall and clear,
With "Year of Birth" to bring us cheer!
Hopping through changes, we dance with delight,
Localization's magic shines ever so bright! 🌟

Warning

Rate limit exceeded

@AdityaJ2305 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 18 minutes and 37 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between aa6ca48 and 32b80e8.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between aa6ca48 and 32b80e8.

📒 Files selected for processing (1)
  • src/components/Patient/PatientDetailsTab/Demography.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/Patient/PatientDetailsTab/Demography.tsx

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Nov 28, 2024

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 32b80e8
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/67495bbdbd1d9500086d43d0
😎 Deploy Preview https://deploy-preview-9242--care-ohc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between fc2ac3b and c399be0.

📒 Files selected for processing (2)
  • public/locale/en.json (2 hunks)
  • src/components/Patient/PatientDetailsTab/Demography.tsx (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • public/locale/en.json
🔇 Additional comments (2)
src/components/Patient/PatientDetailsTab/Demography.tsx (2)

18-18: LGTM: Import addition is appropriate

The addition of patientAgeInYears utility function import is well-placed alongside related utility functions.


191-193: Verify i18n keys for label translation

The dynamic label switching between "date_of_birth" and "year_of_birth" looks good, but let's verify the i18n keys exist.

✅ Verification successful

Translation keys for date/year of birth are properly configured

Both "date_of_birth" and "year_of_birth" translation keys are present in the locale files with appropriate English translations. The dynamic label switching in the code will work as expected.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that both i18n keys exist in the translation files
# Expected: Both keys should be present in the translation files

# Search for the translation keys in all translation files
rg -l "date_of_birth|year_of_birth" "src/**/translations/*.json"

Length of output: 133


Script:

#!/bin/bash
# Let's first find where translation files are located
fd -e json translations

# Then search for the keys in those files
rg --json-keys "date_of_birth|year_of_birth" -l

Length of output: 511


Script:

#!/bin/bash
# Let's first find translation files
fd -e json

# Then search for the keys in those files
rg "\"(date_of_birth|year_of_birth)\"" -l

Length of output: 1060


Script:

#!/bin/bash
# Let's check the actual content of these keys in the locale files
rg -A 1 "\"(date_of_birth|year_of_birth)\"" "public/locale/en.json"

Length of output: 230

src/components/Patient/PatientDetailsTab/Demography.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between c399be0 and aa6ca48.

📒 Files selected for processing (1)
  • src/components/Patient/PatientDetailsTab/Demography.tsx (2 hunks)
🧰 Additional context used
🪛 eslint
src/components/Patient/PatientDetailsTab/Demography.tsx

[error] 18-18: 'patientAgeInYears' is defined but never used. Allowed unused vars must match /^_/u.

(@typescript-eslint/no-unused-vars)

🪛 GitHub Check: lint
src/components/Patient/PatientDetailsTab/Demography.tsx

[failure] 18-18:
'patientAgeInYears' is defined but never used. Allowed unused vars must match /^_/u

🔇 Additional comments (1)
src/components/Patient/PatientDetailsTab/Demography.tsx (1)

191-203: LGTM! Verify i18n keys exist

The implementation looks good:

  • Uses dynamic labeling based on data availability
  • Correctly uses backend-provided year_of_birth
  • Maintains consistent age display format

Let's verify the i18n keys are properly defined:

✅ Verification successful

i18n keys are properly defined and used correctly

Both "date_of_birth" and "year_of_birth" translation keys are present in the English locale file with appropriate translations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the required i18n keys exist in the English locale file

# Search for the required keys in the locale file
rg -A 1 '"date_of_birth"|"year_of_birth"' public/locale/en.json

Length of output: 230

src/components/Patient/PatientDetailsTab/Demography.tsx Outdated Show resolved Hide resolved
@rithviknishad rithviknishad merged commit 7c9751d into ohcnetwork:develop Nov 29, 2024
21 checks passed
Copy link

@AdityaJ2305 Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change Date of Birth to Year of Birth on Patient Details Page when DOB is Missing
3 participants