-
Notifications
You must be signed in to change notification settings - Fork 16
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
HLM-5701-create-microplan changes #741
HLM-5701-create-microplan changes #741
Conversation
WalkthroughThe recent updates enhance the health-services resource-estimation-service by introducing a new endpoint for plan creation and refactoring several classes to use Changes
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
@coderabbitai review |
Actions PerformedReview triggered.
|
There was a problem hiding this 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
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (10)
- health-services/resource-estimation-service/src/main/java/org/egov/processor/config/Configuration.java (1 hunks)
- health-services/resource-estimation-service/src/main/java/org/egov/processor/config/ServiceConstants.java (1 hunks)
- health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ExcelParser.java (8 hunks)
- health-services/resource-estimation-service/src/main/java/org/egov/processor/service/FileParser.java (1 hunks)
- health-services/resource-estimation-service/src/main/java/org/egov/processor/service/GeoJsonParser.java (3 hunks)
- health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ResourceEstimationService.java (1 hunks)
- health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ShapeFileParser.java (3 hunks)
- health-services/resource-estimation-service/src/main/java/org/egov/processor/util/CalculationUtil.java (2 hunks)
- health-services/resource-estimation-service/src/main/java/org/egov/processor/util/PlanUtil.java (1 hunks)
- health-services/resource-estimation-service/src/main/resources/application.properties (1 hunks)
Files skipped from review due to trivial changes (1)
- health-services/resource-estimation-service/src/main/resources/application.properties
Additional comments not posted (12)
health-services/resource-estimation-service/src/main/java/org/egov/processor/service/FileParser.java (1)
11-11
: Ensure all implementations ofFileParser
interface are updated to handlePlanConfigurationRequest
.Verification successful
All implementations of
FileParser
interface are updatedThe
parseFileData
method in all implementations of theFileParser
interface (ShapeFileParser
,GeoJsonParser
, andExcelParser
) has been updated to handlePlanConfigurationRequest
.
ShapeFileParser
:public Object parseFileData(PlanConfigurationRequest planConfigurationRequest, String fileStoreId)
GeoJsonParser
:public Object parseFileData(PlanConfigurationRequest planConfigurationRequest, String fileStoreId)
ExcelParser
:public Object parseFileData(PlanConfigurationRequest planConfigurationRequest, String fileStoreId)
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all implementations of `FileParser` interface handle the new method signature. # Test: Search for implementations of `FileParser`. Expect: All implementations should use the new method signature. rg --type java $'implements FileParser'Length of output: 505
Script:
#!/bin/bash # Description: Verify that the `parseFileData` method in each implementation of `FileParser` matches the new method signature. # Search for the `parseFileData` method in ShapeFileParser rg --type java 'parseFileData' health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ShapeFileParser.java # Search for the `parseFileData` method in GeoJsonParser rg --type java 'parseFileData' health-services/resource-estimation-service/src/main/java/org/egov/processor/service/GeoJsonParser.java # Search for the `parseFileData` method in ExcelParser rg --type java 'parseFileData' health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ExcelParser.javaLength of output: 719
health-services/resource-estimation-service/src/main/java/org/egov/processor/config/ServiceConstants.java (1)
39-40
: Ensure new constantsBOUNDARY_CODE
andERROR_WHILE_FETCHING_FROM_PLAN_SERVICE_FOR_LOCALITY
are utilized appropriately in the codebase.Verification successful
Constants Utilization Verified
The new constants
BOUNDARY_CODE
andERROR_WHILE_FETCHING_FROM_PLAN_SERVICE_FOR_LOCALITY
are appropriately utilized in the codebase.
ERROR_WHILE_FETCHING_FROM_PLAN_SERVICE_FOR_LOCALITY
is used in a logging statement inPlanUtil.java
.BOUNDARY_CODE
is used in a method call inPlanUtil.java
.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of new constants in the codebase. # Test: Search for the usage of `BOUNDARY_CODE` and `ERROR_WHILE_FETCHING_FROM_PLAN_SERVICE_FOR_LOCALITY`. Expect: They should be used in relevant logic. rg --type java $'BOUNDARY_CODE|ERROR_WHILE_FETCHING_FROM_PLAN_SERVICE_FOR_LOCALITY'Length of output: 2189
health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ResourceEstimationService.java (1)
55-55
: Ensure the new method signature ofestimateResources
is correctly used in the codebase.Verification successful
Verification of
estimateResources
Method Signature UsageThe method
estimateResources
is correctly used withPlanConfigurationRequest
in the codebase.
- Method Definition:
ResourceEstimationService.java
definesestimateResources
withPlanConfigurationRequest
.- Method Call:
PlanConsumer.java
callsestimateResources
with aPlanConfigurationRequest
object.Both instances confirm the correct usage of the new method signature.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the new method signature of `estimateResources`. # Test: Search for the usage of `estimateResources`. Expect: It should be used with `PlanConfigurationRequest`. rg --type java $'estimateResources'Length of output: 425
Script:
#!/bin/bash # Description: Verify the method call of `estimateResources` in `PlanConsumer.java`. # Extract the relevant lines around the method call to ensure it uses `PlanConfigurationRequest`. rg -A 5 -B 5 'resourceEstimationService.estimateResources' health-services/resource-estimation-service/src/main/java/org/egov/processor/kafka/PlanConsumer.javaLength of output: 889
health-services/resource-estimation-service/src/main/java/org/egov/processor/service/GeoJsonParser.java (1)
55-56
: Ensure the new method signature ofparseFileData
inGeoJsonParser
is correctly used in the codebase.Verification successful
The new method signature of
parseFileData
inGeoJsonParser
is correctly used in the codebase.
ResourceEstimationService.java
usesparseFileData
withPlanConfigurationRequest
andString
forfileStoreId
.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the new method signature of `parseFileData` in `GeoJsonParser`. # Test: Search for the usage of `parseFileData`. Expect: It should be used with `PlanConfigurationRequest`. rg --type java $'parseFileData'Length of output: 1259
Script:
#!/bin/bash # Extract the relevant lines from ResourceEstimationService.java to verify the method usage. rg --type java -A 5 -B 5 'parser.parseFileData' health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ResourceEstimationService.javaLength of output: 631
health-services/resource-estimation-service/src/main/java/org/egov/processor/util/PlanUtil.java (1)
43-54
: Ensure new methodscreate
,buildPlanRequest
, andgetBoundaryCodeValue
inPlanUtil
are utilized appropriately in the codebase.Verification successful
Verification of New Methods in
PlanUtil
The new methods
create
,buildPlanRequest
, andgetBoundaryCodeValue
inPlanUtil
are utilized appropriately in the codebase:
create
Method:
- Used in
CalculationUtil
andExcelParser
.
buildPlanRequest
Method:
- Utilized within the
create
method inPlanUtil
.
getBoundaryCodeValue
Method:
- Utilized within the
buildPlanRequest
method inPlanUtil
.These usages confirm that the new methods are integrated into the relevant logic within the codebase.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of new methods in `PlanUtil`. # Test: Search for the usage of `create`, `buildPlanRequest`, and `getBoundaryCodeValue`. Expect: They should be used in relevant logic. rg --type java $'create|buildPlanRequest|getBoundaryCodeValue'Length of output: 267292
health-services/resource-estimation-service/src/main/java/org/egov/processor/util/CalculationUtil.java (1)
73-73
: Ensure the new method signature ofcalculateResources
inCalculationUtil
is correctly used in the codebase.Verification successful
The verification confirms that the new method signature of
calculateResources
inCalculationUtil
is correctly used in the codebase.
- Both
GeoJsonParser.java
andShapeFileParser.java
callcalculateResources
with the parametersjsonNode
,planConfigurationRequest
,resultMap
,mappedValues
, andassumptionValueMap
, which aligns with the new method signature.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the new method signature of `calculateResources` in `CalculationUtil`. # Test: Search for the usage of `calculateResources`. Expect: It should be used with `PlanConfigurationRequest`. rg --type java $'calculateResources'Length of output: 738
Script:
#!/bin/bash # Extract the lines containing the method calls to `calculateResources` in `GeoJsonParser.java` and `ShapeFileParser.java` to verify the parameters. # Extract method call in GeoJsonParser.java rg --type java --context 5 'calculateResources' health-services/resource-estimation-service/src/main/java/org/egov/processor/service/GeoJsonParser.java # Extract method call in ShapeFileParser.java rg --type java --context 5 'calculateResources' health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ShapeFileParser.javaLength of output: 1624
health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ShapeFileParser.java (1)
58-58
: Ensure the new method signature ofparseFileData
inShapeFileParser
is correctly used in the codebase.Verification successful
The
rg
command output shows multiple instances ofparseFileData
usage across different files. We need to verify each instance to ensure the method is used withPlanConfigurationRequest
andString fileStoreId
.Instances to Verify:
ResourceEstimationService.java
ShapeFileParser.java
FileParser.java
GeoJsonParser.java
ExcelParser.java
Let's generate a script to extract the relevant lines from these files to verify the method usage.
The output confirms that the new method signature of
parseFileData
inShapeFileParser
is correctly used across the codebase. Specifically, the method is consistently used withPlanConfigurationRequest
andString fileStoreId
parameters in the following files:
ResourceEstimationService.java
ShapeFileParser.java
FileParser.java
GeoJsonParser.java
ExcelParser.java
Verified Instances:
- ResourceEstimationService.java:
parser.parseFileData(planConfigurationRequest, planConfiguration.getFiles().get(0).getFilestoreId());
- ShapeFileParser.java:
public Object parseFileData(PlanConfigurationRequest planConfigurationRequest, String fileStoreId) {
- FileParser.java:
Object parseFileData(PlanConfigurationRequest planConfigurationRequest , String fileStoreId);
- GeoJsonParser.java:
public Object parseFileData(PlanConfigurationRequest planConfigurationRequest, String fileStoreId) {
- ExcelParser.java:
public Object parseFileData(PlanConfigurationRequest planConfigurationRequest, String fileStoreId) {
No discrepancies were found in the method usage.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the new method signature of `parseFileData` in `ShapeFileParser`. # Test: Search for the usage of `parseFileData`. Expect: It should be used with `PlanConfigurationRequest`. rg --type java $'parseFileData'Length of output: 1259
Script:
#!/bin/bash # Extract lines where `parseFileData` is used in the specified files to verify the method signature. # Files to check files=( "health-services/resource-estimation-service/src/main/java/org/egov/processor/web/controllers/FileController.java" "health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ResourceEstimationService.java" "health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ShapeFileParser.java" "health-services/resource-estimation-service/src/main/java/org/egov/processor/service/FileParser.java" "health-services/resource-estimation-service/src/main/java/org/egov/processor/service/GeoJsonParser.java" "health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ExcelParser.java" ) # Loop through files and extract relevant lines for file in "${files[@]}"; do echo "File: $file" rg 'parseFileData' "$file" echo doneLength of output: 3632
health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ExcelParser.java (5)
25-28
: Added imports forPlanUtil
andPlanConfigurationRequest
.
47-54
: Introduced a new fieldplanUtil
and updated the constructor to initialize it.
Line range hint
65-75
: UpdatedparseFileData
method to acceptPlanConfigurationRequest
instead ofPlanConfiguration
. Ensure that all calls to this method are updated to pass the new parameter type.Verification successful
Verification of
parseFileData
Method CallsThe verification process confirms that all instances of the
parseFileData
method have been updated to use the new parameter typePlanConfigurationRequest
. Here are the findings:
- FileController.java: The method call is commented out, so no update is needed.
- ShapeFileParser.java: The method signature is correctly updated.
- GeoJsonParser.java: The method signature is correctly updated.
- ResourceEstimationService.java: The method call is correctly updated.
- FileParser.java: The interface method signature is correctly updated.
- ExcelParser.java: The method signature is correctly updated.
No further action is required as all instances are consistent with the new parameter type.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all calls to `parseFileData` are updated. # Test: Search for the method usage. Expect: Only occurrences of the new signature. rg --type java $'parseFileData'Length of output: 1259
Script:
#!/bin/bash # Extract lines around the method calls to verify the parameter type # FileController.java rg -A 5 -B 5 'parseFileData' health-services/resource-estimation-service/src/main/java/org/egov/processor/web/controllers/FileController.java # ShapeFileParser.java rg -A 5 -B 5 'parseFileData' health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ShapeFileParser.java # GeoJsonParser.java rg -A 5 -B 5 'parseFileData' health-services/resource-estimation-service/src/main/java/org/egov/processor/service/GeoJsonParser.java # ResourceEstimationService.java rg -A 5 -B 5 'parseFileData' health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ResourceEstimationService.java # FileParser.java rg -A 5 -B 5 'parseFileData' health-services/resource-estimation-service/src/main/java/org/egov/processor/service/FileParser.java # ExcelParser.java rg -A 5 -B 5 'parseFileData' health-services/resource-estimation-service/src/main/java/org/egov/processor/service/ExcelParser.javaLength of output: 4201
Line range hint
85-97
: UpdatedprocessExcelFile
to usePlanConfigurationRequest
. The method now correctly extractsPlanConfiguration
from the request object. This change aligns with the PR's objective to integratePlanConfigurationRequest
.
Line range hint
117-147
: RefactoredprocessRows
to usePlanConfigurationRequest
. Added a call toplanUtil.create
, which is a significant change as it integrates the creation of plans into the row processing logic. Ensure that the integration ofplanUtil.create
is thoroughly tested, especially since it involves complex data manipulations.
...vices/resource-estimation-service/src/main/java/org/egov/processor/config/Configuration.java
Show resolved
Hide resolved
24a9175
into
HLM-5118-resource-estimation-service
Summary by CodeRabbit
New Features
Improvements
PlanConfigurationRequest
for better consistency and flexibility in handling plan configurations.Bug Fixes
These changes aim to improve the efficiency and reliability of the resource estimation process.