Skip to content

Unused API and properties removed#53

Merged
sac2kadam merged 1 commit into
PSMRI:developfrom
ravishanigarapu:develop
Nov 27, 2024
Merged

Unused API and properties removed#53
sac2kadam merged 1 commit into
PSMRI:developfrom
ravishanigarapu:develop

Conversation

@ravishanigarapu

@ravishanigarapu ravishanigarapu commented Nov 27, 2024

Copy link
Copy Markdown
Contributor

📋 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

    • Introduced a new SMS template for prescriptions.
  • Bug Fixes

    • Removed obsolete configuration properties related to service identifiers and authentication keys across multiple environments.
  • Refactor

    • Eliminated methods related to retrieving master data based on state ID, streamlining API functionality.

These changes enhance configuration management and improve the overall user experience by simplifying service interactions.

@coderabbitai

coderabbitai Bot commented Nov 27, 2024

Copy link
Copy Markdown
Contributor

Walkthrough

The changes in this pull request involve significant modifications to configuration properties across multiple environment files (common_ci.properties, common_dev.properties, common_test.properties, and common_uat.properties). Several properties related to service and provider identifiers have been removed, while a new property for prescription SMS templates has been added in certain files. Additionally, the patientAppMasterData method has been removed from the PatientAppCommonMasterController, along with the corresponding getMaster method from both the CommonPatientAppMasterService interface and its implementation.

Changes

File Change Summary
src/main/environment/common_ci.properties Removed properties: servicePointID, parkingPlaceID, providerServiceMapID, vanID, serviceID, providerID, appId, authKey, authSecret, scheduling-slotsize. Updated prescription property to active.
src/main/environment/common_dev.properties Added property: prescription=TMPrescription SMS. Removed properties: servicePointID, parkingPlaceID, providerServiceMapID, vanID, serviceID, providerID, appId, authKey, authSecret.
src/main/environment/common_test.properties Removed properties: servicePointID, parkingPlaceID, providerServiceMapID, vanID, serviceID, providerID, appId, authKey, authSecret, scheduling-slotsize, prescription.
src/main/environment/common_uat.properties Added property: prescription=TMPrescription SMS. Removed properties: servicePointID, parkingPlaceID, providerServiceMapID, vanID, serviceID, providerID, appId, authKey, authSecret.
src/main/java/com/iemr/tm/controller/patientApp/master/PatientAppCommonMasterController.java Removed method: public String patientAppMasterData(@PathVariable("stateID") Integer stateID).
src/main/java/com/iemr/tm/service/patientApp/master/CommonPatientAppMasterService.java Removed method: public String getMaster(Integer stateID).
src/main/java/com/iemr/tm/service/patientApp/master/CommonPatientAppMasterServiceImpl.java Removed method: public String getMaster(Integer stateID).

Possibly related PRs

  • CI CD Test #51: This PR modifies the PatientAppCommonMasterController class, which is unrelated to the changes in the common_ci.properties file.
  • Update common_ci.properties  #52: This PR updates the common_ci.properties file by adding several configuration properties, which is directly related to the changes made in the main PR that removed similar properties.

Suggested reviewers

  • drtechie
  • devikasuresh20

Poem

🐇 In the fields where rabbits play,
Configuration changes come our way.
Properties gone, new ones arise,
A simpler path beneath the skies.
With every hop, we celebrate,
A cleaner code, oh what a fate! 🌼


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 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.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (4)
src/main/environment/common_ci.properties (1)

Based on the examination of the codebase, I can now provide a final response:

Properties are actively used and should not be removed

The removed properties (servicePointID, parkingPlaceID, providerServiceMapID, vanID, serviceID, providerID, appId, authKey, authSecret, scheduling-slotsize) are actively used in CommonPatientAppMasterServiceImpl.java as Spring @Value injected properties. These properties are essential for:

  • Service point and parking place identification
  • Provider and service mapping
  • Van identification for mobile units
  • Authentication and authorization (appId, authKey, authSecret)
  • Scheduling configuration

Removing these properties would break the functionality in:

  • Patient app master services
  • Beneficiary flow management
  • Teleconsultation scheduling
  • Authentication flows
🔗 Analysis chain

Line range hint 1-67: Verify the impact of removed configuration properties.

Several configuration properties have been removed according to the AI summary. Let's verify that these properties are truly unused and their removal won't impact the system.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for usage of removed properties in the codebase
# This will help ensure they are not referenced anywhere

echo "Checking for references to removed properties..."

# Search for property references in Java files
for prop in "servicePointID" "parkingPlaceID" "providerServiceMapID" "vanID" "serviceID" "providerID" "appId" "authKey" "authSecret" "scheduling-slotsize"; do
  echo "Searching for: $prop"
  
  # Search in Java files for property references
  rg -t java "getProperty.*${prop}|@Value.*${prop}|environment.*${prop}" 
  
  # Search in XML/YAML config files
  rg -t xml -t yaml "\${.*${prop}.*}|\$\{.*${prop}.*\}"
done

# Search for environment variable references
echo "Checking for environment variable references..."
rg "env\.SERVICE_POINT_ID|env\.PARKING_PLACE_ID|env\.PROVIDER_SERVICE_MAP_ID|env\.VAN_ID|env\.SERVICE_ID|env\.PROVIDER_ID|env\.APP_ID|env\.AUTH_KEY|env\.AUTH_SECRET"

Length of output: 6498


Script:

#!/bin/bash
# Let's examine the CommonPatientAppMasterServiceImpl.java file to understand how these properties are used
echo "Examining CommonPatientAppMasterServiceImpl.java..."
rg -A 10 "@Value.*(\${servicePointID}|\${parkingPlaceID}|\${providerServiceMapID}|\${vanID}|\${serviceID}|\${providerID}|\${appId}|\${authKey}|\${authSecret}|\${scheduling-slotsize})" src/main/java/com/iemr/tm/service/patientApp/master/CommonPatientAppMasterServiceImpl.java

# Let's also check for any application.properties or similar config files that might define these properties
echo -e "\nSearching for property definitions in configuration files..."
fd -e properties -e yml -e yaml | xargs rg "servicePointID=|parkingPlaceID=|providerServiceMapID=|vanID=|serviceID=|providerID=|appId=|authKey=|authSecret=|scheduling-slotsize="

Length of output: 952


Script:

#!/bin/bash
# Let's try a different approach to examine the file content and property usage
echo "Examining CommonPatientAppMasterServiceImpl.java..."
cat src/main/java/com/iemr/tm/service/patientApp/master/CommonPatientAppMasterServiceImpl.java

# Also check for any references to these properties in method calls or field usage
echo -e "\nChecking property usage in the codebase..."
rg -l "servicePointID|parkingPlaceID|providerServiceMapID|vanID|serviceID|providerID|appId|authKey|authSecret|scheduling-slotsize" --type java

# Check if these properties are defined in any other configuration files
echo -e "\nChecking configuration files..."
find . -type f -name "*.properties" -o -name "*.yml" -o -name "*.yaml" | xargs cat

Length of output: 49315

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

Line range hint 1-67: Consider enhancing configuration security practices

While using placeholders for sensitive data is good, consider these security enhancements:

  1. Use environment variables for sensitive values instead of properties
  2. Consider using a secure configuration management service
  3. Implement encryption for sensitive configuration values
  4. Add validation for required properties on application startup

This will help improve the security and reliability of the configuration management.

src/main/environment/common_uat.properties (2)

Line range hint 1-70: Security: Consider externalization of sensitive configuration

The file contains several sensitive configuration placeholders:

  • Database credentials
  • API endpoints
  • API keys

Consider:

  1. Moving sensitive values to a secure vault or environment variables
  2. Using a configuration management service
  3. Adding validation for required properties

