Skip to content

Conversation

Asp-irin
Copy link
Contributor

@Asp-irin Asp-irin commented Jan 10, 2025

📋 Description

This PR adds missing field properties to the common_example.properties file and removes redundant code to improve code practices.

Summary by CodeRabbit

  • Configuration Updates

    • Updated database connection configurations for primary and secondary databases.
    • Introduced new scheduler settings for various data synchronization processes.
    • Added configuration properties for system duration, calendar, and retry settings.
    • Expanded NHM Agent Real Time Data configuration.
    • Updated identity API URLs to reflect new port settings.
  • Scheduler Management

    • Added toggles and cron expressions for CTI data sync, Avni registration, Everwell sync, and NHM dashboard schedulers.

Copy link
Contributor

coderabbitai bot commented Jan 10, 2025

Walkthrough

The pull request introduces extensive modifications to the common_example.properties configuration file. Key updates include revised database connection settings for both primary and secondary databases, now directed to a local MySQL instance. New scheduler configurations have been added for functionalities such as CTI data synchronization and NHM dashboard data. Additionally, various new properties related to data management and scheduling have been introduced, enhancing the overall structure and functionality of the configuration.

Changes

File Change Summary
src/main/environment/common_example.properties - Updated primary and secondary database connection details (URL, username, password)
- Added new scheduler configurations for CTI data sync, Avni registration, Everwell registration, and NHM dashboard
- Introduced new properties for data management and scheduling (e.g., cz-duration, TMprescriptionTemplate, callRetryConfiguration)
- Expanded NHM Agent Real Time Data settings with new URL and cron configurations
- Updated existing API URLs

Possibly related PRs

  • Update application.properties #140: The changes in this PR involve updates to the application.properties file, specifically modifying identity API URLs, which is related to the updates made to the identity API URLs in the common_example.properties file of the main PR.
  • makeing changes for application properties #155: This PR also modifies the application.properties file, including changes to identity API URLs, which aligns with the updates made in the main PR regarding the identity API URLs in common_example.properties.

Suggested reviewers

  • ravishanigarapu

Poem

🐰 In the land of code, where changes bloom,
New connections sprout, dispelling the gloom.
Schedulers dance, with cron jobs in line,
A rabbit hops forth, with properties fine.
Configs aglow, like stars in the night! 🌟


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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: 3

🧹 Nitpick comments (1)
src/main/environment/common_example.properties (1)

93-114: Standardize configuration format and add parameter documentation

  1. Use consistent notation (either dot or hyphen) for property names
  2. Add documentation for each parameter including:
    • Valid ranges
    • Default values
    • Impact on system behavior

Example format:

# Duration in minutes for CZ operations
# Range: 30-60, Default: 40
cz-duration=40
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cc77f01 and 080b084.

📒 Files selected for processing (1)
  • src/main/environment/common_example.properties (4 hunks)
🔇 Additional comments (1)
src/main/environment/common_example.properties (1)

59-88: Improve scheduler configurations documentation and organization

  1. Consider adding detailed comments explaining the purpose and impact of each scheduler
  2. Group related schedulers together (e.g., all CTI-related schedulers)
  3. Verify the frequency of schedulers running every 1-5 minutes to ensure they don't overload the system

Comment on lines 7 to 16
##commented the below lines as it is already defined above
# spring.datasource.url=jdbc:mysql://localhost:3306/db_iemr?
encDbUserName=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k=
encDbPass=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k=
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

secondary.datasource.url=<Enter DB_REPORTING URL here>
secondary.datasource.username=<Enter your DB_REPORTING username>
secondary.datasource.password=<Enter your DB_REPORTING password>
secondary.datasource.url=<Enter DB_REPORTING URL here>
secondary.datasource.driver-class-name=com.mysql.jdbc.Driver
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider security improvements for database configurations

  1. Consider using environment variables or a secure vault for sensitive credentials
  2. Update the deprecated MySQL driver class
