Skip to content

Conversation

srishtigrp78
Copy link
Contributor

@srishtigrp78 srishtigrp78 commented Mar 6, 2025

📋 Description

JIRA ID:

Please provide a summary of the change and the motivation behind it. Include relevant context and details.


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ Additional Information

Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.

Summary by CodeRabbit

  • New Features

    • Enhanced grievance filtering by adding date range and service provider options, providing more precise unallocated grievance counts.
    • Introduced a new validation check to ensure required identifiers are provided for complaint resolution submissions.
  • Refactor

    • Streamlined allocation and unassignment processes for grievances, improving overall consistency and reliability in handling.

Copy link
Contributor

coderabbitai bot commented Mar 6, 2025

Walkthrough

This pull request updates multiple layers of the grievance processing feature. The changes expand the parameters for fetching unallocated grievance counts across the controller, service, and repository layers. Data models have been modified through field renames and the removal of an obsolete field. Method signatures and query annotations are updated in the repository and service implementations to incorporate additional filters and identifiers. Internal logic in the handling service methods has also been revised to align with the new parameter requirements, while error handling remains unchanged.

Changes

Files Summary
src/main/java/com/iemr/common/controller/grievance/GrievanceController.java Updated fetchUnallocatedGrievanceCount to pass additional parameters (filter dates and provider service map ID) from the request.
src/main/java/com/iemr/common/data/grievance/GrievanceAllocationRequest.java
src/main/java/com/iemr/common/data/grievance/GrievanceDetails.java
Renamed fields in GrievanceAllocationRequest (userIDtouserID, preferredLanguagelanguage) and removed the agentid field (with related constructor changes) from GrievanceDetails.
src/main/java/com/iemr/common/repository/grievance/GrievanceDataRepo.java Updated multiple method signatures and query annotations to use gwid instead of grievanceId, include additional parameters (e.g., filter date range, benCallID), and adjust query conditions.
src/main/java/com/iemr/common/service/grievance/GrievanceDataSync.java
src/main/java/com/iemr/common/service/grievance/GrievanceDataSyncImpl.java
Modified fetchUnallocatedGrievanceCount signatures to accept three extra parameters; in the impl, removed the line setting the agentid property and adjusted the internal repository call.
src/main/java/com/iemr/common/service/grievance/GrievanceHandlingServiceImpl.java Revised logic in methods (allocateGrievances, moveToBin, saveComplaintResolution) to use renamed fields, new identifiers, and incorporate a check for benCallID in complaint resolution.

Sequence Diagram(s)

sequenceDiagram
    participant C as GrievanceController
    participant DS as GrievanceDataSync / GrievanceDataSyncImpl
    participant R as GrievanceDataRepo

    C->>DS: fetchUnallocatedGrievanceCount(preferredLanguage, filterStartDate, filterEndDate, providerServiceMapID)
    DS->>R: fetchUnallocatedGrievanceCount(filterStartDate, filterEndDate)
    R-->>DS: return grievance count data
    DS-->>C: return formatted count result
Loading

Possibly related PRs

Suggested reviewers

  • ravishanigarapu

Poem

I’m a rabbit with a code-filled heart,
Hoping over changes, a brand new start.
Fields are renamed and queries rearranged,
My little paws dance as logic gets changed.
Carrots and code, in lines swift and true,
Celebrating each commit—I’m cheering for you!
🥕🐇 Happy hopping in the world of code!

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
  • @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

sonarqubecloud bot commented Mar 6, 2025

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

🧹 Nitpick comments (1)
src/main/java/com/iemr/common/repository/grievance/GrievanceDataRepo.java (1)

72-77: Enhanced fetchUnallocatedGrievanceCount with date filtering.

The fetchUnallocatedGrievanceCount method has been enhanced to include date range filtering with filterStartDate and filterEndDate parameters. This provides more granular control over fetching unallocated grievances based on when they were created.

Consider adding a check for null date parameters to make this method more robust, possibly by adding an optional fallback for when date filters aren't provided.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8806e1b and c88ad77.

