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

remove unused code #9684

Merged
merged 3 commits into from
Jan 3, 2025
Merged

Conversation

rithviknishad
Copy link
Member

@rithviknishad rithviknishad commented Jan 3, 2025

Proposed Changes

  • remove unused code

@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

Based on the comprehensive summary of changes, here are the release notes:

  • Removed Features

    • Deleted multiple components related to medication management, including prescription creation, administration, and tracking
    • Removed symptom management components and utilities
    • Eliminated notification subscription state management
    • Discontinued QR scanning and various form field components
  • Type System Improvements

    • Updated language configuration in i18n
    • Added DOSAGE_UNITS constant for more precise type definitions
    • Refined type handling for medication request interfaces
  • Code Cleanup

    • Removed several utility functions and API route definitions
    • Simplified import statements and type declarations
    • Eliminated deprecated or unused components across multiple modules

@rithviknishad rithviknishad requested a review from a team as a code owner January 3, 2025 07:35
Copy link
Contributor

coderabbitai bot commented Jan 3, 2025

Warning

Rate limit exceeded

@rithviknishad has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 11 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 afb0097 and 620123d.

📒 Files selected for processing (7)
  • src/components/Common/AccordionV2.tsx (0 hunks)
  • src/components/Common/AuthorizedButton.tsx (0 hunks)
  • src/components/Common/BloodPressureFormField.tsx (0 hunks)
  • src/components/Common/CollapseV2.tsx (0 hunks)
  • src/components/Common/HeadedTabs.tsx (0 hunks)
  • src/components/Common/RouteToFacilitySelect.tsx (0 hunks)
  • src/components/Common/Table.tsx (0 hunks)

Walkthrough

This pull request involves a significant refactoring of the codebase, primarily focusing on the removal of components, routes, and models related to medication and prescription management. The changes span multiple files across different directories, including components, hooks, types, and utility functions. The removal suggests a substantial restructuring of how medication-related functionality is handled in the application, potentially indicating a shift in the system's architectural approach to medical prescriptions.

Changes

File Path Change Summary
src/Utils/request/api.tsx Removed several prescription-related endpoints
src/components/Common/ Removed multiple components like QRScanner, Readmore, RelativeDateUserMention, LanguageSelector
src/components/Form/ Removed various form field components and validators
src/components/Medicine/ Comprehensive removal of prescription and medication-related components, models, routes, and utilities
src/components/Symptoms/ Removed symptoms-related components, API, types, and utility functions
src/hooks/ Removed useNotificationSubscriptionState hook
src/types/emr/medicationRequest.ts Added DOSAGE_UNITS constant and updated DosageQuantity interface

Possibly related PRs

Suggested Reviewers

  • bodhish

Poem

🐰 A Rabbit's Ode to Code Cleanup 🧹

Endpoints vanish like morning mist,
Components dance their farewell twist,
Prescriptions fade, symptoms take flight,
Refactoring code with all my might!

Hop, hop, hooray for clean design! 🎉


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 3, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 620123d
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/67779420720962000843a63e
😎 Deploy Preview https://deploy-preview-9684--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

cloudflare-workers-and-pages bot commented Jan 3, 2025

Deploying care-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 620123d
Status: ✅  Deploy successful!
Preview URL: https://61fb6d25.care-fe.pages.dev
Branch Preview URL: https://rithviknishad-chore-remove-u.care-fe.pages.dev

View logs

Copy link

cypress bot commented Jan 3, 2025

CARE    Run #4147

Run Properties:  status check passed Passed #4147  •  git commit 620123df18: remove unused code
Project CARE
Branch Review rithviknishad/chore/remove-unused-things
Run status status check passed Passed #4147
Run duration 01m 11s
Commit git commit 620123df18: remove unused code
Committer Rithvik Nishad
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 (4)
src/components/Common/LanguageSelector.tsx (2)

5-5: Consider removing unused imports if classNames is not used.

The current changes add keysOf to the import statement. If classNames is no longer needed (or vice versa), remove the unused import to keep the code clean.


39-39: Ensure proper type for event parameter, if needed.

You removed the explicit type annotation on the map callback parameter (e). While TypeScript inference generally suffices, confirm that it meets your code standards and doesn't affect readability.

src/components/Common/LanguageSelectorLogin.tsx (1)

5-5: Same import comment as in LanguageSelector.tsx.

