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

Rewamp UX for symptoms and diagnosis in EncounterQuestionnaire #9644

Merged
merged 2 commits into from
Jan 2, 2025

Conversation

bodhish
Copy link
Member

@bodhish bodhish commented Jan 2, 2025

This pull request includes significant updates to the EncounterQuestionnaire, DiagnosisQuestion, and SymptomQuestion components to improve the user interface and functionality. The primary changes involve refactoring the components to use new UI elements and simplifying state management.

Changes to EncounterQuestionnaire:

  • Simplified the layout by removing the outer div and adjusting the padding and margin of the Card component. (src/components/Patient/EncounterQuestionnaire.tsx) [1] [2]

Changes to DiagnosisQuestion:

  • Replaced the Command component with DropdownMenu for selecting diagnoses, and introduced a new ValueSetSelect component for searching and adding diagnoses. (src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx)
  • Refactored the diagnosis table to use a grid layout, and created a new DiagnosisItem component to handle individual diagnosis entries. (src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx)

Changes to SymptomQuestion:

  • Similar to DiagnosisQuestion, replaced the Command component with DropdownMenu and introduced ValueSetSelect for adding symptoms. (src/components/Questionnaire/QuestionTypes/SymptomQuestion.tsx)
  • Refactored the symptom management functions to simplify state updates and improve code readability. (src/components/Questionnaire/QuestionTypes/SymptomQuestion.tsx)

@ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • 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
  • Completion of QA

Summary by CodeRabbit

  • New Features

    • Enhanced diagnosis and symptom management with more intuitive interfaces
    • Improved questionnaire form layout and spacing
    • Added more robust type safety for questionnaire components
  • Bug Fixes

    • Refined component rendering to improve user experience
    • Simplified state management for diagnosis and symptom tracking
  • Style

    • Updated component layouts with more responsive design
    • Improved vertical spacing and component organization

…improved layout and functionality; enhance SymptomQuestion with new dropdown menu and symptom management features.
…with a new UI structure, including dropdown menus for clinical status and verification, and improved handling of diagnosis items. Introduce a new DiagnosisItem component for better code organization and maintainability. Update SymptomQuestion to improve symptom display with truncation for long text.
@bodhish bodhish requested a review from a team as a code owner January 2, 2025 08:06
@bodhish bodhish requested a review from Copilot January 2, 2025 08:06
Copy link
Contributor

coderabbitai bot commented Jan 2, 2025

Walkthrough

This pull request focuses on refactoring and improving several questionnaire-related components in the patient management system. The changes primarily involve restructuring the layout, enhancing type safety, and introducing more modular component designs across EncounterQuestionnaire, DiagnosisQuestion, SymptomQuestion, and QuestionnaireForm components. The modifications aim to create more responsive and maintainable code with improved user interface elements and more precise type definitions.

Changes

File Change Summary
src/components/Patient/EncounterQuestionnaire.tsx Simplified layout with direct margin and padding class applications to Card and CardContent components
src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx - Updated type safety for question prop
- Introduced DIAGNOSIS_INITIAL_VALUE
- Added DiagnosisItem component
- Replaced table with responsive layout
src/components/Questionnaire/QuestionTypes/SymptomQuestion.tsx - Enhanced type definitions
- Added SYMPTOM_INITIAL_VALUE
- Introduced SymptomItem component
- Improved symptom management logic
src/components/Questionnaire/QuestionnaireForm.tsx - Added spacing adjustments
- Streamlined rendering logic
- Improved button and form layout

Sequence Diagram

sequenceDiagram
    participant User
    participant QuestionnaireForm
    participant DiagnosisQuestion
    participant SymptomQuestion
    
    User->>QuestionnaireForm: Starts Questionnaire
    QuestionnaireForm->>DiagnosisQuestion: Render Diagnosis Component
    DiagnosisQuestion->>User: Display Diagnosis Entry
    User->>DiagnosisQuestion: Add/Edit Diagnosis
    QuestionnaireForm->>SymptomQuestion: Render Symptom Component
    SymptomQuestion->>User: Display Symptom Entry
    User->>SymptomQuestion: Add/Edit Symptoms
    QuestionnaireForm->>User: Submit Questionnaire
Loading

Possibly related PRs

Suggested Labels

tested, needs review, P1

Suggested Reviewers

  • rithviknishad
  • Jacobjeevan

Poem

🐰 Hop, hop, through code so bright,
Questionnaires now dance with might!
Components refactored with care,
Type safety beyond compare.
A rabbit's code, clean and light! 🔍


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 Jan 2, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 7893cd5
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/677648fd89bcbb0008959cde
😎 Deploy Preview https://deploy-preview-9644--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.

Choose a reason for hiding this comment

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

Copy link

