Skip to content

Move code from Release 3.4.0 to main#94

Merged
snehar-nd merged 5 commits intomainfrom
release-3.4.0
Aug 25, 2025
Merged

Move code from Release 3.4.0 to main#94
snehar-nd merged 5 commits intomainfrom
release-3.4.0

Conversation

@vishwab1
Copy link
Copy Markdown
Member

@vishwab1 vishwab1 commented Aug 25, 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

    • Beneficiary details now include Father’s Name and Preferred Phone Number in the left panel and related summary views, providing a more complete profile at a glance.
  • Chores

    • Updated underlying API dependency to a newer minor version to maintain compatibility and improve stability.
  • Tests

    • Adjusted data handling to accommodate the two new beneficiary fields in retrieved results, ensuring consistent display across the app.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Aug 25, 2025

Walkthrough

Bumped tm-api version to 3.4.0 in pom.xml. Added fatherName and preferredPhoneNum fields to BeneficiaryFlowStatus constructor and mapped them in getBeneficiaryFlowStatusForLeftPanel. Updated repository query to select t.fatherName and t.preferredPhoneNum. Removed constructor’s explicit bloodGroup null assignment.

Changes

Cohort / File(s) Summary
Build/Version bump
pom.xml
Updated dependency version: tm-api from 3.1.0 to 3.4.0.
Entity construction update
src/main/java/com/iemr/tm/data/benFlowStatus/BeneficiaryFlowStatus.java
Extended public constructor to include String fatherName, String preferredPhoneNum; assigned to fields; updated getBeneficiaryFlowStatusForLeftPanel to read objArr[19], objArr[20] and pass them; removed explicit this.bloodGroup = null.
Repository query extension
src/main/java/com/iemr/tm/repo/benFlowStatus/BeneficiaryFlowStatusRepo.java
Amended getBenDetailsForLeftSidePanel SELECT to append t.fatherName, t.preferredPhoneNum, increasing result set columns by two.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Repo as BeneficiaryFlowStatusRepo
  participant DB
  participant Helper as BeneficiaryFlowStatus.getBeneficiaryFlowStatusForLeftPanel
  participant Entity as BeneficiaryFlowStatus

  Client->>Repo: getBenDetailsForLeftSidePanel(params)
  Repo->>DB: SELECT ... , t.fatherName, t.preferredPhoneNum
  DB-->>Repo: Object[] rows (… + fatherName, preferredPhoneNum)
  Repo-->>Client: ArrayList<Object[]>

  Client->>Helper: map Object[] to BeneficiaryFlowStatus
  Note over Helper,Entity: Uses objArr[19], objArr[20] for new fields
  Helper->>Entity: new BeneficiaryFlowStatus(..., fatherName, preferredPhoneNum)
  Entity-->>Client: BeneficiaryFlowStatus instance
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit peeks at fields anew,
Two strings hop in the data queue—
Father’s name, preferred phone too,
The repo grows, the mapping true.
Version’s bumped, we’re through the gate,
Carrots up! Ship 3.4.0—great! 🥕🚀

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch release-3.4.0

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/com/iemr/tm/data/benFlowStatus/BeneficiaryFlowStatus.java (1)

332-354: Assign the unused visitDate parameter and remove redundant nulling of bloodGroup

I’ve confirmed that the constructor signature includes a Timestamp visitDate parameter, but there is no corresponding this.visitDate = visitDate; assignment. In addition, this.bloodGroup = null; is unnecessary because instance fields default to null. Please apply the following refactor in src/main/java/com/iemr/tm/data/benFlowStatus/BeneficiaryFlowStatus.java (around lines 332–354):

• After setting this.serviceDate, add:

-        this.serviceDate = benVisitDate;
+        this.serviceDate = benVisitDate;
+        this.visitDate = visitDate;

• Remove the explicit null assignment for bloodGroup:

-        this.bloodGroup = null;
+        // bloodGroup left as default (null) unless set elsewhere

If the visitDate parameter is intentionally unused, please annotate it (e.g. @SuppressWarnings("unused")) or document why it’s omitted to prevent future confusion.