If classNames is not used, you may remove it to keep the imports consistent and concise. Otherwise, this usage is valid.

src/components/Form/FormFields/TextFormField.tsx (1)

Line range hint 49-52: Consider renaming labelSuffixWithThreshold.

Now that threshold logic has been removed, this variable name may no longer accurately reflect its purpose. Renaming it to something like labelSuffixElement (or simply reusing field.labelSuffix directly) may improve clarity.

-  const labelSuffixWithThreshold = (
+  const labelSuffixElement = (
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ee27ecd and afb0097.

📒 Files selected for processing (47)
  • src/Utils/request/api.tsx (0 hunks)
  • src/components/Common/LanguageSelector.tsx (3 hunks)
  • src/components/Common/LanguageSelectorLogin.tsx (3 hunks)
  • src/components/Common/QRScanner.tsx (0 hunks)
  • src/components/Common/Readmore.tsx (0 hunks)
  • src/components/Common/RelativeDateUserMention.tsx (0 hunks)
  • src/components/Common/TemperatureFormField.tsx (0 hunks)
  • src/components/Form/FieldValidators.tsx (0 hunks)
  • src/components/Form/FormFields/AutoExpandingTextInputFormField.tsx (0 hunks)
  • src/components/Form/FormFields/AutocompleteMultiselect.tsx (0 hunks)
  • src/components/Form/FormFields/CheckBoxFormField.tsx (0 hunks)
  • src/components/Form/FormFields/DosageFormField.tsx (0 hunks)
  • src/components/Form/FormFields/Month.tsx (0 hunks)
  • src/components/Form/FormFields/NumericWithUnitsFormField.tsx (0 hunks)
  • src/components/Form/FormFields/OtpFormField.tsx (0 hunks)
  • src/components/Form/FormFields/RangeAutocompleteFormField.tsx (0 hunks)
  • src/components/Form/FormFields/RangeFormField.tsx (0 hunks)
  • src/components/Form/FormFields/TextFormField.tsx (1 hunks)
  • src/components/Form/ModelCrudEditor.tsx (0 hunks)
  • src/components/Medicine/AdministerMedicine.tsx (0 hunks)
  • src/components/Medicine/DiscontinueMedication.tsx (0 hunks)
  • src/components/Medicine/EditPrescriptionForm.tsx (0 hunks)
  • src/components/Medicine/MedicineAdministration.tsx (0 hunks)
  • src/components/Medicine/MedicineAdministrationSheet/AdministrationEventCell.tsx (0 hunks)
  • src/components/Medicine/MedicineAdministrationSheet/AdministrationEventSeperator.tsx (0 hunks)
  • src/components/Medicine/MedicineAdministrationSheet/AdministrationTable.tsx (0 hunks)
  • src/components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx (0 hunks)
  • src/components/Medicine/MedicineAdministrationSheet/BulkAdminister.tsx (0 hunks)
  • src/components/Medicine/MedicineAdministrationSheet/utils.ts (0 hunks)
  • src/components/Medicine/MedicinePrescriptionSummary.tsx (0 hunks)
  • src/components/Medicine/PrescriptionDetailCard.tsx (0 hunks)
  • src/components/Medicine/PrescriptionTimeline.tsx (0 hunks)
  • src/components/Medicine/PrescriptionsTable.tsx (0 hunks)
  • src/components/Medicine/ResponsiveMedicineTables.tsx (0 hunks)
  • src/components/Medicine/models.ts (0 hunks)
  • src/components/Medicine/routes.ts (0 hunks)
  • src/components/Medicine/validators.ts (0 hunks)
  • src/components/Notifications/models.tsx (0 hunks)
  • src/components/Questionnaire/QuestionTypes/MedicationRequestQuestion.tsx (1 hunks)
  • src/components/Symptoms/SymptomsBuilder.tsx (0 hunks)
  • src/components/Symptoms/SymptomsCard.tsx (0 hunks)
  • src/components/Symptoms/api.ts (0 hunks)
  • src/components/Symptoms/types.ts (0 hunks)
  • src/components/Symptoms/utils.ts (0 hunks)
  • src/hooks/useNotificationSubscriptionState.ts (0 hunks)
  • src/i18n.ts (1 hunks)
  • src/types/emr/medicationRequest.ts (1 hunks)
💤 Files with no reviewable changes (41)
  • src/components/Form/FormFields/CheckBoxFormField.tsx
  • src/components/Medicine/MedicineAdministrationSheet/AdministrationEventSeperator.tsx
  • src/components/Common/RelativeDateUserMention.tsx
  • src/components/Form/FormFields/Month.tsx
  • src/components/Medicine/MedicineAdministrationSheet/utils.ts
  • src/components/Symptoms/api.ts
  • src/components/Medicine/EditPrescriptionForm.tsx
  • src/components/Form/FormFields/DosageFormField.tsx
  • src/components/Form/FormFields/AutoExpandingTextInputFormField.tsx
  • src/components/Form/FormFields/OtpFormField.tsx
  • src/components/Medicine/MedicineAdministrationSheet/BulkAdminister.tsx
  • src/components/Common/Readmore.tsx
  • src/components/Medicine/MedicineAdministrationSheet/AdministrationTable.tsx
  • src/components/Form/FormFields/RangeFormField.tsx
  • src/components/Medicine/AdministerMedicine.tsx
  • src/components/Common/TemperatureFormField.tsx
  • src/components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx
  • src/components/Medicine/MedicineAdministrationSheet/AdministrationEventCell.tsx
  • src/hooks/useNotificationSubscriptionState.ts
  • src/components/Medicine/DiscontinueMedication.tsx
  • src/components/Medicine/MedicineAdministration.tsx
  • src/components/Notifications/models.tsx
  • src/components/Medicine/ResponsiveMedicineTables.tsx
  • src/components/Form/ModelCrudEditor.tsx
  • src/components/Symptoms/SymptomsCard.tsx
  • src/components/Symptoms/types.ts
  • src/components/Form/FormFields/NumericWithUnitsFormField.tsx
  • src/components/Form/FormFields/AutocompleteMultiselect.tsx
  • src/Utils/request/api.tsx
  • src/components/Common/QRScanner.tsx
  • src/components/Symptoms/SymptomsBuilder.tsx
  • src/components/Medicine/PrescriptionsTable.tsx
  • src/components/Form/FormFields/RangeAutocompleteFormField.tsx
  • src/components/Medicine/routes.ts
  • src/components/Medicine/validators.ts
  • src/components/Medicine/PrescriptionTimeline.tsx
  • src/components/Medicine/models.ts
  • src/components/Form/FieldValidators.tsx
  • src/components/Medicine/PrescriptionDetailCard.tsx
  • src/components/Medicine/MedicinePrescriptionSummary.tsx
  • src/components/Symptoms/utils.ts
🔇 Additional comments (7)
src/i18n.ts (1)

6-13: Overall good implementation using as const.

Defining LANGUAGES using as const is a great approach to ensure TypeScript infers the most specific types for the language codes. This improves type safety throughout the application.

src/components/Common/LanguageSelector.tsx (1)

23-23: Good approach filtering locales with careConfig.

Filtering the locales according to careConfig.availableLocales ensures that only supported languages are presented to users. This logic is clear and aligned with best practices.

src/components/Common/LanguageSelectorLogin.tsx (2)

22-22: Filtering logic matches LanguageSelector.

Consistent usage of keysOf(LANGUAGES) and careConfig.availableLocales is good for ensuring uniform behavior across components.


31-31: Good approach for inlined language selection buttons.

Mapping over availableLocales and displaying the corresponding language values is straightforward and user-friendly.

src/types/emr/medicationRequest.ts (1)

5-14: Unit list is well-defined with literal types.
The DOSAGE_UNITS array is correctly typed as a readonly tuple, ensuring the compiler provides accurate autocompletion and error-checking. This approach prevents accidental changes to the dosage units.

src/components/Questionnaire/QuestionTypes/MedicationRequestQuestion.tsx (1)

20-20: Good integration of DOSAGE_UNITS in the QuantityInput.
Importing DOSAGE_UNITS from a single source centralizes dosage-unit definitions, ensuring consistency across the application.

src/components/Form/FormFields/TextFormField.tsx (1)

16-16: Unused “threshold” references appear fully removed.

It looks like the code successfully removes the old threshold references. The import on line 16, classNames, is properly used below and there's no leftover threshold logic.

@bodhish bodhish merged commit 3a4bc68 into develop Jan 3, 2025
19 checks passed
@bodhish bodhish deleted the rithviknishad/chore/remove-unused-things branch January 3, 2025 09:19
Copy link

github-actions bot commented Jan 3, 2025

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

Successfully merging this pull request may close these issues.

2 participants