-secondary.datasource.driver-class-name=com.mysql.jdbc.Driver
+secondary.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
📝 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
##commented the below lines as it is already defined above
# spring.datasource.url=jdbc:mysql://localhost:3306/db_iemr?
encDbUserName=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k=
encDbPass=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k=
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
secondary.datasource.url=<Enter DB_REPORTING URL here>
secondary.datasource.username=<Enter your DB_REPORTING username>
secondary.datasource.password=<Enter your DB_REPORTING password>
secondary.datasource.url=<Enter DB_REPORTING URL here>
secondary.datasource.driver-class-name=com.mysql.jdbc.Driver
##commented the below lines as it is already defined above
# spring.datasource.url=jdbc:mysql://localhost:3306/db_iemr?
encDbUserName=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k=
encDbPass=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k=
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
secondary.datasource.url=<Enter DB_REPORTING URL here>
secondary.datasource.username=<Enter your DB_REPORTING username>
secondary.datasource.password=<Enter your DB_REPORTING password>
secondary.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

@drtechie
Copy link
Member

@Asp-Codes a lot of these variables look common across environments. Can we keep it application.properties (and remove from test.properties - from where I guess you copied from)?
cc: @ravishanigarapu

@Asp-irin
Copy link
Contributor Author

Asp-irin commented Jan 10, 2025

@Asp-Codes a lot of these variables look common across environments. Can we keep it application.properties (and remove from test.properties - from where I guess you copied from)?
cc: @ravishanigarapu

Yes that is the ideal way but currently test dev and ci all these contain variables.Only in the common they are missing so I just added in it.

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/environment/common_example.properties (1)

92-113: Document configuration parameters

New configuration parameters lack documentation about their purpose and impact:

  • cz-duration=40
  • everwellCalendarDuration=15
  • lonicPageSize=10
  • callRetryConfiguration=3
  • avniRegistrationLimit=7

Add comments explaining:

  • The purpose of each parameter
  • The impact of modifying these values
  • The units of measurement (where applicable)
  • The recommended ranges for these values
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 080b084 and 07e3b96.

📒 Files selected for processing (1)
  • src/main/environment/common_example.properties (5 hunks)
🔇 Additional comments (6)
src/main/environment/common_example.properties (6)

3-14: Security: Use secure database configuration practices

The database configuration has several security concerns:

  1. Default credentials (root/1234) should not be used
  2. Using deprecated MySQL driver
  3. Sensitive credentials should be externalized

58-87: Review scheduler configurations and resource impact

Several schedulers are configured to run frequently:

  • CTI data check runs daily at 12:10 AM
  • NHM dashboard runs daily at 12:01 AM
  • Everwell data sync runs every 5 minutes when enabled

Please verify:

  1. The resource impact of running these schedulers
  2. Why certain schedulers are enabled by default
  3. If the cron expressions align with business requirements

Consider implementing a rate limiter or circuit breaker to prevent system overload from frequent scheduler executions.


114-117: Externalize hardcoded IP address

The NHM agent URL contains a hardcoded IP address which should be externalized following the existing pattern using environment variables.


168-168: Secure the file base path configuration

The file base path configuration requires security validation and documentation.


134-136: Verify port changes for Everwell endpoints

The port for Everwell endpoints has been changed from 8080 to 8083. Please verify:

  1. If this change is coordinated with the Everwell service deployment
  2. If all related services are aware of this port change

27-31: Clarify identity service configuration

The comment "not sure abt this" suggests uncertainty about the identity configuration. Please:

  1. Verify if port 8094 is the correct port for identity services
  2. Document the purpose of each identity endpoint
  3. Remove the uncertain comment once verified
✅ Verification successful

Remove uncertainty comment and improve documentation

The identity configurations are valid and actively used in IdentityBeneficiaryServiceImpl.java:

  • identity-api-url: Regular identity service endpoint
  • identity-1097-api-url: 1097-specific identity service endpoint

Please:

  1. Remove the "not sure abt this" comment as both configurations are necessary
  2. Add descriptive comments explaining the purpose of each endpoint
  3. Consider using placeholders like other environment files: <Enter your socket address here>
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if these identity endpoints are referenced elsewhere
rg "identity-api-url|identity-1097-api-url" --type properties

Length of output: 98


Script:

#!/bin/bash
# Search for identity configurations and URLs without file type restriction
rg -l "identity-api-url|identity-1097-api-url|localhost:8094/identity-0.0.1|localhost:8094/1097identityapi"

# Search for port 8094 usage
rg "8094"

# Find all properties files
fd ".*\.properties$"

Length of output: 1001


Script:

#!/bin/bash
# Check identity configurations across all environments
for f in src/main/environment/common_{ci,dev,test,uat}.properties; do
  echo "=== $f ==="
  rg "identity.*api.*url" "$f"
done

# Check how these properties are used in the service
rg -A 5 "identity.*api.*url" src/main/java/com/iemr/common/service/beneficiary/IdentityBeneficiaryServiceImpl.java

# Check if there's documentation about these endpoints
fd "README|CONTRIBUTING|docs" -e md

Length of output: 8067

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

🧹 Nitpick comments (1)
src/main/environment/common_example.properties (1)

95-114: Document configuration parameters

New configuration parameters have been added without documentation explaining their purpose and valid values:

  • cz-duration
  • TMprescriptionTemplate
  • everwellCalendarDuration
  • lonicPageSize
  • callRetryConfiguration
  • avniRegistrationLimit

Add comments explaining:

  1. Purpose of each parameter
  2. Valid value ranges
  3. Impact on system behavior
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 07e3b96 and 5b0d9b3.

📒 Files selected for processing (1)
  • src/main/environment/common_example.properties (5 hunks)
🔇 Additional comments (4)
src/main/environment/common_example.properties (4)

115-118: Replace hardcoded IP with environment variable

The previous review already identified this issue. The hardcoded IP address should be externalized following the existing pattern using environment variables.

-nhm.agent.real.time.data.url= http://175.101.1.83/apps/utility/alive_api.php
+nhm.agent.real.time.data.url= ${NHM_AGENT_HOST}/apps/utility/alive_api.php

169-169: Add security validation for file base path

The previous review already identified this security concern. The file base path needs proper validation and security measures:

  1. Path validation within allowed boundaries
  2. Path sanitization
  3. Documentation of expected format and restrictions

61-88: Review scheduler configurations

Several scheduler configurations have been added with specific concerns:

  1. Multiple schedulers with overlapping purposes
  2. Some schedulers are enabled by default in example configuration
  3. Cron expressions might need validation

Run this script to analyze scheduler patterns across environments:

✅ Verification successful

Scheduler configurations are appropriate and well-structured

The review concerns have been analyzed and found to be unfounded:

  • Each scheduler serves a distinct purpose without functional overlap
  • The enabled schedulers (CTI data check and NHM dashboard) in the example configuration are appropriate for core functionality
  • All cron expressions are valid and scheduled at non-conflicting intervals
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check scheduler configurations across different environments
fd -e properties -x rg "start-.*-scheduler|cron-scheduler-.*"

# Validate cron expressions
fd -e properties -x rg "cron.*=.*"

Length of output: 3975


28-32: Remove redundant URL suffixes

Based on the previous discussion between drtechie and Asp-irin, the /identity-0.0.1 suffix is not needed when running services locally.

Please verify if these changes align with the local development setup:

-identity-api-url = http://localhost:8094/
+identity-api-url = http://localhost:8094
-identity-1097-api-url = http://localhost:8094/
+identity-1097-api-url = http://localhost:8094

@@ -1,20 +1,20 @@
# local env
server.port=8083
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

Security: Avoid committing sensitive credentials

The database configuration exposes sensitive credentials:

  1. Plain text passwords
  2. Root user access
  3. Direct database URLs

Consider these security improvements:

  1. Use environment variables or secure vault for credentials
  2. Create dedicated database users with limited privileges
  3. Add placeholders instead of actual values in example properties
-spring.datasource.username=root
-spring.datasource.password=1234
+spring.datasource.username=${DB_USER}
+spring.datasource.password=${DB_PASSWORD}

Also applies to: 4-6, 13-15

Comment on lines 135 to 137
everwell1097userAuthenticate = http://10.208.122.38:8083/user/userAuthenticate
everwelluserAuthenticate = https://beta-hub.everwell.org/token
everwellRegisterBenficiary = http://10.208.122.38:8080/commonapi-v1.0/beneficiary/create
everwellRegisterBenficiary = http://10.208.122.38:8083/beneficiary/create
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Standardize API endpoint configuration

The API endpoints contain inconsistent port usage and hardcoded IPs:

  1. Some endpoints use HTTPS while others use HTTP
  2. Hardcoded IP (10.208.122.38) should be configurable
  3. Port 8083 is hardcoded

Standardize the configuration:

-everwell1097userAuthenticate =  http://10.208.122.38:8083/user/userAuthenticate
+everwell1097userAuthenticate =  ${EVERWELL_API_BASE_URL}/user/userAuthenticate
-everwellRegisterBenficiary = http://10.208.122.38:8083/beneficiary/create
+everwellRegisterBenficiary = ${EVERWELL_API_BASE_URL}/beneficiary/create
📝 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
everwell1097userAuthenticate = http://10.208.122.38:8083/user/userAuthenticate
everwelluserAuthenticate = https://beta-hub.everwell.org/token
everwellRegisterBenficiary = http://10.208.122.38:8080/commonapi-v1.0/beneficiary/create
everwellRegisterBenficiary = http://10.208.122.38:8083/beneficiary/create
everwell1097userAuthenticate = ${EVERWELL_API_BASE_URL}/user/userAuthenticate
everwelluserAuthenticate = https://beta-hub.everwell.org/token
everwellRegisterBenficiary = ${EVERWELL_API_BASE_URL}/beneficiary/create

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 (2)
src/main/environment/common_example.properties (2)

95-114: Document configuration parameters

Please add comments explaining:

  1. The purpose and valid ranges for cz-duration, everwellCalendarDuration
  2. The impact of callRetryConfiguration and avniRegistrationLimit
  3. The significance of lonicPageSize

135-137: Standardize API endpoint configuration

Consider using environment variables for the base URL to make it configurable across environments:

-everwell1097userAuthenticate =  http://localhost:8083/user/userAuthenticate
-everwellRegisterBenficiary = http://localhost:8083/beneficiary/create
+everwell1097userAuthenticate =  ${COMMON_API_BASE_URL}/user/userAuthenticate
+everwellRegisterBenficiary = ${COMMON_API_BASE_URL}/beneficiary/create
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5b0d9b3 and 9435a89.

📒 Files selected for processing (1)
  • src/main/environment/common_example.properties (5 hunks)
🔇 Additional comments (4)
src/main/environment/common_example.properties (4)

2-15: Security: Avoid committing sensitive credentials

The database configuration exposes sensitive credentials in plain text. This is a security risk that was previously identified.


28-32: LGTM! URL simplification implemented

The identity API URLs have been simplified as discussed in the PR comments.


115-118: Hardcoded IP should be externalized

The hardcoded IP in the NHM agent URL should be externalized following existing patterns.


169-169: Add security validation for file base path

The file base path configuration requires security validation to prevent directory traversal attacks.

spring.datasource.password=1234

spring.datasource.url=jdbc:mysql://localhost:3306/db_iemr?autoReconnect=true&useSSL=false
# spring.datasource.url=jdbc:mysql://localhost:3306/db_iemr?autoReconnect=true&useSSL=false
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove this comment?

Copy link
Member

Choose a reason for hiding this comment

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

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

♻️ Duplicate comments (4)
src/main/environment/common_example.properties (4)

2-2: ⚠️ Potential issue

Security: Avoid committing sensitive credentials

The database configuration exposes sensitive credentials:

  1. Plain text passwords
  2. Root user access
  3. Direct database URLs

Consider these security improvements:

  1. Use environment variables or secure vault for credentials
  2. Create dedicated database users with limited privileges
  3. Add placeholders instead of actual values in example properties
-server.port=8083
+server.port=${SERVER_PORT}

-spring.datasource.url=jdbc:mysql://localhost:3306/db_iemr
-spring.datasource.username=root
-spring.datasource.password=1234
+spring.datasource.url=${DB_URL}
+spring.datasource.username=${DB_USER}
+spring.datasource.password=${DB_PASSWORD}

-secondary.datasource.username=root
-secondary.datasource.password=1234
-secondary.datasource.url=jdbc:mysql://localhost:3306/db_reporting
+secondary.datasource.url=${SECONDARY_DB_URL}
+secondary.datasource.username=${SECONDARY_DB_USER}
+secondary.datasource.password=${SECONDARY_DB_PASSWORD}

Also applies to: 4-6, 13-15


61-88: 🛠️ Refactor suggestion

Optimize scheduler configurations to prevent resource contention

The scheduler configurations need optimization:

  1. Multiple schedulers running at high frequency could impact system performance
  2. Consider staggering the schedulers to prevent overlap
  3. Document the rationale for chosen intervals