🧹 Nitpick comments (2)
src/main/java/com/iemr/tm/data/benFlowStatus/BeneficiaryFlowStatus.java (2)

352-354: Null/format safeguards for fatherName and preferredPhoneNum

If these values can be null or malformed from the DB, consider normalizing (trim, empty-to-null) and, for preferredPhoneNum, optional format validation before exposing in APIs.


367-380: Guard against multiple/empty rows and avoid needless loop

The query (by benRegID and benFlowID) should return at most one row. Looping assigns the last row if more exist and returns null if empty. Prefer explicit handling.

Apply:

 public static BeneficiaryFlowStatus getBeneficiaryFlowStatusForLeftPanel(ArrayList<Object[]> objList) {
-    BeneficiaryFlowStatus obj = null;
-    if (objList != null && objList.size() > 0) {
-        for (Object[] objArr : objList) {
-            obj = new BeneficiaryFlowStatus((Long) objArr[0], (Long) objArr[1], (Timestamp) objArr[2],
-                    (String) objArr[3], (String) objArr[4], (Integer) objArr[5], (Short) objArr[6],
-                    (String) objArr[7], (String) objArr[8], (String) objArr[9], (Long) objArr[10],
-                    (String) objArr[11], (String) objArr[12], (String) objArr[13], (Long) objArr[14],
-                    (Timestamp) objArr[15], (Timestamp) objArr[16], (Long) objArr[17], (Timestamp) objArr[18],
-                    (String) objArr[19], (String) objArr[20]);
-        }
-    }
-    return obj;
+    if (objList == null || objList.isEmpty()) {
+        return null;
+    }
+    if (objList.size() > 1) {
+        // Optional: log a warning; unexpected multiple rows for unique keys
+    }
+    Object[] objArr = objList.get(0);
+    return new BeneficiaryFlowStatus((Long) objArr[0], (Long) objArr[1], (Timestamp) objArr[2],
+            (String) objArr[3], (String) objArr[4], (Integer) objArr[5], (Short) objArr[6],
+            (String) objArr[7], (String) objArr[8], (String) objArr[9], (Long) objArr[10],
+            (String) objArr[11], (String) objArr[12], (String) objArr[13], (Long) objArr[14],
+            (Timestamp) objArr[15], (Timestamp) objArr[16], (Long) objArr[17], (Timestamp) objArr[18],
+            (String) objArr[19], (String) objArr[20]);
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between de0e901 and 317ae6f.

📒 Files selected for processing (3)
  • pom.xml (1 hunks)
  • src/main/java/com/iemr/tm/data/benFlowStatus/BeneficiaryFlowStatus.java (3 hunks)
  • src/main/java/com/iemr/tm/repo/benFlowStatus/BeneficiaryFlowStatusRepo.java (1 hunks)
🔇 Additional comments (2)
pom.xml (1)

9-9: No hardcoded tm-api WAR references found

I ran ripgrep across the repository (excluding build outputs) for any hard-coded tm-api-*.war occurrences and for any .war mentions in CI/CD configs, and found none.

• No tm-api-3.x.x.war patterns in source files
• No Jenkinsfile, .yml or .yaml CI/CD config files in the repo

Please ensure there aren’t any external packaging or deployment scripts (outside this repository) that assume the older WAR name.

src/main/java/com/iemr/tm/repo/benFlowStatus/BeneficiaryFlowStatusRepo.java (1)

119-122: Mapping Verified: fatherName and preferredPhoneNum align with entity column mappings
The @column annotations in src/main/java/com/iemr/tm/data/benFlowStatus/BeneficiaryFlowStatus.java

  • Line 165: @Column(name = "ben_phone_no") private String preferredPhoneNum;
  • Line 169: @Column(name = "father_name") private String fatherName;

match the two fields appended to the end of the SELECT list in BeneficiaryFlowStatusRepo.java (lines 119–122), and they correspond to objArr[19] and objArr[20] in getBeneficiaryFlowStatusForLeftPanel. No drift detected—changes approved.

Comment on lines +375 to 377
(Timestamp) objArr[15], (Timestamp) objArr[16], (Long) objArr[17], (Timestamp) objArr[18],
(String) objArr[19], (String) objArr[20]);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Brittle index-based mapping — prefer JPQL constructor projection