Deploying care-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7893cd5
Status: ✅  Deploy successful!
Preview URL: https://dec6d9ec.care-fe.pages.dev
Branch Preview URL: https://rewamp-symptom.care-fe.pages.dev

View logs

@bodhish bodhish requested a review from rithviknishad January 2, 2025 08:07
Copy link

cypress bot commented Jan 2, 2025

CARE    Run #4123

Run Properties:  status check passed Passed #4123  •  git commit 7893cd5950: Rewamp UX for symptoms and diagnosis in EncounterQuestionnaire
Project CARE
Branch Review rewamp-symptom
Run status status check passed Passed #4123
Run duration 01m 07s
Commit git commit 7893cd5950: Rewamp UX for symptoms and diagnosis in EncounterQuestionnaire
Committer Bodhish Thomas
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 3
View all changes introduced in this branch ↗︎

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: 0

🧹 Nitpick comments (7)
src/components/Questionnaire/QuestionTypes/SymptomQuestion.tsx (4)

47-53: Potential date/time zone issue in SYMPTOM_INITIAL_VALUE
Using new Date().toISOString().split("T")[0] might cause unexpected results if the client’s local time differs materially from UTC. Consider verifying if this is acceptable or if you need a local date handling strategy.


61-72: handleAddSymptom logic is sound, consider preventing duplicates
Everything is straightforward. For a future enhancement, you could check if the symptom already exists before adding, to avoid duplicates.


99-126: Symptom listing and ValueSetSelect usage
The layout is clear and uses conditional rendering for the symptom list. You might consider rendering a placeholder message or label if there are no symptoms.


131-295: SymptomItem component design
The component is well-structured, allowing updates via props. A few suggestions you could consider in the future:

  • Provide user feedback when toggling notes (e.g., a short transition).
  • For date changes, confirm appropriate time zone logic.
src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx (2)

44-49: DIAGNOSIS_INITIAL_VALUE time zone caution
Similar to symptoms, ensure that splitting and converting to ISO date aligns with the user’s local date/time expectations.


130-299: DiagnosisItem component structure
Mirrors the SymptomItem design nicely. Possible future improvement: unify the repeated pattern for note-taking and toggling in a shared hook or common utility for both symptom and diagnosis items if they are largely the same.

src/components/Questionnaire/QuestionnaireForm.tsx (1)

303-373: Refactoring for questionnaire forms
Encapsulating each form in a border rounded-lg p-6 container improves UI clarity. The extraction of form title and description is consistent and readable.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f450310 and 7893cd5.

📒 Files selected for processing (4)
  • src/components/Patient/EncounterQuestionnaire.tsx (1 hunks)
  • src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx (2 hunks)
  • src/components/Questionnaire/QuestionTypes/SymptomQuestion.tsx (2 hunks)
  • src/components/Questionnaire/QuestionnaireForm.tsx (1 hunks)
🔇 Additional comments (12)
src/components/Questionnaire/QuestionTypes/SymptomQuestion.tsx (4)

1-2: "use client" directive is correctly placed
Ensures that this file is recognized as a client component.


3-7: Imports for icons
Radix Icons are properly imported; no issues found.


74-81: Symptom removal logic
Implementation is correct and cleanly filters out the targeted index.


83-89: Symptom update logic
Method correctly merges existing symptom data with partial updates. No issues found.

src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx (4)

1-5: Icon imports
Appropriate usage of Radix Icons; looks good.


10-15: Dropdown menu adoption
Replaces older command menu usage. The approach is consistent with UI design changes in this PR.


60-88: Diagnosis CRUD operations
The logic for adding, removing, and updating diagnoses is consistent. Make sure to handle duplicates if the system requires it, similarly to symptoms.


98-119: Diagnosis listing block
The UI’s conditional rendering is clean. The new grid layout improves readability.

src/components/Patient/EncounterQuestionnaire.tsx (1)

28-47: Layout simplification using Card
Removing the extra wrapping <div> streamlines the layout, making the code more direct. Looks clean and aligned with standard usage of Card and CardContent.

src/components/Questionnaire/QuestionnaireForm.tsx (3)

300-302: Enhanced spacing in the main container
Using max-w-3xl and pb-8 space-y-2 provides a better user experience with clear separation between elements.


377-399: Questionnaire add/search block
The usage of <QuestionnaireSearch> is neatly placed at the bottom. The logic for preventing duplicate questionnaires is well-handled.


403-432: Submit & Cancel buttons alignment
The button styling is clear. The spinner overlay approach (showing a hidden label with an overlaid spinner) is an elegant pattern for asynchronous submission feedback.

@rithviknishad rithviknishad merged commit 1f7410a into develop Jan 2, 2025
27 checks passed
@rithviknishad rithviknishad deleted the rewamp-symptom branch January 2, 2025 08:23
Copy link

github-actions bot commented Jan 2, 2025

@bodhish 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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants