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

Update deprecated filters on action/flow list api requests #1375

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

nmajor25
Copy link
Contributor

@nmajor25 nmajor25 commented Jan 7, 2025

Shortcut Story ID: [sc-58220]

Updates:

  • api/actions (worklists, schedule, reduced schedule):

    • filter[flow.state] => filter[flow_states]
    • filter[state] => filter[states]
    • filter[team] => filter[teams]
    • filter[clinician] => filter[clinicians]
  • api/flows (worklists):

    • filter[state] => filter[states]
    • filter[team] => filter[teams]
    • filter[clinician] => filter[clinicians]
  • /api/patients/:id/relationships/actions (patient dashboard/archive):

    • filter[state] => filter[states]
  • /api/patients/:id/relationships/flows (patient dashboard/archive):

    • filter[state] => filter[states]

@nmajor25 nmajor25 requested a review from paulfalgout January 7, 2025 18:01
Copy link

coderabbitai bot commented Jan 7, 2025

Walkthrough

The pull request introduces consistent changes across multiple JavaScript files in the patient-related modules. The primary modifications involve renaming keys in the getEntityStatesFilter() and getEntityOwnerFilter() methods, changing 'state' to 'states', 'flow.state' to 'flow_states', and updating 'clinician' to 'clinicians'. These changes affect files in the schedule, reduced schedule, and worklist components, along with corresponding integration tests to ensure the new keys are correctly used in filtering operations.

Changes

File Change Summary
src/js/apps/patients/schedule/reduced-schedule/reduced_schedule_state.js Updated getEntityStatesFilter() to use 'states' and 'flow_states'; updated getEntityFilter() to return 'clinicians'.
src/js/apps/patients/schedule/schedule_state.js Modified StateModel to return 'states' and 'flow_states' in getEntityStatesFilter(); updated getEntityOwnerFilter() to return 'clinicians'.
src/js/apps/patients/worklist/worklist_state.js Changed keys in getEntityStatesFilter() to return 'states' and 'flow_states'; updated getEntityOwnerFilter() to return 'teams' and 'clinicians'.
test/integration/patients/sidebar/filter-sidebar.js Updated test assertions to use filter[states] and filter[flow_states].
test/integration/patients/worklist/reduced-schedule.js Modified assertions to check for filter[clinicians] and filter[states].
test/integration/patients/worklist/schedule.js Changed assertions for filter[clinicians] and filter[states] in the schedule page tests.
test/integration/patients/worklist/worklist.js Updated multiple instances of filter[state] to filter[states] and filter[clinician] to filter[clinicians].
src/js/apps/patients/patient/archive/archive_app.js Modified beforeStart method to use states instead of state in the filter object.
src/js/apps/patients/patient/dashboard/dashboard_app.js Updated beforeStart method to change filter from state to states.
test/integration/patients/patient/archive.js Changed assertion from filter[state] to filter[states].
test/integration/patients/patient/dashboard.js Changed assertion from filter[state] to filter[states].

Possibly related PRs

Suggested reviewers

  • paulfalgout

Poem

🐰 Hop, hop, through the code we go,
Renaming keys with a rhythmic flow
From flow.state to flow_states so neat
A rabbit's refactor, now complete!
Consistency dances, tests align
Our code now sings a sweeter design 🔑


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 467c2d7 and 3fe4eb0.

📒 Files selected for processing (11)
  • src/js/apps/patients/patient/archive/archive_app.js (1 hunks)
  • src/js/apps/patients/patient/dashboard/dashboard_app.js (1 hunks)
  • src/js/apps/patients/schedule/reduced-schedule/reduced_schedule_state.js (2 hunks)
  • src/js/apps/patients/schedule/schedule_state.js (2 hunks)
  • src/js/apps/patients/worklist/worklist_state.js (2 hunks)
  • test/integration/patients/patient/archive.js (1 hunks)
  • test/integration/patients/patient/dashboard.js (1 hunks)
  • test/integration/patients/sidebar/filter-sidebar.js (22 hunks)
  • test/integration/patients/worklist/reduced-schedule.js (4 hunks)
  • test/integration/patients/worklist/schedule.js (5 hunks)
  • test/integration/patients/worklist/worklist.js (13 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • test/integration/patients/worklist/reduced-schedule.js
  • src/js/apps/patients/schedule/reduced-schedule/reduced_schedule_state.js
  • src/js/apps/patients/worklist/worklist_state.js
  • test/integration/patients/worklist/worklist.js
  • test/integration/patients/worklist/schedule.js
  • src/js/apps/patients/schedule/schedule_state.js
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test-build
🔇 Additional comments (8)
src/js/apps/patients/patient/archive/archive_app.js (1)

16-16: LGTM! Filter parameter updated correctly.

The change from state to states aligns with the new API filter parameter naming convention.

src/js/apps/patients/patient/dashboard/dashboard_app.js (1)

28-28: LGTM! Filter parameter updated correctly.

The change from state to states aligns with the new API filter parameter naming convention.

test/integration/patients/patient/archive.js (1)

150-150: LGTM! Test assertion updated correctly.

The test assertion has been updated to validate the new filter[states] parameter, maintaining test coverage for the API changes.

test/integration/patients/patient/dashboard.js (1)

169-169: LGTM! Test assertion updated correctly.

The test assertion has been updated to validate the new filter[states] parameter, maintaining test coverage for the API changes.

test/integration/patients/sidebar/filter-sidebar.js (4)

98-99: LGTM! Filter parameter updates in worklist filtering test are correct.

The test assertions have been properly updated to use the new filter parameter names (states and flow_states), aligning with the PR objectives to replace deprecated filter parameters.

Also applies to: 296-297, 321-322, 361-361, 400-400, 439-439, 476-477


571-571: LGTM! Filter parameter updates in done states filtering test are correct.

The test assertions have been properly updated to use the new filter parameter name (states), aligning with the PR objectives to replace deprecated filter parameters.

Also applies to: 614-614, 651-651


733-736: LGTM! Filter parameter updates in schedule filtering test are correct.

The test assertions have been properly updated to use the new filter parameter names (states, flow_states, and clinicians), aligning with the PR objectives to replace deprecated filter parameters.

Also applies to: 897-898, 925-926, 953-953, 980-980, 1028-1029


1158-1161: LGTM! Filter parameter updates in reduced schedule filtering test are correct.

The test assertions have been properly updated to use the new filter parameter names (states, flow_states, and clinicians), aligning with the PR objectives to replace deprecated filter parameters.

Also applies to: 1323-1324, 1351-1352, 1379-1379, 1406-1406, 1454-1455


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
Member

@paulfalgout paulfalgout left a comment

Choose a reason for hiding this comment

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

Copy link

cypress bot commented Jan 7, 2025

RoundingWell Care Ops Frontend    Run #7142

Run Properties:  status check passed Passed #7142  •  git commit 3fe4eb0551: Update deprecated filters on action/flow list api requests
Project RoundingWell Care Ops Frontend
Branch Review flow-state-filter
Run status status check passed Passed #7142
Run duration 02m 57s
Commit git commit 3fe4eb0551: Update deprecated filters on action/flow list api requests
Committer Nick Major
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 1
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 313
View all changes introduced in this branch ↗︎

@paulfalgout
Copy link
Member

Also true for the flow api: https://github.com/RoundingWell/care-ops-backend/blob/fe73aeb3482868d9982f0bc7d265606f7eb25a31/src/Flow/Web/ListFlows.php#L98

@coveralls
Copy link

coveralls commented Jan 7, 2025

Pull Request Test Coverage Report for Build e7c01ee3-7841-4100-96d1-7d07b37f6bc2

Details

  • 7 of 7 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall first build on flow-state-filter at 99.987%

Totals Coverage Status
Change from base Build 5d175004-5f56-441f-95d6-fecca6e261f1: 100.0%
Covered Lines: 6079
Relevant Lines: 6079

💛 - Coveralls

@nmajor25 nmajor25 changed the title Use filter[flow_states] instead of deprecated filter[flow.state] Update deprecated filters on /api/actions & /api/flows requests Jan 7, 2025
Copy link

@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
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef830ca and 467c2d7.

📒 Files selected for processing (7)
  • src/js/apps/patients/schedule/reduced-schedule/reduced_schedule_state.js (2 hunks)
  • src/js/apps/patients/schedule/schedule_state.js (2 hunks)
  • src/js/apps/patients/worklist/worklist_state.js (2 hunks)
  • test/integration/patients/sidebar/filter-sidebar.js (22 hunks)
  • test/integration/patients/worklist/reduced-schedule.js (4 hunks)
  • test/integration/patients/worklist/schedule.js (5 hunks)
  • test/integration/patients/worklist/worklist.js (13 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/js/apps/patients/schedule/schedule_state.js
  • test/integration/patients/sidebar/filter-sidebar.js
🔇 Additional comments (6)
test/integration/patients/worklist/reduced-schedule.js (1)

103-104: LGTM! Test assertions updated to match new filter parameters.

The test assertions have been correctly updated to verify the new plural filter parameter names:

  • filter[clinicians] for clinician filtering
  • filter[states] for state filtering

Also applies to: 561-561, 587-587, 601-601

test/integration/patients/worklist/schedule.js (1)

465-466: LGTM! Test assertions updated to match new filter parameters.

The test assertions have been correctly updated to verify the new plural filter parameter names:

  • filter[clinicians] for clinician filtering
  • filter[states] for state filtering

Also applies to: 494-494, 1853-1853, 1879-1879, 1893-1893

test/integration/patients/worklist/worklist.js (1)

332-332: LGTM! Test assertions updated to match new filter parameters.

The test assertions have been correctly updated to verify the new plural filter parameter names:

  • filter[clinicians] for clinician filtering
  • filter[states] for state filtering
  • filter[teams] for team filtering

Also applies to: 1097-1098, 1132-1133, 1155-1156, 1183-1183, 1251-1251, 1268-1268, 1302-1303, 1315-1316, 1962-1962, 4165-4165, 4191-4191, 4205-4205

src/js/apps/patients/worklist/worklist_state.js (3)

155-155: LGTM: Consistent filter key update

The change from state to states aligns with the new API filter parameter naming convention.


158-159: LGTM: Updated deprecated filter parameters

The changes correctly implement:

  1. Consistent pluralization of 'state' to 'states'
  2. Replacement of deprecated 'flow.state' with 'flow_states' as per PR objectives

182-182: Verify additional filter parameter changes

While the changes from singular to plural form ('team' → 'teams', 'clinician' → 'clinicians') follow the same pattern as the state filters, these weren't explicitly mentioned in the PR objectives. Please verify that these changes are also required by the backend API.

Let's check if these changes are consistent with other files:

Also applies to: 184-184, 187-187

✅ Verification successful

Filter parameter changes are consistent with the codebase

The changes from singular to plural form ('team' → 'teams', 'clinician' → 'clinicians') are correct and align with the API parameters used consistently across the test suite.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for team/clinician filter usage patterns across the codebase
echo "Searching for team filter patterns..."
rg "filter\[team" --type js

echo "Searching for clinician filter patterns..."
rg "filter\[clinician" --type js

echo "Searching for updated patterns..."
rg "filter\[teams\]|filter\[clinicians\]" --type js

Length of output: 3795

Comment on lines +53 to +54
states: this.get('states').join() || NIL_UUID,
flow_states: this.get('flowStates').join() || NIL_UUID,
Copy link

@coderabbitai coderabbitai bot Jan 7, 2025

Choose a reason for hiding this comment

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

💡 Codebase verification

Test files need updating to match new filter parameter convention

Two test files still use the deprecated singular form filter[state] in their assertions:

  • test/integration/patients/patient/dashboard.js
  • test/integration/patients/patient/archive.js

These should be updated to use filter[states] to match the new API convention.

🔗 Analysis chain

LGTM! Filter parameter names updated as per API changes.

The changes correctly implement the new filter parameter naming convention, replacing deprecated singular forms with plural forms:

  • states for state filtering
  • flow_states for flow state filtering
  • clinicians for clinician filtering

Let's verify that these are the only instances of the old filter parameters in the codebase:

Also applies to: 70-70

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining instances of old filter parameter names
echo "Searching for old filter parameter names..."
rg "filter\[state\]|filter\[flow\.state\]|filter\[clinician\]" --type js

Length of output: 379


Script:

#!/bin/bash
# Search for variations of both old and new filter parameters with context
echo "Searching for state filter variations..."
rg "filter\[(state|states)\]|states=|state=" --type js -A 2

echo -e "\nSearching for flow state filter variations..."
rg "filter\[(flow\.state|flow_states?)\]|flow_states=|flow\.state=" --type js -A 2

echo -e "\nSearching for clinician filter variations..."
rg "filter\[(clinician|clinicians)\]|clinicians=|clinician=" --type js -A 2

Length of output: 15985

Copy link
Member

Choose a reason for hiding this comment

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

This is true. patient dashboard/archive also need this update

Copy link

Choose a reason for hiding this comment

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

@paulfalgout Found the exact locations. The changes needed are:

  1. In test/integration/patients/patient/dashboard.js:

    // From:
    .should('contain', 'filter[state]=22222,33333')
    // To:
    .should('contain', 'filter[states]=22222,33333')
  2. In test/integration/patients/patient/archive.js:

    // From:
    .should('contain', 'filter[state]=55555,66666,77777')
    // To:
    .should('contain', 'filter[states]=55555,66666,77777')

Would you like me to open a GitHub issue to track these additional changes?

🔗 Analysis chain
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for state filter usage in the specified files
echo "=== Dashboard state filter usage ==="
rg "filter\[state\]" "test/integration/patients/patient/dashboard.js" -A 2

echo -e "\n=== Archive state filter usage ==="
rg "filter\[state\]" "test/integration/patients/patient/archive.js" -A 2

Length of output: 500

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good bot 🤖 those have been updated 👍

Copy link

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Comment on lines +53 to +54
states: this.get('states').join() || NIL_UUID,
flow_states: this.get('flowStates').join() || NIL_UUID,
Copy link
Member

Choose a reason for hiding this comment

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

This is true. patient dashboard/archive also need this update

@nmajor25 nmajor25 changed the title Update deprecated filters on /api/actions & /api/flows requests Update deprecated filters on action/flow list api requests Jan 8, 2025
@nmajor25 nmajor25 requested a review from paulfalgout January 8, 2025 15:54
@paulfalgout paulfalgout merged commit 4d864a9 into develop Jan 8, 2025
6 checks passed
@paulfalgout paulfalgout deleted the flow-state-filter branch January 8, 2025 16:00
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.

4 participants