Properties are still being referenced in the codebase and need to be maintained

The removed properties (servicePointID, parkingPlaceID, providerServiceMapID, etc.) are actively used in the codebase, particularly in:

  • CommonPatientAppMasterServiceImpl.java which directly injects these properties using @Value annotations
  • Multiple data model and repository classes that reference these IDs
  • Core service implementations that depend on these properties for functionality

The properties should not be removed from the configuration files as they are required for the application to function correctly.

🔗 Analysis chain

Line range hint 1-70: Verify the impact of removed properties

Several properties have been removed according to the summary (servicePointID, parkingPlaceID, providerServiceMapID, etc.). Let's verify these aren't referenced elsewhere in the codebase.


Let me try another search strategy to verify the impact of removed properties.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for references to removed properties to ensure they're not used elsewhere

echo "Searching for references to removed properties..."
rg -l "servicePointID|parkingPlaceID|providerServiceMapID|vanID|serviceID|providerID|appId|authKey|authSecret" \
  --type java \
  --type xml \
  --type properties

# Also check for @Value annotations referencing these properties
ast-grep --pattern '$_(@Value("${$_}"))'

Length of output: 340


Script:

#!/bin/bash
# Search for references to removed properties in all files
rg -l "servicePointID|parkingPlaceID|providerServiceMapID|vanID|serviceID|providerID|appId|authKey|authSecret"

# Search specifically for property references in Java files
rg "@Value.*\b(servicePointID|parkingPlaceID|providerServiceMapID|vanID|serviceID|providerID|appId|authKey|authSecret)\b" --type java -A 2

# Find all .properties files to check for these properties
fd ".*\.properties$"

Length of output: 17479

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between ea01ad8 and 863309e.

📒 Files selected for processing (7)
  • src/main/environment/common_ci.properties (2 hunks)
  • src/main/environment/common_dev.properties (1 hunks)
  • src/main/environment/common_test.properties (0 hunks)
  • src/main/environment/common_uat.properties (1 hunks)
  • src/main/java/com/iemr/tm/controller/patientApp/master/PatientAppCommonMasterController.java (0 hunks)
  • src/main/java/com/iemr/tm/service/patientApp/master/CommonPatientAppMasterService.java (0 hunks)
  • src/main/java/com/iemr/tm/service/patientApp/master/CommonPatientAppMasterServiceImpl.java (0 hunks)
💤 Files with no reviewable changes (4)
  • src/main/environment/common_test.properties
  • src/main/java/com/iemr/tm/controller/patientApp/master/PatientAppCommonMasterController.java
  • src/main/java/com/iemr/tm/service/patientApp/master/CommonPatientAppMasterService.java
  • src/main/java/com/iemr/tm/service/patientApp/master/CommonPatientAppMasterServiceImpl.java
🔇 Additional comments (4)
src/main/environment/common_ci.properties (1)

57-57: LGTM! New SMS template property follows existing conventions.

The new prescription SMS template property is properly placed within the SMS templates section and follows the established naming pattern.

src/main/environment/common_dev.properties (2)

66-66: LGTM: New prescription SMS template property follows existing pattern

The new prescription SMS template property follows the same naming convention as other SMS templates in the file (schedule, cancel, reSchedule).


Line range hint 1-67: Verify the impact of removed properties

Several properties have been removed according to the AI summary (servicePointID, parkingPlaceID, providerServiceMapID, vanID, serviceID, providerID, appId, authKey, authSecret). Let's verify these aren't being used elsewhere in the codebase.

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

68-68: LGTM: Prescription SMS template property added consistently

The new prescription property follows the same pattern as other SMS template properties in the file (schedule, cancel, reSchedule).

@sac2kadam sac2kadam left a comment

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.

looks okay

@sac2kadam sac2kadam merged commit e162f78 into PSMRI:develop Nov 27, 2024
@coderabbitai coderabbitai Bot mentioned this pull request Nov 28, 2024
10 tasks
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