Specific concerns:

  • cron-scheduler-everwelldatasync runs every 5 minutes
  • cron-scheduler-nhmdashboard runs every hour at minute 1
  • cron-avni-registration runs every minute

Consider:

  1. Increasing intervals for high-frequency jobs
  2. Adding appropriate start time offsets to prevent concurrent execution
  3. Adding comments explaining the business need for each frequency

119-122: ⚠️ Potential issue

Hardcoded IP should be externalized

Replace hardcoded IP with configurable hostname following existing patterns.

-nhm.agent.real.time.data.url= http://175.101.1.83/apps/utility/alive_api.php
+nhm.agent.real.time.data.url=${NHM_AGENT_HOST}/apps/utility/alive_api.php

173-173: ⚠️ Potential issue

Add security validation for file base path

The file base path needs security validation:

  1. Validate path is within allowed boundaries
  2. Implement path sanitization
  3. Document format and restrictions
-fileBasePath =<Enter your required basepath here>/Doc
+# Base path for document storage
+# Must be within /var/lib/amrit/docs
+fileBasePath=${AMRIT_DOCS_PATH}/Doc
🧹 Nitpick comments (2)
src/main/environment/common_example.properties (2)

28-32: Remove trailing slashes from API URLs

Trailing slashes in API base URLs can cause issues with path concatenation. Also, consider using environment variables for the host and port.

-identity-api-url = http://localhost:8094/
-identity-1097-api-url = http://localhost:8094/ 
-genben-api=http://localhost:8092/
+identity-api-url = ${IDENTITY_API_HOST}:${IDENTITY_API_PORT}
+identity-1097-api-url = ${IDENTITY_1097_API_HOST}:${IDENTITY_1097_API_PORT}
+genben-api=${GENBEN_API_HOST}:${GENBEN_API_PORT}

99-117: Document configuration values

The newly added configuration values lack documentation explaining their purpose and acceptable ranges.

Add comments explaining:

  1. Purpose of each configuration
  2. Valid value ranges
  3. Impact of modifications

Example:

-cz-duration=40
+# Duration in minutes for the comfort zone window
+# Valid range: 30-60 minutes
+cz-duration=40

-everwellCalendarDuration=15
+# Calendar duration in days for Everwell appointments
+# Valid range: 7-30 days
+everwellCalendarDuration=15
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9435a89 and c6c0bc1.

📒 Files selected for processing (1)
  • src/main/environment/common_example.properties (5 hunks)

everwellGetPatientAdherenceUrl = https://beta-hub.everwell.org/Api/Patients/CurrentMonthMissedAdherence?Page=
everwellEditSecondaryPhoneNo = https://beta-hub.everwell.org/Api/Patients/EditPhoneNumber
everwell1097userAuthenticate = http://10.208.122.38:8080/commonapi-v1.0/user/userAuthenticate
everwell1097userAuthenticate = http://localhost:8083/user/userAuthenticate
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Standardize API endpoint configuration

The Everwell API endpoints should use environment variables for consistency with other configurations.

-everwell1097userAuthenticate =  http://localhost:8083/user/userAuthenticate
-everwellRegisterBenficiary = http://localhost:8083/beneficiary/create
+everwell1097userAuthenticate = ${EVERWELL_API_BASE_URL}/user/userAuthenticate
+everwellRegisterBenficiary = ${EVERWELL_API_BASE_URL}/beneficiary/create

Also applies to: 141-141

Copy link

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

♻️ Duplicate comments (4)
src/main/environment/common_example.properties (4)

2-2: ⚠️ Potential issue

Security: Avoid committing sensitive credentials

The database configuration exposes sensitive credentials in plain text. This is a security risk.

Consider using environment variables or a secure vault for credentials:

-server.port=8083
+server.port=${SERVER_PORT}

-spring.datasource.url=jdbc:mysql://localhost:3306/db_iemr
-spring.datasource.username=root
-spring.datasource.password=1234
+spring.datasource.url=${DB_URL}
+spring.datasource.username=${DB_USER}
+spring.datasource.password=${DB_PASSWORD}

-secondary.datasource.username=root
-secondary.datasource.password=1234
-secondary.datasource.url=jdbc:mysql://localhost:3306/db_reporting
+secondary.datasource.username=${SECONDARY_DB_USER}
+secondary.datasource.password=${SECONDARY_DB_PASSWORD}
+secondary.datasource.url=${SECONDARY_DB_URL}

Also applies to: 4-6, 12-14


60-87: 🛠️ Refactor suggestion

Optimize scheduler configurations

The scheduler configurations need optimization to prevent resource contention.

  1. High-frequency schedulers might impact system performance:
    • cron-scheduler-everwelldatasync runs every 5 minutes
    • cron-scheduler-nhmdashboard runs every hour at minute 1
  2. Consider staggering the schedulers to prevent overlap
  3. Use environment variables for better configurability:
-start-ctidatasync-scheduler=false
-cron-scheduler-ctidatasync=0 0 2 */2 * ?
+start-ctidatasync-scheduler=${CTI_SYNC_ENABLED:false}
+cron-scheduler-ctidatasync=${CTI_SYNC_CRON:0 0 2 */2 * ?}

-start-everwelldatasync-scheduler=false
-cron-scheduler-everwelldatasync=0 0/5 * * * ? *
+start-everwelldatasync-scheduler=${EVERWELL_SYNC_ENABLED:false}
+cron-scheduler-everwelldatasync=${EVERWELL_SYNC_CRON:0 0/30 * * * ? *}

118-121: 🛠️ Refactor suggestion

Replace hardcoded IP with environment variable

The NHM agent URL contains a hardcoded IP address.

Apply this diff to externalize the configuration:

-nhm.agent.real.time.data.url= http://175.101.1.83/apps/utility/alive_api.php
+nhm.agent.real.time.data.url=${NHM_AGENT_URL}/apps/utility/alive_api.php

138-141: 🛠️ Refactor suggestion

Standardize API endpoint configuration

The Everwell API endpoints should use environment variables for consistency.

Apply this diff:

-everwell1097userAuthenticate =  http://localhost:8083/user/userAuthenticate
-everwellRegisterBenficiary = http://localhost:8083/beneficiary/create
+everwell1097userAuthenticate = ${EVERWELL_API_BASE_URL:http://localhost:8083}/user/userAuthenticate
+everwellRegisterBenficiary = ${EVERWELL_API_BASE_URL:http://localhost:8083}/beneficiary/create
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c6c0bc1 and 4f42fba.

📒 Files selected for processing (1)
  • src/main/environment/common_example.properties (5 hunks)
🔇 Additional comments (1)
src/main/environment/common_example.properties (1)

172-172: Add security validation for file base path

The file base path configuration needs security validation.

Run the following script to check for path validation in the codebase:

#!/bin/bash
# Check for file path validation
rg -B 2 -A 2 "fileBasePath"

# Check for common directory validation patterns
rg -B 2 -A 2 "mkdirs|exists|isDirectory|createDirectories"

Comment on lines +27 to +31
identity-api-url = http://localhost:8094/
#Verify whether 1097 and identity are same?
identity-1097-api-url = http://localhost:8095/
##Generate Benificiary Config
genben-api=http://localhost:8092/
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Remove unnecessary path segments from API URLs

Based on the PR comments discussion between drtechie and Asp-irin, the /identity-0.0.1 path segment should be removed when running locally.

Apply this diff to update the URLs:

-identity-api-url = http://localhost:8094/
-identity-1097-api-url = http://localhost:8095/ 
-genben-api=http://localhost:8092/
+identity-api-url = ${IDENTITY_API_URL:http://localhost:8094}
+identity-1097-api-url = ${IDENTITY_1097_API_URL:http://localhost:8095}
+genben-api=${GENBEN_API_URL:http://localhost:8092}
📝 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
identity-api-url = http://localhost:8094/
#Verify whether 1097 and identity are same?
identity-1097-api-url = http://localhost:8095/
##Generate Benificiary Config
genben-api=http://localhost:8092/
identity-api-url = ${IDENTITY_API_URL:http://localhost:8094}
#Verify whether 1097 and identity are same?
identity-1097-api-url = ${IDENTITY_1097_API_URL:http://localhost:8095}
##Generate Benificiary Config
genben-api=${GENBEN_API_URL:http://localhost:8092}

@drtechie drtechie merged commit 94c0da5 into PSMRI:develop Feb 10, 2025
2 checks passed
@coderabbitai coderabbitai bot mentioned this pull request May 27, 2025
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