Skip to content

Conversation

@ravishanigarapu
Copy link
Contributor

@ravishanigarapu ravishanigarapu commented Jun 16, 2025

πŸ“‹ Description

JIRA ID: AMM-1536

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
    • Replaced the "isSanjeevani" attribute with a new "teleConsultation" attribute in user role mapping features.
  • Bug Fixes
    • Updated data handling to support the new "teleConsultation" field for accurate role mapping.
  • Style
    • Improved code consistency and readability in related sections.

@coderabbitai
Copy link

coderabbitai bot commented Jun 16, 2025

Walkthrough

The changes replace the Boolean field and logic for isSanjeevani with a new String field and logic for teleConsultation across several employee role mapping classes, controllers, and service implementations. All references, data mappings, and accessors are updated accordingly, with no modifications to method signatures or overall control flow.

Changes

File(s) Change Summary
.../controller/employeemaster/EmployeeMasterController.java Replaced all IsSanjeevani logic and assignments with TeleConsultation in user role mapping methods.
.../data/employeemaster/M_UserServiceRoleMapping2.java Removed Boolean isSanjeevani field; added String teleConsultation field mapped to new DB column.
.../data/employeemaster/V_Userservicerolemapping.java Removed Boolean isSanjeevani; added String teleConsultation with annotations.
.../service/employeemaster/EmployeeMasterServiceImpl.java Removed all logic referencing isSanjeevani; added logic for teleConsultation in role mapping retrieval.
.../to/employeemaster/Priveleges1097_2.java Removed Boolean isSanjeevani field and its accessors; added String teleConsultation and its accessors.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Controller
    participant Service
    participant DataModel

    Client->>Controller: Request user role mapping
    Controller->>Service: getMappedRole()
    Service->>DataModel: Retrieve role mapping (includes teleConsultation)
    DataModel-->>Service: Return mapping with teleConsultation field
    Service-->>Controller: Return mapped roles with teleConsultation
    Controller-->>Client: Respond with mapping (teleConsultation info)
Loading

Poem

In fields where carrots softly grow,
A change has come, as rabbits knowβ€”
No more Sanjeevani to be found,
TeleConsultation hops around!
With strings instead of Boolean beans,
Our code is fresh, robust, and clean.
πŸ₯•βœ¨


πŸ“œ 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 f40ce74 and 64cc5b5.

πŸ“’ Files selected for processing (1)
  • src/main/java/com/iemr/admin/controller/employeemaster/EmployeeMasterController.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/iemr/admin/controller/employeemaster/EmployeeMasterController.java
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Package-test
  • GitHub Check: Analyze (java)
✨ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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

@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 comments (1)
src/main/java/com/iemr/admin/controller/employeemaster/EmployeeMasterController.java (1)

1842-1862: **teleConsultation is set only once per outer loop – the inner loop result is overwritten **

resDataMap1 is instantiated inside the inner for (Priveleges1097_2 previl1 …) loop, yet it is added to resList1 after that loop finishes (line 1861).
As a consequence, only the last previl1 encountered is retained; every previous iteration is lost (including its teleConsultation, inbound / outbound flags, etc.).

 for (Priveleges1097_2 previl1 : predata2) {
     resDataMap1 = new M_UserServiceRoleMapping2();
     resDataMap1.setRoleID(previl1.getRoleID());
     …
-}
-resDataMap1.setUserID(employeeMaster.get(x).getUserID());
-…
-resList1.add(resDataMap1);
+    resDataMap1.setUserID(employeeMaster.get(x).getUserID());
+    resDataMap1.setProviderServiceMapID(previl.getProviderServiceMapID());
+    …
+    resList1.add(resDataMap1);   // add *inside* the loop
+}

Putting the remaining setters + add() inside the inner loop preserves every mapping record.

🧹 Nitpick comments (6)
src/main/java/com/iemr/admin/controller/employeemaster/EmployeeMasterController.java (2)

1848-1850: Guard-clause is redundant

teleConsultation is already nullable in the entity. If a null arrives, doing nothing or explicitly setting null is equivalent. You can drop the if (…) check and set the value unconditionally to keep the code compact.


1908-1911: Setter duplicated – consider early-return instead

Exactly the same null-check & setter for teleConsultation was added here. If you refactor the earlier loop as suggested, this block can stay, but watch out for code duplication across controller methods – a private helper (applyTeleConsultationIfPresent) would avoid divergence.

src/main/java/com/iemr/admin/to/employeemaster/Priveleges1097_2.java (1)

29-55: Clarify semantics of teleConsultation

You replaced a Boolean isSanjeevani with a String teleConsultation, but the valid values / semantics are not documented.
If the field is meant to act as an on/off flag (e.g. "Y"/"N"), sticking to Boolean or an enum { YES, NO } is safer than a free-form string and simplifies validation throughout the stack.