The indices align with the SELECT list today (fatherName at 19, preferredPhoneNum at 20). To eliminate future off-by-one risks, switch the repository query to a constructor projection and return BeneficiaryFlowStatus directly (no Object[] casts).

In the repo file, change the query to:

-@Query("SELECT  t.benFlowID, t.beneficiaryRegID, t.visitDate, t.benName, t.age, t.ben_age_val, t.genderID, t.genderName, "
-     + " t.villageName, t.districtName, t.beneficiaryID, t.servicePointName, t.VisitReason, t.VisitCategory, t.benVisitID,  "
-     + " t.registrationDate, t.benVisitDate, t.visitCode, t.consultationDate, t.fatherName, t.preferredPhoneNum FROM BeneficiaryFlowStatus t "
-     + " Where t.beneficiaryRegID = :benRegID AND t.benFlowID = :benFlowID ")
-public ArrayList<Object[]> getBenDetailsForLeftSidePanel(...)
+@Query("SELECT new com.iemr.tm.data.benFlowStatus.BeneficiaryFlowStatus("
+     + " t.benFlowID, t.beneficiaryRegID, t.visitDate, t.benName, t.age, t.ben_age_val, t.genderID, t.genderName, "
+     + " t.villageName, t.districtName, t.beneficiaryID, t.servicePointName, t.VisitReason, t.VisitCategory, t.benVisitID, "
+     + " t.registrationDate, t.benVisitDate, t.visitCode, t.consultationDate, t.fatherName, t.preferredPhoneNum) "
+     + " FROM BeneficiaryFlowStatus t WHERE t.beneficiaryRegID = :benRegID AND t.benFlowID = :benFlowID ")
+public ArrayList<BeneficiaryFlowStatus> getBenDetailsForLeftSidePanel(...)

Then this method can simply return the first element (or Optional).

📝 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
(Timestamp) objArr[15], (Timestamp) objArr[16], (Long) objArr[17], (Timestamp) objArr[18],
(String) objArr[19], (String) objArr[20]);
}
// Before
- @Query("SELECT t.benFlowID, t.beneficiaryRegID, t.visitDate, t.benName, t.age, t.ben_age_val, t.genderID, t.genderName, "
- + " t.villageName, t.districtName, t.beneficiaryID, t.servicePointName, t.VisitReason, t.VisitCategory, t.benVisitID, "
- + " t.registrationDate, t.benVisitDate, t.visitCode, t.consultationDate, t.fatherName, t.preferredPhoneNum FROM BeneficiaryFlowStatus t "
- + " Where t.beneficiaryRegID = :benRegID AND t.benFlowID = :benFlowID ")
- public ArrayList<Object[]> getBenDetailsForLeftSidePanel(...);
// After
@Query("SELECT new com.iemr.tm.data.benFlowStatus.BeneficiaryFlowStatus("
+ " t.benFlowID, t.beneficiaryRegID, t.visitDate, t.benName, t.age, t.ben_age_val, t.genderID, t.genderName, "
+ " t.villageName, t.districtName, t.beneficiaryID, t.servicePointName, t.VisitReason, t.VisitCategory, t.benVisitID, "
+ " t.registrationDate, t.benVisitDate, t.visitCode, t.consultationDate, t.fatherName, t.preferredPhoneNum) "
+ " FROM BeneficiaryFlowStatus t "
+ "WHERE t.beneficiaryRegID = :benRegID AND t.benFlowID = :benFlowID ")
public ArrayList<BeneficiaryFlowStatus> getBenDetailsForLeftSidePanel(...);
🤖 Prompt for AI Agents
In src/main/java/com/iemr/tm/data/benFlowStatus/BeneficiaryFlowStatus.java
around lines 375 to 377, the code relies on fragile Object[] index-based mapping
from a native/JPQL select; replace that by changing the repository query to use
a JPQL constructor projection (SELECT new
com.iemr.tm.data.benFlowStatus.BeneficiaryFlowStatus(...matching fields... )
...) so the repository returns BeneficiaryFlowStatus instances instead of
Object[], then update this method to accept the repository result and simply
return the first element or Optional<BeneficiaryFlowStatus> (no casts or index
extraction). Ensure the constructor parameter order matches the select list and
update the repository method signature to the concrete type.

