Skip to content

Conversation

@helenKaryamsetty
Copy link
Member

@helenKaryamsetty helenKaryamsetty commented Feb 27, 2025

πŸ“‹ Description

JIRA ID: AMM-1273

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

    • Enriched health detail responses with a new status indicator to flag new records.
    • Added a new method to retrieve the new ABHA status for health ID numbers.
  • Bug Fixes

    • Enhanced logic for verifying login conditions based on the login method and hint.
  • Refactor

    • Improved internal processing for beneficiary registrations and streamlined the logic for retrieving and assembling health records.
    • Cleaned up unused code and imports to enhance clarity and maintainability.
  • Chores

    • Updated Java distribution in CI/CD workflows for improved build environment consistency.
    • Removed deprecated JWT-related configurations and classes to streamline the application.

KA40094929 and others added 28 commits December 13, 2024 18:38
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 27, 2025

Walkthrough

The changes refactor the handling of health ID mappings by introducing Lombok's @Data annotation to remove manual getter/setter implementations in the mapping class and by adding a new transient field isNewAbha. A corresponding repository method, getIsNewAbha, has been added to retrieve this field from the database. The service layer has been updated to use consistent naming for beneficiary registration methods and to enrich health details with the new ABHA flag before returning responses. Additionally, several utility classes and configurations related to JWT and Redis have been removed.

Changes

File(s) Changed Change Summary
.../data/healthID/BenHealthIDMapping.java
.../repo/healthID/BenHealthIDMappingRepo.java
Added Lombok @Data annotation to remove manual getter/setter methods and introduced a new transient boolean field isNewAbha. A new repository method getIsNewAbha was added to retrieve the value of this field from the database.
.../service/healthID/HealthIDServiceImpl.java Renamed beneficiary registration methods for consistency and modified the logic in getBenHealthID to enrich health details by retrieving the isNewAbha status via the repository, ensuring updated mappings in the response.
.../workflows/build-on-pull-request.yml
.../workflows/package.yml
.../workflows/sast.yml
Updated Java distribution from 'zulu' to 'adopt' in CI/CD workflows.
pom.xml Reformatted dependency declarations and removed several io.jsonwebtoken dependencies, improving readability without affecting functionality.
src/main/environment/common_*.properties Removed jwt.secret property from multiple environment configuration files, indicating a change in JWT handling.
.../FhirApiApplication.java
.../config/RedisConfig.java
.../utils/CookieUtil.java
.../utils/JwtAuthenticationUtil.java
.../utils/JwtUserIdValidationFilter.java
.../utils/JwtUtil.java
Removed several classes and configurations related to JWT and Redis, indicating a significant change in the application's authentication and caching mechanisms.
.../data/users/User.java
.../repo/user/UserLoginRepo.java
Removed the User entity class and its corresponding repository, indicating a refactor or removal of user management functionality.
.../data/v3/abhaCard/LoginMethod.java Added a new private member variable loginHint to the LoginMethod class.
.../service/common/CommonServiceImpl.java Cleaned up commented-out code and streamlined variable usage within the addCareContextToMongo method.
.../service/v3/abha/LoginAbhaV3ServiceImpl.java Modified the verifyAbhaLogin method to add a condition for checking the login hint alongside the login method.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Service as HealthIDServiceImpl
    participant Repo as BenHealthIDMappingRepo

    Client->>Service: Request health ID details
    Service->>Repo: Call getIsNewAbha(healthIdNumber)
    Repo-->>Service: Return isNewAbha status
    Service->>Service: Enrich health details with isNewAbha flag
    Service->>Client: Return enriched health details
Loading

Possibly related PRs

  • ABHA - Address Search API changesΒ #56: The changes in the main PR, specifically the addition of the isNewAbha field in the BenHealthIDMapping class, are related to the new method getIsNewAbha in the BenHealthIDMappingRepo interface, as both modifications involve the same field and its usage in the application.
  • Abdm M1 V3 ChangesΒ #52: The changes in the main PR, specifically the addition of the isNewAbha field in the BenHealthIDMapping class, are directly related to the new method getIsNewAbha in the BenHealthIDMappingRepo interface, which retrieves the value of this field, establishing a strong connection at the code level.
  • AMM-871 Abdm Facility fetch services changesΒ #46: The changes in the main PR, which involve the addition of a new field isNewAbha and the use of Lombok's @Data annotation in the BenHealthIDMapping class, are related to the changes in the retrieved PR, where a new method getIsNewAbha is introduced in the BenHealthIDMappingRepo interface to retrieve the isNewAbha field.

Suggested reviewers

  • ravishanigarapu

Poem

I'm a rabbit with a happy hop,
Coding fields now neatly on top.
Lombok's magic cleared the way,
isNewAbha is here to stay.
With each little change, my joy won't stop!

✨ Finishing Touches
  • πŸ“ Generate Docstrings

πŸͺ§ 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
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 (1)
src/main/java/com/wipro/fhir/repo/healthID/BenHealthIDMappingRepo.java (1)

79-80: New method for retrieving ABHA status looks good

This method will help determine if a specific health ID number is new by querying the isNewAbha column from the t_healthid table.

However, I noticed the order by clause uses order by 1 without specifying a column name. Consider using an explicit column name to avoid potential issues if the table structure changes in the future.

-	@Query(value = "select isNewAbha from t_healthid where HealthIdNumber=:healthIdNumber order by 1 desc limit 1", nativeQuery = true)
+	@Query(value = "select isNewAbha from t_healthid where HealthIdNumber=:healthIdNumber order by CreatedDate desc limit 1", nativeQuery = true)
πŸ“œ Review details

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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between f55149d and 4cbaf06.

πŸ“’ Files selected for processing (3)
  • src/main/java/com/wipro/fhir/data/healthID/BenHealthIDMapping.java (2 hunks)
  • src/main/java/com/wipro/fhir/repo/healthID/BenHealthIDMappingRepo.java (1 hunks)
  • src/main/java/com/wipro/fhir/service/healthID/HealthIDServiceImpl.java (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (java)
πŸ”‡ Additional comments (5)
src/main/java/com/wipro/fhir/data/healthID/BenHealthIDMapping.java (2)

33-33: Good use of Lombok to reduce boilerplate code

The @Data annotation is a convenient shortcut that bundles several Lombok annotations (@Getter, @Setter, @tostring, @EqualsAndHashCode, and @requiredargsconstructor), which will generate all the getters and setters automatically.

Also applies to: 38-38


78-79: New transient field for tracking new ABHA status

The isNewAbha field is correctly marked as @Transient since it doesn't need to be persisted to the database and is populated from another table.

src/main/java/com/wipro/fhir/service/healthID/HealthIDServiceImpl.java (3)

65-65: Variable naming consistency improvements

Good changes to maintain consistency in variable naming by changing getBeneficiaryRegId/setBeneficiaryRegId to getBeneficiaryRegID/setBeneficiaryRegID to match the field name in the class.

Also applies to: 67-67, 72-72


120-131: Good implementation for enriching health details with ABHA status

The new code properly enriches each health detail with the ABHA status information before returning the results, which enhances the API's functionality.


120-131: ⚠️ Potential issue

Method name inconsistency in enriching health details

The code is using setNewAbha() in line 126, but the field in the BenHealthIDMapping class is named isNewAbha. This naming inconsistency might cause issues.

Lombok generates getters and setters with specific naming conventions. For boolean fields, getters are prefixed with "is" and setters with "set". Please update the code to use the correct method name:

-				healthDetails.setNewAbha(isNewAbha);
+				healthDetails.setIsNewAbha(isNewAbha);

Additionally, consider adding error handling for potential exceptions when calling getIsNewAbha(), especially for cases where the health ID number might not exist in the database.

Likely an incorrect or invalid review comment.

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 (4)
src/main/java/com/wipro/fhir/service/common/CommonServiceImpl.java (2)

164-164: Fix typo in log message

There's a typo in the log message: "dagetPatientListForResourceEligibleys" should be "days".

- logger.info("No of records available to create FHIR in last 2 dagetPatientListForResourceEligibleys : " + pList.size());
+ logger.info("No of records available to create FHIR in last 2 days : " + pList.size());

336-342: Remove commented-out code blocks

There are several commented-out code blocks that are no longer needed after the refactoring. Consider removing these to improve code readability and maintainability.

-//				}
-//					if (pcc != null && pcc.getIdentifier() != null) {
-//						ccList = pcc.getCareContextsList();
-//						ccList.add(cc);
-//						pcc.setCareContextsList(ccList);
-//						resultSet = patientCareContextsMongoRepo.save(pcc);
-//
.github/workflows/sast.yml (1)

44-45: Consistent Java Distribution & Trailing Space Cleanup

The JDK 17 setup has been updated to use distribution: 'adopt' which aligns with other workflow files. However, static analysis detects trailing spaces on line 45. It is recommended to remove these trailing spaces to adhere to YAML best practices.

🧰 Tools
πŸͺ› YAMLlint (1.35.1)

[error] 45-45: trailing spaces

(trailing-spaces)

src/main/environment/common_ci.properties (1)

1-113: JWT Secret Property Removal

The jwt.secret configuration property has been intentionally removed from this file per our security update. Please ensure that the JWT secret is now provided via a secure mechanism (e.g., environment variables, a dedicated secrets manager, etc.) and that the configuration documentation is updated to reflect this change. If this removal affects any runtime authentication/authorization processes, verify that alternative secure key provisioning is in place.

πŸ“œ Review details

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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 4cbaf06 and ebff8ad.

πŸ“’ Files selected for processing (20)
  • .github/workflows/build-on-pull-request.yml (1 hunks)
  • .github/workflows/package.yml (2 hunks)
  • .github/workflows/sast.yml (1 hunks)
  • pom.xml (4 hunks)
  • src/main/environment/common_ci.properties (1 hunks)
  • src/main/environment/common_dev.properties (0 hunks)
  • src/main/environment/common_example.properties (0 hunks)
  • src/main/environment/common_test.properties (0 hunks)
  • src/main/java/com/wipro/fhir/FhirApiApplication.java (0 hunks)
  • src/main/java/com/wipro/fhir/config/RedisConfig.java (0 hunks)
  • src/main/java/com/wipro/fhir/data/users/User.java (0 hunks)
  • src/main/java/com/wipro/fhir/data/v3/abhaCard/LoginMethod.java (1 hunks)
  • src/main/java/com/wipro/fhir/repo/user/UserLoginRepo.java (0 hunks)
  • src/main/java/com/wipro/fhir/service/common/CommonServiceImpl.java (4 hunks)
  • src/main/java/com/wipro/fhir/service/v3/abha/LoginAbhaV3ServiceImpl.java (1 hunks)
  • src/main/java/com/wipro/fhir/utils/CookieUtil.java (0 hunks)
  • src/main/java/com/wipro/fhir/utils/FilterConfig.java (0 hunks)
  • src/main/java/com/wipro/fhir/utils/JwtAuthenticationUtil.java (0 hunks)
  • src/main/java/com/wipro/fhir/utils/JwtUserIdValidationFilter.java (0 hunks)
  • src/main/java/com/wipro/fhir/utils/JwtUtil.java (0 hunks)
πŸ’€ Files with no reviewable changes (12)
  • src/main/environment/common_test.properties
  • src/main/environment/common_dev.properties
  • src/main/environment/common_example.properties
  • src/main/java/com/wipro/fhir/repo/user/UserLoginRepo.java
  • src/main/java/com/wipro/fhir/config/RedisConfig.java
  • src/main/java/com/wipro/fhir/FhirApiApplication.java
  • src/main/java/com/wipro/fhir/utils/FilterConfig.java
  • src/main/java/com/wipro/fhir/utils/CookieUtil.java
  • src/main/java/com/wipro/fhir/utils/JwtAuthenticationUtil.java
  • src/main/java/com/wipro/fhir/utils/JwtUserIdValidationFilter.java
  • src/main/java/com/wipro/fhir/data/users/User.java
  • src/main/java/com/wipro/fhir/utils/JwtUtil.java
🧰 Additional context used
🧠 Learnings (1)
src/main/java/com/wipro/fhir/service/v3/abha/LoginAbhaV3ServiceImpl.java (3)
Learnt from: helenKaryamsetty
PR: PSMRI/FHIR-API#52
File: src/main/java/com/wipro/fhir/service/v3/abha/LoginAbhaV3ServiceImpl.java:84-91
Timestamp: 2025-03-21T08:17:53.052Z
Learning: In the `requestOtpForAbhaLogin` and `verifyAbhaLogin` methods of `LoginAbhaV3ServiceImpl.java`, `loginId` is mandatory, but even if it is null, the process can proceed without input validation.
Learnt from: helenKaryamsetty
PR: PSMRI/FHIR-API#57
File: src/main/java/com/wipro/fhir/service/v3/abha/LoginAbhaV3ServiceImpl.java:242-251
Timestamp: 2025-03-21T08:17:59.398Z
Learning: The ABDM API response for user verification has a fixed structure where "accounts" and "users" arrays are guaranteed to contain data when present, making null/empty checks unnecessary. This is part of the API contract with ABDM.
Learnt from: helenKaryamsetty
PR: PSMRI/FHIR-API#58
File: src/main/java/com/wipro/fhir/service/v3/abha/LoginAbhaV3ServiceImpl.java:0-0
Timestamp: 2025-03-21T08:17:53.052Z
Learning: In the FHIR-API project's ABDM integration, complete responseEntity logging is preferred over just status codes for better debugging capabilities, particularly in the LoginAbhaV3ServiceImpl class when handling ABDM API responses.
πŸͺ› YAMLlint (1.35.1)
.github/workflows/sast.yml

[error] 45-45: trailing spaces

(trailing-spaces)

.github/workflows/package.yml

[error] 38-38: trailing spaces

(trailing-spaces)

πŸͺ› actionlint (1.7.4)
.github/workflows/package.yml

38-38: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

πŸ”‡ Additional comments (12)
src/main/java/com/wipro/fhir/data/v3/abhaCard/LoginMethod.java (1)

10-10: Field addition aligns with login verification enhancements.

The addition of the loginHint field complements the existing authentication data structure and enables more specific login verification logic. This field will be used in conjunction with the loginMethod to determine the appropriate authentication flow.

src/main/java/com/wipro/fhir/service/v3/abha/LoginAbhaV3ServiceImpl.java (1)

250-251: Improved token verification with dual condition check.

The condition has been refined to verify both loginMethod and loginHint are "MOBILE" before proceeding with profile login verification. This makes the authentication logic more precise and ensures the token verification process is only triggered under the appropriate circumstances.

This change aligns with the retrieved learning about ABDM API responses having a fixed structure, where carefully checking conditions before processing the response data is important for proper integration.

src/main/java/com/wipro/fhir/service/common/CommonServiceImpl.java (2)

317-378: Good refactoring of the care context handling logic

The code has been effectively simplified by using a single variable pcc throughout the method instead of multiple variables. The logic for checking and adding care contexts remains intact while being more maintainable.


324-331: Good practice: Checking for duplicate visit codes

The code properly checks for existing visit codes before adding new ones to the care context list, which prevents duplicate entries. This is a good practice for maintaining data integrity.

.github/workflows/build-on-pull-request.yml (1)

20-20: Java Distribution Update Confirmed

The JDK setup now specifies distribution: 'adopt' instead of the previous value. This change appears consistent with similar updates across your workflows. Please make sure that the adopt distribution meets all your environment requirements.

.github/workflows/sast.yml (1)

47-47: Updated Maven Build Command with Environment Variable

The build step now includes an environment variable (-DENV_VAR=test), which can help in setting specific build configurations. Please verify that this change is in line with your intended build/test procedures.

.github/workflows/package.yml (1)

29-29: Java Distribution Update Confirmed

The JDK setup now uses distribution: 'adopt', which is consistent with the changes made in your other workflow files.

pom.xml (5)

61-65: Improved Dependency Formatting for logback-ecs-encoder

The dependency declaration for logback-ecs-encoder has been reformatted with consistent indentation and line breaks. This change enhances the readability and maintainability of the POM file.


192-193: Enhanced Comment Formatting for HAPI-FHIR Structures-R4

The multi-line comment preceding the hapi-fhir-structures-r4 dependency has been adjusted to include clearer line breaks. This improves clarity on the source URL and keeps the documentation in the POM consistent.


201-202: Improved Comment Clarity for HL7 FHIR Utilities

The comment for the org.hl7.fhir.utilities dependency has been reformatted for better readability. Aligning the comment style with other dependency blocks supports overall consistency in documentation.


253-253: Minor Whitespace Cleanup in Plugin Configuration

The removal of extraneous whitespace at this location helps maintain a tidy XML structure, which improves visual clarity in the plugin configuration section.


327-337: Consistent Formatting in Resource Merging Task

The reformatting within the <echo> and <concat> tasks under the maven-antrun-plugin execution provides a clearer, more structured layout. This consistency aids in maintaining the resource merging configuration and reduces potential errors during XML editing.

@sonarqubecloud
Copy link

Copy link
Contributor

@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 575d0cb into PSMRI:develop Mar 21, 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