src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterServiceImpl.java (2)

995-1000: Redundant self-assignments – remove to reduce noise and avoid misleading readers

setBlockID, setBlockName, setVillageID, and setVillageName are invoked with the exact value already held by the same instance.
These statements do nothing and only add cognitive overhead.

- if (mapping.getServiceID() != null) {
-     mapping.setBlockID(mapping.getBlockID());
-     mapping.setBlockName(mapping.getBlockName());
-     mapping.setVillageID(mapping.getVillageID());
-     mapping.setVillageName(mapping.getVillageName());
+ if (mapping.getServiceID() != null) {
     // fields are already populated above

1009-1011: No-op assignment for teleConsultation

The null check is fine, but setTeleConsultation(getTeleConsultation()) again assigns a value to itself and achieves nothing.
Either drop the whole block or perform a meaningful transformation (e.g., trim, normalise to upper-case, etc.).

- if (null != mapping.getTeleConsultation())
-     mapping.setTeleConsultation(mapping.getTeleConsultation());
+ // value already present; remove unless additional processing is required
src/main/java/com/iemr/admin/data/employeemaster/V_Userservicerolemapping.java (1)

150-158: Remove commented legacy field & document new one

  1. Keeping the old isSanjeevani field in comments clutters the entity and may confuse future maintainers.
  2. Consider adding a brief Javadoc on teleConsultation explaining allowed values (e.g., "Y" / "N" or a code list) because the type changed from Boolean to String.
- /*
-  * @Expose
-  * @Column(name="isSanjeevani")
-  * private Boolean isSanjeevani;
-  */
+ /**
+  * Indicates tele-consultation eligibility.
+  * Expected values: "Y", "N", or empty.
+  */
πŸ“œ Review details

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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between b319fb6 and 04b53dd.

πŸ“’ Files selected for processing (5)
  • src/main/java/com/iemr/admin/controller/employeemaster/EmployeeMasterController.java (2 hunks)
  • src/main/java/com/iemr/admin/data/employeemaster/M_UserServiceRoleMapping2.java (1 hunks)
  • src/main/java/com/iemr/admin/data/employeemaster/V_Userservicerolemapping.java (1 hunks)
  • src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterServiceImpl.java (1 hunks)
  • src/main/java/com/iemr/admin/to/employeemaster/Priveleges1097_2.java (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (java)
  • GitHub Check: Package-test
πŸ”‡ Additional comments (1)
src/main/java/com/iemr/admin/data/employeemaster/M_UserServiceRoleMapping2.java (1)

108-112: Column definition for teleConsultation lacks length / constraint

By default Hibernate maps a String to varchar(255).
If the underlying column in your migration / DB script is shorter (many existing tables use char(1) or varchar(10) for yes/​no flags), inserts will fail. Declare an explicit length to document the contract:

-@Column(name = "teleConsultation")
-private String teleConsultation;
+@Column(name = "teleConsultation", length = 10, nullable = true)
+private String teleConsultation;

Adjust the length to match the DDL.

@Expose
@Column(name="isSanjeevani")
private Boolean isSanjeevani;
@Column(name="teleConsultation")
Copy link
Member

Choose a reason for hiding this comment

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

Comment says isSanjeevani but the boolean is teleConsultation.
Also the attribute isSanjeevani is not needed?
If you are adding new attributes, can you also raise a PR for AMRIT-DB

private Boolean inbound;
private Boolean outbound;
private Boolean isSanjeevani;
//private Boolean isSanjeevani;
Copy link
Member

Choose a reason for hiding this comment

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

What is the impact of removing this?
Can you remove commented out code.
Should this attribute be removed from table also?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes we are removing this column from table also

mapping.setIsSanjeevani(false);

}
if(null != mapping.getTeleConsultation())
Copy link
Member

Choose a reason for hiding this comment

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

are there some curly braces missing here {}
not following where this if block ends.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we are not adding curly braces{} this condition will apply for next line alone.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm. That sort of conditional statement is awful for readability.

if(previl1.getIsSanjeevani() != null) {
resDataMap1.setIsSanjeevani(previl1.getIsSanjeevani());
if(previl1.getTeleConsultation() != null) {
resDataMap1.setTeleConsultation(previl1.getTeleConsultation());
Copy link
Member

Choose a reason for hiding this comment

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

indent

@sonarqubecloud
Copy link

@drtechie
Copy link
Member

@mo839639 please raise PR for AMRIT-DB

@ravishanigarapu ravishanigarapu merged commit c7731f6 into PSMRI:develop Jun 17, 2025
7 checks passed
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