Comment on lines 119 to 122
@Query("SELECT t.benFlowID, t.beneficiaryRegID, t.visitDate, t.benName, t.age, t.ben_age_val, t.genderID, t.genderName, "
+ " t.villageName, t.districtName, t.beneficiaryID, t.servicePointName, t.VisitReason, t.VisitCategory, t.benVisitID, "
+ " t.registrationDate, t.benVisitDate, t.visitCode, t.consultationDate FROM BeneficiaryFlowStatus t "
+ " t.registrationDate, t.benVisitDate, t.visitCode, t.consultationDate, t.fatherName, t.preferredPhoneNum FROM BeneficiaryFlowStatus t "
+ " Where t.beneficiaryRegID = :benRegID AND t.benFlowID = :benFlowID ")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Reduce mapping fragility with JPQL constructor projection

To avoid Object[] casting and index coupling, consider returning BeneficiaryFlowStatus directly with a constructor expression.

Apply:

-    @Query("SELECT  t.benFlowID, t.beneficiaryRegID, t.visitDate, t.benName, t.age, t.ben_age_val, t.genderID, t.genderName, "
-            + " t.villageName, t.districtName, t.beneficiaryID, t.servicePointName, t.VisitReason, t.VisitCategory, t.benVisitID,  "
-            + " t.registrationDate, t.benVisitDate, t.visitCode, t.consultationDate, t.fatherName, t.preferredPhoneNum FROM BeneficiaryFlowStatus t "
-            + " Where t.beneficiaryRegID = :benRegID AND t.benFlowID = :benFlowID ")
-    public ArrayList<Object[]> getBenDetailsForLeftSidePanel(@Param("benRegID") Long benRegID,
-            @Param("benFlowID") Long benFlowID);
+    @Query("SELECT new com.iemr.tm.data.benFlowStatus.BeneficiaryFlowStatus("
+            + " t.benFlowID, t.beneficiaryRegID, t.visitDate, t.benName, t.age, t.ben_age_val, t.genderID, t.genderName, "
+            + " t.villageName, t.districtName, t.beneficiaryID, t.servicePointName, t.VisitReason, t.VisitCategory, t.benVisitID, "
+            + " t.registrationDate, t.benVisitDate, t.visitCode, t.consultationDate, t.fatherName, t.preferredPhoneNum) "
+            + " FROM BeneficiaryFlowStatus t WHERE t.beneficiaryRegID = :benRegID AND t.benFlowID = :benFlowID ")
+    public ArrayList<BeneficiaryFlowStatus> getBenDetailsForLeftSidePanel(@Param("benRegID") Long benRegID,
+            @Param("benFlowID") Long benFlowID);
🤖 Prompt for AI Agents
In src/main/java/com/iemr/tm/repo/benFlowStatus/BeneficiaryFlowStatusRepo.java
around lines 119 to 122, the JPQL currently selects individual fields which
forces consumers to handle Object[] and fragile index-based mapping; change the
query to use a JPQL constructor expression (SELECT new
com.iemr.tm.model.benFlowStatus.BeneficiaryFlowStatus(...)) listing the same
fields in the same order, ensure the BeneficiaryFlowStatus class has a matching
public constructor accepting those types in that order, and update the
repository method signature to return BeneficiaryFlowStatus (or
List<BeneficiaryFlowStatus>) instead of Object[] so callers receive typed
instances directly.

@snehar-nd snehar-nd merged commit cf9f71c into main Aug 25, 2025
2 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.

3 participants