📒 Files selected for processing (7)
  • src/main/java/com/iemr/common/controller/grievance/GrievanceController.java (1 hunks)
  • src/main/java/com/iemr/common/data/grievance/GrievanceAllocationRequest.java (1 hunks)
  • src/main/java/com/iemr/common/data/grievance/GrievanceDetails.java (1 hunks)
  • src/main/java/com/iemr/common/repository/grievance/GrievanceDataRepo.java (1 hunks)
  • src/main/java/com/iemr/common/service/grievance/GrievanceDataSync.java (2 hunks)
  • src/main/java/com/iemr/common/service/grievance/GrievanceDataSyncImpl.java (1 hunks)
  • src/main/java/com/iemr/common/service/grievance/GrievanceHandlingServiceImpl.java (5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: style-check / checkstyle
  • GitHub Check: Build
  • GitHub Check: Analyze (java)
  • GitHub Check: Package-test
🔇 Additional comments (19)
src/main/java/com/iemr/common/controller/grievance/GrievanceController.java (1)

51-51: Method call updated to include additional filtering parameters.

The method call has been updated to include start date, end date, and provider service map ID, which aligns with the interface changes. This enhancement allows for more granular filtering of unallocated grievances.

src/main/java/com/iemr/common/service/grievance/GrievanceDataSync.java (2)

3-3: Import added for the new parameter types.

Added import for Timestamp to support the date filtering functionality.


14-15: Method signature updated with additional filtering parameters.

The interface method signature has been expanded to include start date, end date, and provider service map ID parameters, enhancing the filtering capabilities.

src/main/java/com/iemr/common/data/grievance/GrievanceAllocationRequest.java (3)

13-13: Variable renamed for clarity.

The variable userID has been renamed to touserID to better indicate that these are the target users for allocation.


15-15: Variable renamed for consistency.

Variable renamed from preferredLanguage to language for better consistency across the codebase.


19-20: Updated toString() method to reflect variable name changes.

The toString() method has been properly updated to use the new variable names.

src/main/java/com/iemr/common/service/grievance/GrievanceDataSyncImpl.java (1)

414-415: Method signature updated to match interface changes.

The implementation now accepts additional filtering parameters to align with the interface definition.

src/main/java/com/iemr/common/data/grievance/GrievanceDetails.java (1)

168-168:

✅ Verification successful

Constructor signature updated to remove agentID parameter.

The constructor signature has been updated to remove the agentID parameter, which aligns with the removal of the agentid field from the class. This change maintains consistency in the data model.


🏁 Script executed:

#!/bin/bash
# Check for any remaining references to agentid in the codebase
# that might be affected by this removal

echo "Checking for remaining references to agentid field..."
rg -i "\.agentid|\.getAgentid\(\)|setAgentid" --type java

Length of output: 20549


Constructor Signature Change in GrievanceDetails Verified

The constructor in GrievanceDetails.java has been correctly updated to remove the agentID parameter, which now aligns with the removal of the corresponding field from the class. This change is self-contained; while our search shows that many other classes and methods still reference agentID, those usages appear intentional and are unrelated to the refactoring in this file.

  • File Affected: src/main/java/com/iemr/common/data/grievance/GrievanceDetails.java at line 168
  • Change Validated: The removal of agentID in the constructor signature is consistent with the updated data model.
src/main/java/com/iemr/common/service/grievance/GrievanceHandlingServiceImpl.java (6)

76-76: Method parameter updated to use language instead of preferredLanguage.

The parameter has been updated from preferredLanguage to language, which aligns with renaming in the GrievanceAllocationRequest class. This maintains consistency across the codebase.


88-88: User ID retrieval method updated.

The method to retrieve user IDs has been changed from getUserID() to getTouserID(), which aligns with changes in the GrievanceAllocationRequest class. This ensures proper allocation of grievances to users.


233-238: Updated unassign grievance logic to use gwid instead of grievanceId.

The grievance unassignment logic has been updated to:

  1. Set the user ID to null before unassigning
  2. Use gwid instead of grievanceId for identifying the grievance
  3. Update the allocation status based on gwid

These changes align with the repository layer modifications and provide more accurate grievance identification.


241-242: Updated log messages to reference gwid instead of grievanceId.

The log messages have been updated to reference gwid instead of grievanceId, maintaining consistency with the updated identification approach in the codebase.

Also applies to: 244-245, 248-249


371-373: Added validation for benCallID.

New validation has been added to check if benCallID is not null, which is a good practice to ensure data integrity before processing the complaint resolution.


382-382: Added benCallID parameter in complaint resolution update.

The benCallID parameter has been extracted from the request and included in the repository method calls for updating complaint resolution. This enhances the identification of grievances and aligns with the repository layer changes.

Also applies to: 387-388, 392-393

src/main/java/com/iemr/common/repository/grievance/GrievanceDataRepo.java (5)

63-64: Updated unassignGrievance query to use gwid instead of grievanceId.

The query has been updated to identify grievances by gwid instead of grievanceId, which provides a more accurate way to identify specific grievance records. This change aligns with the service layer modifications.


68-70: Updated updateGrievanceAllocationStatus query to use gwid.

The query has been updated to use gwid instead of grievanceId for identifying grievances when updating their allocation status. This maintains consistency with other repository methods.


80-92: Added benCallID parameter to updateComplaintResolution query.

The query has been updated to include the benCallID parameter when updating complaint resolution details. This enhances grievance identification and aligns with the service layer modifications.


95-106: Added benCallID parameter to overloaded updateComplaintResolution query.

The overloaded version of the updateComplaintResolution method has also been updated to include the benCallID parameter, maintaining consistency with the other implementation.


108-108: Fixed query condition in getCallCounter method.

The query condition has been updated to properly reference grievance.complaintID instead of just complaintID, which ensures correct comparison in the SQL query.


// Fetch all unallocated grievances count from the database
Set<Object[]> resultSet = grievanceDataRepo.fetchUnallocatedGrievanceCount();
Set<Object[]> resultSet = grievanceDataRepo.fetchUnallocatedGrievanceCount(filterStartDate, filterEndDate);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

The providerServiceMapID parameter is not used in the repository call.

The method accepts providerServiceMapID as a parameter, but it's not passed to the repository method. This inconsistency may lead to bugs or confusion.

Consider updating the repository call to use the providerServiceMapID parameter:

-Set<Object[]> resultSet = grievanceDataRepo.fetchUnallocatedGrievanceCount(filterStartDate, filterEndDate);
+Set<Object[]> resultSet = grievanceDataRepo.fetchUnallocatedGrievanceCount(filterStartDate, filterEndDate, providerServiceMapID);

Also ensure that the corresponding repository method accepts this parameter.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Set<Object[]> resultSet = grievanceDataRepo.fetchUnallocatedGrievanceCount(filterStartDate, filterEndDate);
Set<Object[]> resultSet = grievanceDataRepo.fetchUnallocatedGrievanceCount(filterStartDate, filterEndDate, providerServiceMapID);

Copy link
Member

@ravishanigarapu ravishanigarapu left a comment

Choose a reason for hiding this comment

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

looks fine

@ravishanigarapu ravishanigarapu merged commit d33ac0b into PSMRI:develop Mar 6, 2025
7 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Mar 10, 2025
10 tasks
ravishanigarapu pushed a commit that referenced this pull request Mar 13, 2025
* adding changes related to encryption and decryption

* making final field static

* making enclosing method static

* adding beneficiaryConsent param to createFeedback API

* Update src/main/java/com/iemr/common/data/feedback/FeedbackDetails.java

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* adding beneficiary consent param feedbacklist response

* adding space

* adding code for schedule for grievance data sync

* adding code rabbit code suggestions

* adding code rabbit suggestions

* code rabbit suggested changes to Model classes

* adding sonar quality changes

* adding sonar quality code suggestions

* adding sonar quality check suggestions

* adding code rabbit suggestions

* adding constant instead of duplicate literals

* adding cod changs to fetch unallocated grievance count

* adding changes suggested by sonar quality check

* adding code rabbit suggested changes

* fixing config file

* fixing space

* fixing space issue

* adding package for PrimaryDBConfig

* adding code changes for allocate API for allocating grievance to agents

* removing space

* adding language related changes

* add language related changes

* adding name convention related changes

* adding code rabbit changes

* adding sonar quality check suggested changes

* removing unused imports

* adding properties related to Grievance in properties file

* placing the placeholder for jwt secret key

* Update package.yml

updating upload artifact version to v4

* removing grievanc related properties from application properties file

* adding space

* removing extra space

* adding code for API that fetches grievance outbound worklist

* adding code rabbit suggested changes

* another addition of code rabbit suggested changes

* fixing row no

* adding code for API to save complaint resolution and remarks in the db

* adding code rabbit suggested changes

* removing lastModDate as it will update automatically in db

* changing variable name of assignedUserID to userID

* fixing remarks

* removing full stop

* adding code for API to close call and make reattempts if needed

* adding code changes suggested by code rabbit

* adding code rabbit suggested changes

* adding code rabbit fixes

* adding code rabbit fixes

* Delete src/main/java/com/iemr/common/data/grievance/.gitignore

* AMM-1148 | Close call API including reattempt logic based on calltype (#164)

* adding code for API to close call and make reattempts if needed

* adding code changes suggested by code rabbit

* adding code rabbit suggested changes

* adding code rabbit fixes

* adding code rabbit fixes

* Delete src/main/java/com/iemr/common/data/grievance/.gitignore

---------

Co-authored-by: SR20290919 <SR20290919@APL-PG02PW8B>

* removing unused literal in repo class

* changing logic of Close call after discussion

* adding changes related to invalid and wrong number call type

* adding code for API to push back grievance data to GR team

* removed unnecessary conditions

* adding code rabbit changes

* adding code rabbit suggestions

* adding required null checks

* adding code rabbit suggested changes

* removing unnecessary Exception

* AMM-1149 | API to push back Grievance data to the GR team (#166)

* adding code for API to push back grievance data to GR team

* removed unnecessary conditions

* adding code rabbit changes

* adding code rabbit suggestions

* adding required null checks

* adding code rabbit suggested changes

* removing unnecessary Exception

---------

Co-authored-by: SR20290919 <SR20290919@APL-PG02PW8B>

* adding code changes for variable name change of lang

* adding code changes for grievance issues

* adding code changes for grievance issues (#168)

Co-authored-by: SR20290919 <SR20290919@APL-PG02PW8B>

* adding fixes related to grievance related APIs

* fixing code rabbit issues

* adding code fixes related to scheduler

---------

Co-authored-by: SR20290919 <SR20290919@APL-PG02PW8B>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: SR20290919 <SR20290919@192.168.1.34>
Co-authored-by: SR20290919 <SR20290919@APL-PG02PW8B.wipro.com>
@coderabbitai coderabbitai bot mentioned this pull request Mar 20, 2025
10 tasks
@coderabbitai coderabbitai bot mentioned this pull request Apr 1, 2025
10 tasks
ravishanigarapu added a commit that referenced this pull request Apr 25, 2025
…tion (#190)

* adding changes related to encryption and decryption

* making final field static

* making enclosing method static

* adding beneficiaryConsent param to createFeedback API

* Update src/main/java/com/iemr/common/data/feedback/FeedbackDetails.java

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* adding beneficiary consent param feedbacklist response

* adding space

* adding code for schedule for grievance data sync

* adding code rabbit code suggestions

* adding code rabbit suggestions

* code rabbit suggested changes to Model classes

* adding sonar quality changes

* adding sonar quality code suggestions

* adding sonar quality check suggestions

* adding code rabbit suggestions

* adding constant instead of duplicate literals

* adding cod changs to fetch unallocated grievance count

* adding changes suggested by sonar quality check

* adding code rabbit suggested changes

* fixing config file

* fixing space

* fixing space issue

* adding package for PrimaryDBConfig

* adding code changes for allocate API for allocating grievance to agents

* removing space

* adding language related changes

* add language related changes

* adding name convention related changes

* adding code rabbit changes

* adding sonar quality check suggested changes

* removing unused imports

* adding properties related to Grievance in properties file

* placing the placeholder for jwt secret key

* Update package.yml

updating upload artifact version to v4

* removing grievanc related properties from application properties file

* adding space

* removing extra space

* adding code for API that fetches grievance outbound worklist

* adding code rabbit suggested changes

* another addition of code rabbit suggested changes

* fixing row no

* adding code for API to save complaint resolution and remarks in the db

* adding code rabbit suggested changes

* removing lastModDate as it will update automatically in db

* changing variable name of assignedUserID to userID

* fixing remarks

* removing full stop

* adding code for API to close call and make reattempts if needed

* adding code changes suggested by code rabbit

* adding code rabbit suggested changes

* adding code rabbit fixes

* adding code rabbit fixes

* Delete src/main/java/com/iemr/common/data/grievance/.gitignore

* AMM-1148 | Close call API including reattempt logic based on calltype (#164)

* adding code for API to close call and make reattempts if needed

* adding code changes suggested by code rabbit

* adding code rabbit suggested changes

* adding code rabbit fixes

* adding code rabbit fixes

* Delete src/main/java/com/iemr/common/data/grievance/.gitignore

---------

Co-authored-by: SR20290919 <SR20290919@APL-PG02PW8B>

* removing unused literal in repo class

* changing logic of Close call after discussion

* adding changes related to invalid and wrong number call type

* adding code for API to push back grievance data to GR team

* removed unnecessary conditions

* adding code rabbit changes

* adding code rabbit suggestions

* adding required null checks

* adding code rabbit suggested changes

* removing unnecessary Exception

* AMM-1149 | API to push back Grievance data to the GR team (#166)

* adding code for API to push back grievance data to GR team

* removed unnecessary conditions

* adding code rabbit changes

* adding code rabbit suggestions

* adding required null checks

* adding code rabbit suggested changes

* removing unnecessary Exception

---------

Co-authored-by: SR20290919 <SR20290919@APL-PG02PW8B>

* adding code changes for variable name change of lang

* adding code changes for grievance issues

* adding code changes for grievance issues (#168)

Co-authored-by: SR20290919 <SR20290919@APL-PG02PW8B>

* adding fixes related to grievance related APIs

* fixing code rabbit issues

* adding code fixes related to scheduler

* Scheduler changes

* adding import

* adding grievance sms template changes

* removing space

---------

Co-authored-by: SR20290919 <SR20290919@APL-PG02PW8B>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: SR20290919 <SR20290919@192.168.1.34>
Co-authored-by: SR20290919 <SR20290919@APL-PG02PW8B.wipro.com>
Co-authored-by: Ravi Shanigarapu <ravi.shanigarapu@wipro.com>
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