Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HCMPRE-470 validation changes for assumptions #902

Merged
merged 8 commits into from
Oct 7, 2024

Conversation

Priyanka-eGov
Copy link
Collaborator

@Priyanka-eGov Priyanka-eGov commented Sep 25, 2024

Ticket Link - https://digit-discuss.atlassian.net/browse/HCMPRE-470

Summary by CodeRabbit

  • New Features

    • Simplified filtering for assumptions with a new constant.
    • Added constants for logical operations and JSON fields related to campaign and distribution processes.
    • Introduced a method for dynamic JSON path creation based on campaign details.
  • Improvements

    • Enhanced validation methods for assumptions and vehicle IDs to streamline data extraction processes.
  • Refactor

    • Renamed and modified extraction methods for greater flexibility in handling additional details.

@Priyanka-eGov Priyanka-eGov changed the title HCMPRE-470 HCMPRE-470 validation changes for assumptions Sep 25, 2024
Copy link
Contributor

coderabbitai bot commented Sep 25, 2024

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The pull request introduces several modifications to the ServiceConstants, PlanConfigurationValidator, and CommonUtil classes. Key changes include the simplification of the FILTER_ALL_ASSUMPTIONS constant and the addition of various new constants related to campaign and distribution processes. The validation methods have been updated for better JSON path handling, and the utility method for extracting vehicle IDs has been generalized to extract any specified field from additional details.

Changes

File Change Summary
health-services/plan-service/src/main/java/digit/config/ServiceConstants.java - Updated FILTER_ALL_ASSUMPTIONS constant.
- Added new constants for logical operators and JSON fields related to campaign and distribution processes.
health-services/plan-service/src/main/java/digit/service/validator/PlanConfigurationValidator.java - Modified validateAssumptionKeyAgainstMDMS to dynamically generate JSON paths.
- Updated validateVehicleIdsFromAdditionalDetailsAgainstMDMS for direct extraction of vehicle IDs.
health-services/plan-service/src/main/java/digit/util/CommonUtil.java - Renamed and modified extractVehicleIdsFromAdditionalDetails to extractFieldsFromAdditionalDetails for general field extraction.
- Introduced createJsonPathForAssumption for constructing JSONPath expressions.

Possibly related PRs

🐰 In the code, constants abound,
New paths and fields are now found!
With simpler filters and methods anew,
Our logic shines bright, like morning dew.
Hooray for the changes, let’s hop with glee,
For a cleaner codebase, just wait and see! 🥕


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.

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.

@Priyanka-eGov
Copy link
Collaborator Author

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Sep 25, 2024

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between 096c580 and 985fd63.

📒 Files selected for processing (3)
  • health-services/plan-service/src/main/java/digit/config/ServiceConstants.java (1 hunks)
  • health-services/plan-service/src/main/java/digit/service/validator/PlanConfigurationValidator.java (2 hunks)
  • health-services/plan-service/src/main/java/digit/util/CommonUtil.java (1 hunks)
🔇 Additional comments not posted (1)
health-services/plan-service/src/main/java/digit/config/ServiceConstants.java (1)

177-177: Verify the impact of the modified FILTER_ALL_ASSUMPTIONS constant.

The FILTER_ALL_ASSUMPTIONS constant has been updated from "[].assumptionCategories[].assumptions[]" to ".assumptionCategories[].assumptions[]". This change removes the initial "[]" from the filter.

Please ensure that this modification doesn't unintentionally narrow down the scope of the filter in your application. Verify that all necessary assumptions are still being accessed correctly with this updated filter.

To check the usage and impact of this constant, you can run the following command:

✅ Verification successful

Verified: The modification to FILTER_ALL_ASSUMPTIONS does not negatively impact the codebase. The updated JSON path correctly accesses the intended assumptions without narrowing the scope. No issues were found based on the current usage.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usages of FILTER_ALL_ASSUMPTIONS
rg "FILTER_ALL_ASSUMPTIONS" --type java

Length of output: 425


Script:

#!/bin/bash
# Extract surrounding lines where FILTER_ALL_ASSUMPTIONS is used in CommonUtil.java
rg "FILTER_ALL_ASSUMPTIONS" -C 3 health-services/plan-service/src/main/java/digit/util/CommonUtil.java --type java

Length of output: 486

@shashwat-egov shashwat-egov merged commit f62dfae into microplanning-dev Oct 7, 2024
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.

2 participants