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: Spo2 twice rendering and wrong thresholds #9182

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

AdityaJ2305
Copy link
Contributor

@AdityaJ2305 AdityaJ2305 commented Nov 22, 2024

Proposed Changes

@ohcnetwork/care-fe-code-reviewers
@Jacobjeevan

Merge Checklist

  • Ensure that UI text is kept in I18n files.
  • Request for Peer Reviews

Summary by CodeRabbit

  • New Features

    • Updated the ventilator_spo2 input field to a number type with defined min/max values (0 to 100).
    • Enhanced label display for ventilator_spo2 based on severity levels using dynamic translations.
  • Bug Fixes

    • Improved rendering logic for the ventilator_spo2 field based on selected rounds_type.

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

coderabbitai bot commented Nov 22, 2024

Walkthrough

The changes in src/components/Patient/DailyRounds.tsx involve replacing the RangeAutocompleteFormField component for the ventilator_spo2 input with a TextFormField. This includes updates to the input type, minimum and maximum values, and dynamic label translations for hypoxemia severity. The rendering logic for the ventilator_spo2 field has been adjusted based on the selected rounds_type, while the overall form structure remains unchanged.

Changes

File Change Summary
src/components/Patient/DailyRounds.tsx Replaced RangeAutocompleteFormField with TextFormField for ventilator_spo2, updated input type, min/max values, and dynamic label translations. Adjusted rendering logic based on rounds_type.

Assessment against linked issues

Objective Addressed Explanation
Only a single SpO2 field should be rendered across all round types. (9181)
The SpO2 field should always be a RangeAutocompleteFormField with the correct thresholds based on the round type. (9181) The field was changed to a TextFormField instead.

Possibly related issues

Possibly related PRs

Suggested labels

tested

Suggested reviewers

  • rithviknishad
  • khavinshankar
  • Jacobjeevan

Poem

🐇 In the fields of care we hop,
With SpO2 changes, we won't stop!
A single field, clear and bright,
For every round, it feels just right.
So let's celebrate, with joy and cheer,
Our updates bring the future near! 🌟

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint (1.23.1)

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/components/Patient/DailyRounds.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Failed to load parser '@typescript-eslint/parser' declared in '.eslintrc.json': Cannot find module '@typescript-eslint/parser'
Require stack:

  • /.eslintrc.json
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Function.resolve (node:internal/modules/helpers:145:19)
    at Object.resolve (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2346:46)
    at ConfigArrayFactory._loadParser (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3325:39)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3099:43)
    at _normalizeObjectConfigDataBody.next ()
    at ConfigArrayFactory._normalizeObjectConfigData (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3040:20)
    at _normalizeObjectConfigData.next ()
    at ConfigArrayFactory.loadInDirectory (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2886:28)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3871:46)

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 02ad9b9 and 6d08a87.

📒 Files selected for processing (1)
  • src/components/Patient/DailyRounds.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/Patient/DailyRounds.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 22, 2024

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 6d08a87
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/6740d8a437e17c0008361594
😎 Deploy Preview https://deploy-preview-9182--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.

@AdityaJ2305 AdityaJ2305 marked this pull request as draft November 22, 2024 07:56
@AdityaJ2305 AdityaJ2305 marked this pull request as ready for review November 22, 2024 08:39
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

🧹 Outside diff range and nitpick comments (1)
cypress/pageobject/Patient/PatientLogupdate.ts (1)

66-66: Consider adding test coverage for different round types.

Since the PR fixes SpO2 field behavior across different round types, consider enhancing the test coverage.

Add test cases like:

// Example test structure
describe('SpO2 field behavior', () => {
  const roundTypes = ['Nurse Log Update', 'Doctor Log Update', 'Other Type'];
  roundTypes.forEach(roundType => {
    it(`correctly handles SpO2 input for ${roundType}`, () => {
      // Setup
      patientLogUpdate.selectRoundType(roundType);
      // Test SpO2 input
      patientLogUpdate.typeSpo2('98');
      // Verify
      cy.get('#ventilator_spo2').should('have.value', '98');
    });
  });
});
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5eed4b4 and 02ad9b9.

📒 Files selected for processing (1)
  • cypress/pageobject/Patient/PatientLogupdate.ts (1 hunks)
🔇 Additional comments (1)
cypress/pageobject/Patient/PatientLogupdate.ts (1)

66-66: LGTM! Implementation aligns with UI changes.

The change from direct typing to using typeAndSelectOption correctly reflects the UI update where SpO2 is now consistently implemented as a RangeAutocompleteFormField.

Let's verify the custom command implementation:

✅ Verification successful

Custom command typeAndSelectOption is properly implemented and widely used

The command is correctly implemented in cypress/support/commands.ts and is being used consistently across multiple page objects for handling autocomplete fields. The implementation properly handles clicking, typing, and selecting from dropdown options, which aligns with the SPO2 field's new behavior.

  • Command implementation found in cypress/support/commands.ts:
Cypress.Commands.add(
  "typeAndSelectOption",
  (element: string, referance: string) => {
    cy.get(element)
      .click()
      .type(referance)
      .then(() => {
        cy.get("[role='option']").contains(referance).click();
      });
  },
);
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the custom command implementation
# Expected: Find the implementation of typeAndSelectOption command

# Search for the custom command definition
rg -A 5 "Cypress.Commands.add.*typeAndSelectOption"

Length of output: 53


Script:

#!/bin/bash
# Let's try different search patterns and locations to find the custom command

# Search for typeAndSelectOption in cypress/support directory (common location for custom commands)
echo "=== Searching in cypress/support ==="
fd . "cypress/support" --type f --exec cat {}

# Search for any file containing typeAndSelectOption
echo -e "\n=== Searching for typeAndSelectOption usage ==="
rg "typeAndSelectOption" --type ts

Length of output: 11166

@AdityaJ2305 AdityaJ2305 changed the title Fix: Spo2 twice occuring and wrong thresholds Fix: Spo2 twice rendering and wrong thresholds Nov 22, 2024
@nihal467 nihal467 added the P1 breaking issue or vital feature label Nov 22, 2024
@rithviknishad rithviknishad added reviewed reviewed by a core member and removed needs review labels Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs testing P1 breaking issue or vital feature reviewed reviewed by a core member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate and Incorrect SpO2 Field Behaviour in Log Update Form
5 participants