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

feat(service-portal-health): Add extra doctor info to med cert #16224

Merged
merged 5 commits into from
Oct 7, 2024

Conversation

thordurhhh
Copy link
Member

@thordurhhh thordurhhh commented Oct 1, 2024

What

Add extra doctor info to medicine certificate

Why

It's missing

Screenshot

Screenshot 2024-10-01 at 14 02 22

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Introduced the ExtraDoctors component to display a list of doctors authorized to prescribe Metylphenidate medications.
    • Enhanced the MedicineCertificate screen to conditionally show the ExtraDoctors component based on available data.
  • Documentation

    • Added a new message for internationalization related to doctors authorized to prescribe Metylphenidate.

@thordurhhh thordurhhh added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Oct 1, 2024
@thordurhhh thordurhhh requested a review from a team as a code owner October 1, 2024 14:00
Copy link
Contributor

coderabbitai bot commented Oct 1, 2024

Walkthrough

The changes introduce a new component named ExtraDoctors, which displays a list of doctors authorized to prescribe Metylphenidate medications. This component is conditionally rendered within the MedicineCertificate screen based on the presence of methylDoctors in the certificate object. Additionally, a new internationalized message related to these doctors is added to enhance the application's messaging capabilities.

Changes

File Change Summary
libs/service-portal/health/src/components/ExtraDoctors/index.tsx Introduced ExtraDoctors component that accepts an optional doctors prop and renders doctor names. Added prop interface for doctors.
libs/service-portal/health/src/lib/messages.ts Added new message medicineNameOfDocExtra for doctors authorized to prescribe Metylphenidate.
libs/service-portal/health/src/screens/MedicineCertificate/MedicineCertificate.tsx Integrated ExtraDoctors component into MedicineCertificate screen, conditionally rendering it based on methylDoctors.

Possibly related PRs

  • fix(service-portal): Fix health overview display #14925: This PR introduces the ExtraDoctors component to the MedicineCertificate screen, which is directly related to the changes made in the main PR where the ExtraDoctors component is also introduced and conditionally rendered based on the presence of methylDoctors.
  • fix(service-portal): Add error toast to overveiw #16021: Although primarily focused on error handling, this PR's changes in the overview section may relate to the overall user experience improvements in the service portal, which includes the ExtraDoctors component's integration in the MedicineCertificate screen.

Suggested reviewers

  • thordurhhh
  • disaerna

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.

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.

@thordurhhh thordurhhh added deploy-feature Deploys features to dev and removed deprecated:automerge (Disabled) Merge this PR as soon as all checks pass labels Oct 1, 2024
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: 2

🧹 Outside diff range and nitpick comments (2)
libs/service-portal/health/src/screens/MedicineCertificate/MedicineCertificate.tsx (1)

105-113: LGTM: Addition of ExtraDoctors component with a minor suggestion

The implementation of the ExtraDoctors component rendering is well done and aligns with the PR objective of adding extra doctor information to the medicine certificate. The use of optional chaining and array length check is a good practice for preventing runtime errors.

However, we can slightly optimize the condition for better readability:

{certificate.methylDoctors?.length > 0 && (
  <UserInfoLine
    // ... (rest of the code remains the same)
  />
)}

This change combines the optional chaining with the length check, making it more concise and easier to read.

The component adheres to TypeScript usage for props and allows for effective tree-shaking, which is in line with the coding guidelines for the libs directory.

🧰 Tools
🪛 Biome

[error] 105-105: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

libs/service-portal/health/src/lib/messages.ts (1)

943-947: LGTM! Consider a minor clarification.

The new message medicineNameOfDocExtra is well-structured and consistent with the existing pattern. It provides clear information about doctors authorized to prescribe Metylphenidate medications.

For improved clarity, consider slightly rewording the message:

   medicineNameOfDocExtra: {
     id: 'sp.health:medicine-name-of-doc-extra',
     defaultMessage:
-      'Læknar sem hafa einnig leyfi til að ávísa Metylfenidat lyfjum fyrir einstakling',
+      'Læknar sem hafa einnig leyfi til að ávísa Metylfenidat lyfjum fyrir þennan einstakling',
   },

This change specifies that the authorization is for "this individual" rather than just "an individual", which may be clearer in context.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9ef986b and 893f234.

📒 Files selected for processing (3)
  • libs/service-portal/health/src/components/ExtraDoctors/index.tsx (1 hunks)
  • libs/service-portal/health/src/lib/messages.ts (1 hunks)
  • libs/service-portal/health/src/screens/MedicineCertificate/MedicineCertificate.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
libs/service-portal/health/src/components/ExtraDoctors/index.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/service-portal/health/src/lib/messages.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/service-portal/health/src/screens/MedicineCertificate/MedicineCertificate.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🪛 Biome
libs/service-portal/health/src/components/ExtraDoctors/index.tsx

[error] 18-18: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

libs/service-portal/health/src/screens/MedicineCertificate/MedicineCertificate.tsx

[error] 105-105: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (4)
libs/service-portal/health/src/components/ExtraDoctors/index.tsx (2)

1-6: LGTM: Imports and Props interface are well-defined

The imports and Props interface are correctly implemented, adhering to the coding guidelines:

  • Appropriate use of TypeScript for defining props.
  • Utilization of island.is packages, promoting reusability across NextJS apps.

1-26: Overall assessment: Well-implemented component with minor improvement opportunities

The ExtraDoctors component successfully fulfills the PR objective of adding extra doctor information to the medical certificate. It adheres well to the coding guidelines for libs/** files:

  • Reusable across different NextJS apps
  • Effective use of TypeScript for props and type definitions
  • Utilizes island.is UI components, promoting consistency

The component is well-structured and achieves its purpose efficiently. The suggested improvements in previous comments (combining null checks, adding key props, and adjusting the Box structure) will further enhance its quality and maintainability.

To ensure the component is properly exported and can be imported in other parts of the application, run the following command:

This will help confirm that the component is correctly exported and available for use in other parts of the application.

✅ Verification successful

Copy link
Contributor

github-actions bot commented Oct 1, 2024

Affected services are: service-portal,system-e2e,
Feature deployment of your services will begin shortly. Your feature will be accessible here:
https://healthdoc-extra-beta.dev01.devland.is/minarsidur

Deployed services: service-portal.
Excluded services: ``

Copy link
Member

@disaerna disaerna left a comment

Choose a reason for hiding this comment

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

Is this feature only for methyl doctors?

Looks good 👍🏼

@thordurhhh thordurhhh added deprecated:automerge (Disabled) Merge this PR as soon as all checks pass and removed deploy-feature Deploys features to dev labels Oct 2, 2024
@kodiakhq kodiakhq bot merged commit ea6cc03 into main Oct 7, 2024
25 checks passed
@kodiakhq kodiakhq bot deleted the health/doc-extra branch October 7, 2024 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated:automerge (Disabled) Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants