-
Notifications
You must be signed in to change notification settings - Fork 31
Abdm v3 #128
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
Abdm v3 #128
Conversation
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com>
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes * feat: mongo query change fetch for linktoken --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com>
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes * feat: mongo query change fetch for linktoken * fix: link carecontext authorization error --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com>
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes * feat: mongo query change fetch for linktoken * fix: link carecontext authorization error * feat: hiTypes addition * feat: version change for testing * fix: corrected spelling mistake Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: modified repo queries Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes * feat: mongo query change fetch for linktoken * fix: link carecontext authorization error * feat: hiTypes addition * feat: version change for testing * fix: minor change for empty response * Simplify queries in CareContextRepo interface Removed unnecessary 'order by 1 desc' clause from queries. --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com>
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes * feat: mongo query change fetch for linktoken * fix: link carecontext authorization error * feat: hiTypes addition * feat: version change for testing * fix: minor change for empty response * Simplify queries in CareContextRepo interface Removed unnecessary 'order by 1 desc' clause from queries. * fix: corrected response format --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com>
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes * feat: mongo query change fetch for linktoken * fix: link carecontext authorization error * feat: hiTypes addition * feat: version change for testing * fix: minor change for empty response * Simplify queries in CareContextRepo interface Removed unnecessary 'order by 1 desc' clause from queries. * fix: corrected response format * fix: minor logic change for care context linking --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com>
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes * feat: mongo query change fetch for linktoken * fix: link carecontext authorization error * feat: hiTypes addition * feat: version change for testing * fix: minor change for empty response * Simplify queries in CareContextRepo interface Removed unnecessary 'order by 1 desc' clause from queries. * fix: corrected response format * fix: minor logic change for care context linking * small correction in hiType and error message modification * Fix display setting for patient care context --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com>
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes * feat: mongo query change fetch for linktoken * fix: link carecontext authorization error * feat: hiTypes addition * feat: version change for testing * fix: minor change for empty response * Simplify queries in CareContextRepo interface Removed unnecessary 'order by 1 desc' clause from queries. * fix: corrected response format * fix: minor logic change for care context linking * small correction in hiType and error message modification * modified error message --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com>
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes * feat: mongo query change fetch for linktoken * fix: link carecontext authorization error * feat: hiTypes addition * feat: version change for testing * fix: minor change for empty response * Simplify queries in CareContextRepo interface Removed unnecessary 'order by 1 desc' clause from queries. * fix: corrected response format * fix: minor logic change for care context linking * small correction in hiType and error message modification * modified error message * feat: new standard FHIR bundles creation * Fix environment variable for systemUrl * Fix formatting of systemUrl property * fix: taken coderabbitai comments and minor changes --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com>
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes * feat: mongo query change fetch for linktoken * fix: link carecontext authorization error * feat: hiTypes addition * feat: version change for testing * fix: minor change for empty response * Simplify queries in CareContextRepo interface Removed unnecessary 'order by 1 desc' clause from queries. * fix: corrected response format * fix: minor logic change for care context linking * small correction in hiType and error message modification * modified error message * feat: new standard FHIR bundles creation * Fix environment variable for systemUrl * Fix formatting of systemUrl property * fix: taken coderabbitai comments and minor changes * fix: changed missed variable --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com>
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes * feat: mongo query change fetch for linktoken * fix: link carecontext authorization error * feat: hiTypes addition * feat: version change for testing * fix: minor change for empty response * Simplify queries in CareContextRepo interface Removed unnecessary 'order by 1 desc' clause from queries. * fix: corrected response format * fix: minor logic change for care context linking * small correction in hiType and error message modification * modified error message * feat: new standard FHIR bundles creation * Fix environment variable for systemUrl * Fix formatting of systemUrl property * fix: taken coderabbitai comments and minor changes * fix: changed missed variable * fix: modified the constructor * Change exception message for Organization resource * Fix typo in exception message for PractitionerDataModel --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com>
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes * feat: mongo query change fetch for linktoken * fix: link carecontext authorization error * feat: hiTypes addition * feat: version change for testing * fix: minor change for empty response * Simplify queries in CareContextRepo interface Removed unnecessary 'order by 1 desc' clause from queries. * fix: corrected response format * fix: minor logic change for care context linking * small correction in hiType and error message modification * modified error message * feat: new standard FHIR bundles creation * Fix environment variable for systemUrl * Fix formatting of systemUrl property * fix: taken coderabbitai comments and minor changes * fix: changed missed variable * fix: modified the constructor * Change exception message for Organization resource * Fix typo in exception message for PractitionerDataModel * fix: corrected type error --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com>
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes * feat: mongo query change fetch for linktoken * fix: link carecontext authorization error * feat: hiTypes addition * feat: version change for testing * fix: minor change for empty response * Simplify queries in CareContextRepo interface Removed unnecessary 'order by 1 desc' clause from queries. * fix: corrected response format * fix: minor logic change for care context linking * small correction in hiType and error message modification * modified error message * feat: new standard FHIR bundles creation * Fix environment variable for systemUrl * Fix formatting of systemUrl property * fix: taken coderabbitai comments and minor changes * fix: changed missed variable * fix: modified the constructor * Change exception message for Organization resource * Fix typo in exception message for PractitionerDataModel * fix: corrected type error * fix: correct medication histoory model class --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the π WalkthroughWalkthroughMajor refactoring of FHIR resource bundle creation, including relocation and renaming of bundle processing interfaces/implementations from resource_gateway to bundle_creation package, addition of care context linking support, new data models, updated resource factories, and dependency version upgrades (Jackson, HAPI FHIR, Lombok). Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant CareContextCtrl as CareContextLinkingController
participant Service as CareContextLinkingServiceImpl
participant Repo as GenerateTokenAbdmResponsesRepo
participant ABDM as ABDM API
participant Mongo as MongoDB
Client->>CareContextCtrl: POST /careContext/generateCareContextToken
activate CareContextCtrl
CareContextCtrl->>Service: generateTokenForCareContext(request)
activate Service
Service->>Service: Parse request, extract abhaAddress
Service->>Repo: findByAbhaAddress(abhaAddress)
activate Repo
Repo-->>Service: Prior response (if exists & valid)
deactivate Repo
alt Token exists & valid (< 3 months)
Service-->>CareContextCtrl: Return cached linkToken
else Token missing or expired
Service->>ABDM: POST /api/hiecm/v3/token/generate-token
activate ABDM
ABDM-->>Service: 202 Accepted with requestId
deactivate ABDM
Service->>Service: Poll/retrieve LinkToken from Mongo
Service->>Mongo: Store generateTokenAbdmResponses
activate Mongo
Mongo-->>Service: Saved
deactivate Mongo
end
Service-->>CareContextCtrl: JSON response (linkToken/error)
deactivate Service
CareContextCtrl-->>Client: OutputResponse with linkToken
deactivate CareContextCtrl
Client->>CareContextCtrl: POST /careContext/linkCareContext
activate CareContextCtrl
CareContextCtrl->>Service: linkCareContext(request)
activate Service
Service->>Service: Extract/resolve linkToken
Service->>ABDM: POST /api/hiecm/hip/v3/link/carecontext
activate ABDM
ABDM-->>Service: Success or error response
deactivate ABDM
Service-->>CareContextCtrl: JSON response (success/error)
deactivate Service
CareContextCtrl-->>Client: OutputResponse
deactivate CareContextCtrl
sequenceDiagram
participant Request as Patient Resource Request
participant CommonSvc as CommonServiceImpl
participant OPBundle as OPConsultResourceBundleImpl
participant Resources as Resource Factories
participant FHIRCtx as FHIR Context
participant Mongo as MongoDB
Request->>CommonSvc: processResourceOperation()
activate CommonSvc
CommonSvc->>CommonSvc: Check visit category & type
alt OP Consult (General OPD)
CommonSvc->>OPBundle: processOpConsultRecordBundle()
activate OPBundle
OPBundle->>Resources: Fetch Practitioner, Organization, Patient
activate Resources
Resources-->>OPBundle: Resource objects
deactivate Resources
OPBundle->>OPBundle: PopulateOpConsultRecordResourceBundle()
OPBundle->>FHIRCtx: Serialize Bundle to JSON
activate FHIRCtx
FHIRCtx-->>OPBundle: JSON bundle string
deactivate FHIRCtx
OPBundle->>OPBundle: Create AMRIT_ResourceMongo
OPBundle->>Mongo: Save via commonService
activate Mongo
Mongo-->>OPBundle: Persisted
deactivate Mongo
OPBundle-->>CommonSvc: Success/int status
deactivate OPBundle
end
CommonSvc->>CommonSvc: Check lab tests, prescriptions, wellness, immunization
CommonSvc->>CommonSvc: Mark processed & update patient record
CommonSvc-->>Request: Response
deactivate CommonSvc
Estimated code review effortπ― 4 (Complex) | β±οΈ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touchesβ Failed checks (1 warning, 1 inconclusive)
β Passed checks (1 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
src/main/java/com/wipro/fhir/controller/v3/careContext/CareContextLinkingController.java
Fixed
Show fixed
Hide fixed
src/main/java/com/wipro/fhir/controller/v3/careContext/CareContextLinkingController.java
Fixed
Show fixed
Hide fixed
| spring.redis.host=${REDIS_HOST} | ||
| spring.redis.host=${REDIS_HOST} | ||
|
|
||
| hipSystemUrl= ${HIP_SYSTEM_URL} |
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.
linkCareContext, generateTokenForLinkCareContext missing here?
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.
@drtechie added the urls missed bymistake
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.
is this a new file? not required I guess
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.
@drtechie yes not required removed
|
@coderabbitai full review |
β Actions performedFull review 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: 12
Note
Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.
π‘ Minor comments (12)
.factorypath-2-2 (1)
2-2: Version mismatch between .factorypath and pom.xml.The
.factorypathreferences Lombok 1.18.30, butpom.xmldefines<org.projectlombok.version>1.18.36</org.projectlombok.version>. This inconsistency may cause annotation processing issues in Eclipse IDE. Consider aligning both to the same version.src/main/java/com/wipro/fhir/service/bundle_creation/BundleValidator.java-48-50 (1)
48-50: Useprintlnfor readable output.
System.out.printwill concatenate all messages on a single line without newlines.Suggested fix
- System.out.print("Error - " + next.getSeverity() + " - " + next.getLocationString() + " - " + next.getMessage()); + System.out.println(next.getSeverity() + " - " + next.getLocationString() + " - " + next.getMessage());pom.xml-218-224 (1)
218-224: Duplicate dependency declaration.
hapi-fhir-structures-r4version 8.4.0 is declared twice (lines 204-208 and lines 220-224). Remove the duplicate to avoid confusion.Suggested fix
- <!-- - https://mvnrepository.com/artifact/ca.uhn.hapi.fhir/hapi-fhir-structures-r4 --> - <dependency> - <groupId>ca.uhn.hapi.fhir</groupId> - <artifactId>hapi-fhir-structures-r4</artifactId> - <version>8.4.0</version> - </dependency>src/main/java/com/wipro/fhir/service/bundle_creation/BundleValidator.java-28-28 (1)
28-28: Placeholder path will cause runtime failure.The
loadPackageFromClasspath(" ")call uses a space character as the path, which will fail. The comment suggests downloading a package from ABDM - consider adding proper documentation or a more descriptive placeholder that fails fast with a clear message.Suggested improvement
- npmPackageValidationSupport.loadPackageFromClasspath(" "); // download the package from ABDM and add in resources + // TODO: Download the ABDM validation package and add to classpath at: classpath:packages/abdm-fhir-package.tgz + npmPackageValidationSupport.loadPackageFromClasspath("classpath:packages/abdm-fhir-package.tgz");src/main/environment/common_docker.properties-102-103 (1)
102-103: Fix placeholder format inconsistency.Lines 102-103 use
@env.ABDM_HIECM_BASE_URL@placeholder format, but the rest of the Docker properties file consistently uses${ENV_VAR}format (e.g., lines 1, 12-14, 37-38). This inconsistency may cause configuration resolution issues.π Proposed fix
-generateTokenForLinkCareContext = @env.ABDM_HIECM_BASE_URL@/api/hiecm/v3/token/generate-token -linkCareContext = @env.ABDM_HIECM_BASE_URL@/api/hiecm/hip/v3/link/carecontext +generateTokenForLinkCareContext = ${ABDM_HIECM_BASE_URL}/api/hiecm/v3/token/generate-token +linkCareContext = ${ABDM_HIECM_BASE_URL}/api/hiecm/hip/v3/link/carecontextsrc/main/java/com/wipro/fhir/service/resource_model/ImmunizationResource.java-66-73 (1)
66-73: Verify the semantic correctness of NOTDONE status.Line 72 sets
ImmunizationStatus.NOTDONEwhenreceivedDateis null. In FHIR,NOTDONEmeans the immunization was not performed (e.g., refused, contraindicated), not "date unknown." This semantic mismatch could cause issues with downstream FHIR consumers.Consider:
- Omitting immunizations without a
receivedDate(addcontinue;at line 72)- Using a different status or extension if partial data must be represented
π Option to omit records without receivedDate
if (im.getReceivedDate() != null) { immune.setStatus(Immunization.ImmunizationStatus.COMPLETED); immune.setOccurrence(new DateTimeType(im.getReceivedDate())); } else { - // If you prefer to exclude not-done, comment the next line and add a - // `continue;` - immune.setStatus(Immunization.ImmunizationStatus.NOTDONE); + // Skip immunizations without a received date + continue; }src/main/java/com/wipro/fhir/service/bundle_creation/WellnessRecordResourceBundle.java-23-24 (1)
23-24: Fix inconsistent exception type declaration.The method
processWellnessRecordBundledeclaresorg.hl7.fhir.exceptions.FHIRExceptionwhile other methods in this interface usecom.wipro.fhir.utils.exception.FHIRException(imported at line 12). This inconsistency can cause confusion and potential exception handling issues.π Proposed fix
int processWellnessRecordBundle(ResourceRequestHandler resourceRequestHandler, PatientEligibleForResourceCreation p) - throws org.hl7.fhir.exceptions.FHIRException, Exception; + throws FHIRException, Exception;src/main/java/com/wipro/fhir/service/v3/careContext/CareContextLinkingServiceImpl.java-336-365 (1)
336-365: Method name typo and logger format issue.
- Method name
checkRecordExisitshas a typo - should becheckRecordExists.- Line 357:
logger.info("failed abha exists check with exception - ", e.getMessage())uses a comma, which treatse.getMessage()as a separate argument rather than concatenating it. The message won't appear in logs.π Proposed fix
- public String checkRecordExisits(String abhaAddress) { + public String checkRecordExists(String abhaAddress) { GenerateTokenAbdmResponses result = generateTokenAbdmResponsesRepo.findByAbhaAddress(abhaAddress); - logger.info("find by abha address result - ", result); + logger.info("find by abha address result - {}", result); String linkResponse = null; // ... } catch (Exception e) { - logger.info("failed abha exists check with exception - ", e.getMessage()); + logger.info("failed abha exists check with exception - {}", e.getMessage()); return null; }Note: Update the caller at line 96 to use the corrected method name.
src/main/java/com/wipro/fhir/service/bundle_creation/DiagnosticRecordResourceBundleImpl.java-83-85 (1)
83-85: TODO placeholder in exception message.The exception message contains a TODO placeholder ("TODO - exception - later will implement") instead of a descriptive error message. This should be updated to match other bundle implementations.
π Proposed fix
} else - throw new FHIRException("TODO - exception - later will implement"); + throw new FHIRException("Issue in processing the Diagnostic Report bundle");src/main/java/com/wipro/fhir/service/bundle_creation/OPConsultResourceBundleImpl.java-254-256 (1)
254-256: Typo in SNOMED display text.There's a backtick character at the end of "Clinical consultation report`". This typo will appear in the generated FHIR bundle.
π Proposed fix
composition - .setType(new CodeableConcept(new Coding("http://snomed.info/sct", "371530004", "Clinical consultation report`"))); + .setType(new CodeableConcept(new Coding("http://snomed.info/sct", "371530004", "Clinical consultation report")));src/main/java/com/wipro/fhir/service/bundle_creation/ImmunizationRecordResourceBundleImpl.java-189-195 (1)
189-195: Duplicate setCustodian call.
setCustodianis called unconditionally at line 190, then again conditionally at lines 193-195. The second call is redundant sinceorganizationcannot be null at that point (it would have thrown an exception fromgetOrganizationResource).π Proposed fix
composition.addAuthor(new Reference(practitioner.getIdElement().getValue())); composition.setCustodian(new Reference(organization.getIdElement().getValue())); composition.setTitle("Immunization Record"); - - if (organization != null) { - composition.setCustodian(new Reference(organization.getIdElement().getValue())); - }src/main/java/com/wipro/fhir/service/bundle_creation/WellnessRecordResourceBundleImpl.java-237-255 (1)
237-255: Copy/paste error: method name refers to Prescription but handles Wellness.The private method is named
createPrescriptionBundleMongobut it creates a Wellness bundle (setsresourceTypeto "WellnessRecord" at line 252). Rename for clarity.π Proposed fix
- private AMRIT_ResourceMongo createPrescriptionBundleMongo(PatientEligibleForResourceCreation p, + private AMRIT_ResourceMongo createWellnessBundleMongo(PatientEligibleForResourceCreation p, String wellnessBundle) {Also update the caller at line 70:
- AMRIT_ResourceMongo aMRIT_ResourceMongo = createPrescriptionBundleMongo(p, wellnessBundle); + AMRIT_ResourceMongo aMRIT_ResourceMongo = createWellnessBundleMongo(p, wellnessBundle);Committable suggestion skipped: line range outside the PR's diff.
π§Ή Nitpick comments (32)
src/main/java/com/wipro/fhir/service/resource_model/MedicationRequestResource.java (1)
152-157: Good defensive null check added.The guard prevents
NullPointerExceptionwhenconditionDiagnosisis null or empty.Optional: Consider using isEmpty()
- if(conditionDiagnosis != null && conditionDiagnosis.size() > 0) { + if(conditionDiagnosis != null && !conditionDiagnosis.isEmpty()) {src/main/java/com/wipro/fhir/data/v3/careContext/GenerateCareContextTokenRequest.java (1)
5-13: Simple DTO structure looks correct.The DTO follows the same pattern as other care-context request classes in this package.
Consider using
Integerinstead ofintforyearOfBirthif null is a valid input state (e.g., optional field). Usingintdefaults to0when not provided, which may be indistinguishable from an intentional value.src/main/java/com/wipro/fhir/service/bundle_creation/BundleValidator.java (1)
44-44: Empty bundle JSON placeholder.The hardcoded empty string will not produce meaningful validation results. Consider accepting the bundle JSON as a command-line argument or reading from a file.
Suggested improvement
- String bundleJson = ""; // add bundle json here + if (args.length == 0) { + System.err.println("Usage: BundleValidator <bundle.json>"); + return; + } + String bundleJson = new String(java.nio.file.Files.readAllBytes(java.nio.file.Paths.get(args[0])));src/main/java/com/wipro/fhir/service/bundle_creation/DischargeSummaryResourceBundle.java (1)
26-31: Consider reducing parameter count.The
PopulateDischargeSummaryCompositionmethod has 13 parameters, which is excessive. Consider grouping related parameters into a dedicated context or builder object to improve readability and maintainability.src/main/java/com/wipro/fhir/data/mongo/care_context/GenerateTokenAbdmResponses.java (1)
3-3: Remove unused import.
LocalDateTimeis imported but never used. ThecreatedDatefield usesjava.util.Dateinstead.π Proposed fix
-import java.time.LocalDateTime; import java.util.Date;src/main/java/com/wipro/fhir/service/resource_model/ImmunizationResource.java (1)
28-29: Consider making the data model utility static or refactoring the pattern.
ImmunizationDataModelis autowired but used only as a factory/utility to callgetImmunizationList(). Autowiring a stateless utility class is unconventional. Consider either:
- Making
getImmunizationList()a static method- Not annotating
ImmunizationDataModelwith@Componentand instantiating it locallyπ Option 1: Static utility method
In
ImmunizationDataModel.java:- public List<ImmunizationDataModel> getImmunizationList(List<Object[]> resultSetList) { + public static List<ImmunizationDataModel> getImmunizationList(List<Object[]> resultSetList) {In
ImmunizationResource.java:- @Autowired - private ImmunizationDataModel immunizationDataModel; - ... - List<ImmunizationDataModel> immunizationList = immunizationDataModel.getImmunizationList(rsObjList); + List<ImmunizationDataModel> immunizationList = ImmunizationDataModel.getImmunizationList(rsObjList);src/main/java/com/wipro/fhir/data/resource_model/OrganizationDataModel.java (1)
16-16: Remove unused serialVersionUID or implement Serializable.The field
serialVersionUIDis declared but the class doesn't implementSerializable. Either implement the interface if serialization is needed, or remove this field. Note that similar data models in the codebase (e.g.,MedicalHistoryDataModel) do implementSerializable.π Proposed fix
+import java.io.Serializable; + @Component @Data -public class OrganizationDataModel { +public class OrganizationDataModel implements Serializable {src/main/java/com/wipro/fhir/service/bundle_creation/PrescriptionResourceBundle.java (1)
16-24: Fix inconsistent method naming to follow Java conventions.The interface methods use inconsistent naming:
PopulatePrescriptionResourceBundleandPopulatePrescriptionCompositionstart with uppercase (non-standard)processPrescriptionRecordBundlefollows proper Java naming (lowercase start)Java method names should start with a lowercase letter. Consider renaming to maintain consistency and follow standard conventions:
populatePrescriptionResourceBundle,populatePrescriptionComposition.π Proposed fix
- String PopulatePrescriptionResourceBundle(ResourceRequestHandler resourceRequestHandler, + String populatePrescriptionResourceBundle(ResourceRequestHandler resourceRequestHandler, PatientEligibleForResourceCreation p) throws FHIRException; - Composition PopulatePrescriptionComposition(ResourceRequestHandler resourceRequestHandler, + Composition populatePrescriptionComposition(ResourceRequestHandler resourceRequestHandler, PatientEligibleForResourceCreation p, List<MedicationRequest> medicationRequest, Practitioner practitioner, Organization organization);src/main/java/com/wipro/fhir/data/resource_model/PractitionerDataModel.java (1)
16-16: Remove unused serialVersionUID or implement Serializable.The field
serialVersionUIDis declared but the class doesn't implementSerializable. For consistency with similar data models likeMedicalHistoryDataModel(which does implementSerializable), either implement the interface or remove this field.π Proposed fix
+import java.io.Serializable; + @Data @Component -public class PractitionerDataModel { +public class PractitionerDataModel implements Serializable {src/main/java/com/wipro/fhir/service/bundle_creation/WellnessRecordResourceBundle.java (1)
16-21: Fix method naming to follow Java conventions.The methods
PopulateWellnessRecordResourceBundleandPopulateWellnessRecordCompositionstart with uppercase letters, violating Java naming conventions. Method names should start with lowercase:populateWellnessRecordResourceBundleandpopulateWellnessRecordComposition.π Proposed fix
- String PopulateWellnessRecordResourceBundle(ResourceRequestHandler resourceRequestHandler, + String populateWellnessRecordResourceBundle(ResourceRequestHandler resourceRequestHandler, PatientEligibleForResourceCreation p) throws FHIRException; - Composition PopulateWellnessRecordComposition(ResourceRequestHandler resourceRequestHandler, + Composition populateWellnessRecordComposition(ResourceRequestHandler resourceRequestHandler, PatientEligibleForResourceCreation p, Practitioner practitioner, Organization organization, List<Observation> observationVitalList);src/main/java/com/wipro/fhir/service/bundle_creation/ImmunizationRecordResourceBundle.java (1)
15-25: Method naming convention inconsistency.
PopulateImmunizationResourceBundleuses PascalCase whilepopulateImmunizationCompositionandprocessImmunizationRecordBundlefollow Java's standard camelCase convention. For consistency with Java naming standards, consider renaming topopulateImmunizationResourceBundle.This pattern appears across other new interfaces in this PR (DiagnosticRecordResourceBundle, OPConsultResourceBundle), so a consistent decision should be made.
src/main/java/com/wipro/fhir/service/bundle_creation/DiagnosticRecordResourceBundle.java (1)
14-27: Interface design looks good with same naming caveat.The interface appropriately abstracts diagnostic report bundle operations. Same observation as the other bundle interfaces:
PopulateDiagnosticReportCompositionandPopulateDiagnosticReportResourceBundleuse PascalCase instead of Java's conventional camelCase.src/main/java/com/wipro/fhir/service/bundle_creation/OPConsultResourceBundle.java (1)
17-30: Consider a parameter object forPopulateOpConsultComposition.The method signature has 9 parameters, which can be unwieldy. Consider grouping related parameters into a dedicated data class (e.g.,
OpConsultCompositionData) to improve readability and maintainability. This is an optional refactor for future consideration.Same naming convention observation applies:
PopulateOpConsultCompositionandPopulateOPConsultRecordResourceBundleuse PascalCase.src/main/java/com/wipro/fhir/service/resource_model/PractitionerResource.java (2)
46-53: Unusual use of@Autowiredfor data model as factory.
PractitionerDataModelis injected as a Spring component but used as a factory/mapper (line 64). SincePractitionerDataModelis a@Component(singleton), this works but is unconventional. ThegetPractitionermethod on the data model doesn't rely on instance state, so it could be a static method or extracted to a separate mapper class.This pattern appears consistent with other data models in the PR (e.g.,
OrganizationDataModel,ImmunizationDataModel), so maintaining consistency is reasonable.
24-25: Unused imports.
ArrayListandListimports appear unused after refactoring. These can be safely removed.π Proposed fix
-import java.util.ArrayList; -import java.util.List; -src/main/java/com/wipro/fhir/data/resource_model/MedicalHistoryDataModel.java (2)
30-49: Inconsistent exception type - consider usingFHIRException.Other data models in this PR (
PractitionerDataModel,OrganizationDataModel) throwFHIRExceptionon parsing errors, butMedicalHistoryDataModelthrows a genericException. For consistency and to allow callers to handle errors uniformly, consider usingFHIRException.π Proposed fix
+import com.wipro.fhir.utils.exception.FHIRException; + @Data @Component public class MedicalHistoryDataModel implements Serializable { // ... - public MedicalHistoryDataModel(Object[] objArr) throws Exception { + public MedicalHistoryDataModel(Object[] objArr) throws FHIRException { try { // ... parsing logic ... } catch (Exception e) { - throw new Exception("Medical History resource model failed with error - " + e.getMessage()); + throw new FHIRException("Medical History resource model failed with error - " + e.getMessage()); } } - public List<MedicalHistoryDataModel> getMedicalList(List<Object[]> resultSetList) throws Exception { + public List<MedicalHistoryDataModel> getMedicalList(List<Object[]> resultSetList) throws FHIRException {
51-61: Minor: preferisEmpty()oversize() > 0.Line 54 uses
resultSetList.size() > 0, which is equivalent to but less idiomatic than!resultSetList.isEmpty().src/main/java/com/wipro/fhir/service/v3/careContext/CareContextLinkingServiceImpl.java (4)
16-16: Unused import.
org.joda.time.DateTimeis imported but never used in this file.π Proposed fix
-import org.joda.time.DateTime;
148-149: Unused variable and deprecated API usage.
responseStrLogin(line 148) is assigned but never used.new JsonParser()(line 149) is deprecated. UseJsonParser.parseString()directly instead.π Proposed fix
- String responseStrLogin = common_NDHMService.getBody(responseEntity); - JsonParser jsnParser = new JsonParser(); if (responseEntity.getStatusCode() == HttpStatusCode.valueOf(202)) { // ... - JsonElement jsonElement = jsnParser.parse(abhaResponse); + JsonElement jsonElement = JsonParser.parseString(abhaResponse);
294-296: Unused variable.
responseStrLoginis assigned but never used.π Proposed fix
- String responseStrLogin = common_NDHMService.getBody(responseEntity); if (responseEntity.getStatusCode() == HttpStatusCode.valueOf(202)) {
367-397: LGTM - HI types determination logic.The
findHiTypesmethod correctly determines applicable HI types based on visit category and repository checks. The logic properly gates WellnessRecord, Prescription, DiagnosticReport, and ImmunizationRecord based on data presence.Minor: Line 395
logger.info("HiTypes", hiTypes)should use{}placeholder for proper logging.π Minor logging fix
- logger.info("HiTypes", hiTypes); + logger.info("HiTypes: {}", hiTypes);src/main/java/com/wipro/fhir/controller/generateresource/ResourceRequestGateway.java (1)
81-81: Method naming convention inconsistency.The new method names use PascalCase (
PopulateOPConsultRecordResourceBundle) instead of the standard Java camelCase convention (populateOPConsultRecordResourceBundle). This is consistent across all new bundle implementations in this PR, but deviates from Java naming standards.src/main/java/com/wipro/fhir/service/bundle_creation/PrescriptionResourceBundleImpl.java (3)
62-62: Unused logger field.The
Loggeris declared but never used in this class. Either remove it or add appropriate logging for debugging and monitoring bundle creation.
160-162: Exception handling loses stack trace details.Using
+ ein the exception message only includestoString(), losing the full stack trace. Consider using+ e.getMessage()for the message and logging the full exception separately, or use proper exception chaining.π Proposed fix
} catch (Exception e) { - throw new FHIRException("Prescription FHIR Resource Bundle failed with error - " + e); + logger.error("Prescription FHIR Resource Bundle failed", e); + throw new FHIRException("Prescription FHIR Resource Bundle failed with error - " + e.getMessage()); }
155-157: Cache the FhirContext instance to avoid expensive repeated initialization.
FhirContext.forR4()is expensive to create and is thread-safe once constructed. Creating it on every bundle serialization degrades performance. Cache it as a class-level field initialized once via@PostConstruct, then create a fresh parser on each request viafhirContext.newJsonParser()(parsers are not thread-safe but are cheap to create).π Suggested approach
+import jakarta.annotation.PostConstruct; + @Service public class PrescriptionResourceBundleImpl implements PrescriptionResourceBundle { + + private FhirContext fhirContext; + + @PostConstruct + public void init() { + this.fhirContext = FhirContext.forR4(); + } // ... in PopulatePrescriptionResourceBundle method: - FhirContext ctx = FhirContext.forR4(); - IParser parser = ctx.newJsonParser(); + IParser parser = fhirContext.newJsonParser();Alternatively, define a
@Beanin a configuration class and inject it across all bundle implementations.src/main/java/com/wipro/fhir/service/bundle_creation/DischargeSummaryResourceBundleImpl.java (2)
331-341: Inconsistent section structure - one section per item.Each chief complaint creates a new section with the same title and code. This differs from the approach used for "Past Medical History" (lines 368-380), which groups all entries in a single section. Consider consolidating into one "Chief complaints" section with multiple entries for consistency.
π Suggested consolidation
- if (chiefComplaints != null) { - for (Condition condition : chiefComplaints) { - SectionComponent s = new SectionComponent(); - s.setTitle("Chief complaints"); - s.setCode(new CodeableConcept().addCoding( - new Coding("http://snomed.info/sct", "422843007", "Chief complaint section"))); - s.addEntry(new Reference(condition.getIdElement().getValue())); - sectionList.add(s); - } - } + if (chiefComplaints != null && !chiefComplaints.isEmpty()) { + SectionComponent s = new SectionComponent(); + s.setTitle("Chief complaints"); + s.setCode(new CodeableConcept().addCoding( + new Coding("http://snomed.info/sct", "422843007", "Chief complaint section"))); + for (Condition condition : chiefComplaints) { + s.addEntry(new Reference(condition.getIdElement().getValue())); + } + sectionList.add(s); + }Apply similar consolidation for Physical examination (lines 344-353), Allergies (lines 356-365), and Medications (lines 408-417).
279-281: Same FhirContext performance concern.Same issue as in
PrescriptionResourceBundleImpl-FhirContext.forR4()is expensive and should be shared across bundle implementations.src/main/java/com/wipro/fhir/service/bundle_creation/WellnessRecordResourceBundleImpl.java (1)
63-64: Redundant exception declaration.The method declares
throws FHIRException, Exception, butExceptionis a superclass that already coversFHIRException. This is redundant and differs from other bundle implementations which only throwFHIRException.π Proposed fix
public int processWellnessRecordBundle(ResourceRequestHandler resourceRequestHandler, - PatientEligibleForResourceCreation p) throws FHIRException, Exception { + PatientEligibleForResourceCreation p) throws FHIRException {src/main/java/com/wipro/fhir/service/bundle_creation/ImmunizationRecordResourceBundleImpl.java (1)
87-88: Variable name mismatch - diagReportBundle used for Immunization.The variable is named
diagReportBundlebut represents an Immunization bundle. This is a copy/paste remnant that reduces code clarity.π Proposed fix
- Bundle diagReportBundle = new Bundle(); + Bundle immunizationBundle = new Bundle();Update all subsequent references (lines 92-106, 151, 155) to use the corrected name.
src/main/java/com/wipro/fhir/service/bundle_creation/OPConsultResourceBundleImpl.java (1)
265-300: Same section structure issue as DischargeSummary.Each chief complaint, diagnosis, allergy, and medication statement creates a separate section instead of grouping by type. Consider consolidating for cleaner FHIR output.
src/main/java/com/wipro/fhir/service/common/CommonServiceImpl.java (2)
229-288: Individual bundle failures prevent subsequent bundle processing.If any bundle processing throws an exception, subsequent bundles won't be processed since there's no try/catch around each individual bundle call. The outer try/catch (line 303) catches the error but skips the rest of the bundles for that patient. Consider wrapping each bundle processing in its own try/catch to allow partial success.
π Suggested approach
// Example for one bundle - apply pattern to all try { if (p.getVisitCategory().equalsIgnoreCase("General OPD") || p.getVisitCategory().equalsIgnoreCase("General OPD (QC)")) { int opConsult = oPConsultResourceBundle.processOpConsultRecordBundle(resourceRequestHandler, p); if (opConsult <= 0) processed = false; logger.info(" The value of opConsult processed: " + processed); } } catch (Exception e) { logger.error("OP Consult bundle processing failed", e); processed = false; }
66-67: Stale comment - refers to Prescription but context is Immunization.Line 66 comment says "call method to generate Prescription resource" but this is in the context of
processImmunizationRecordBundle. This is a copy/paste artifact.Similar stale comments appear at lines 89, 105 in other bundle implementations reviewed above.
π Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
π Files selected for processing (58)
.factorypathpom.xmlsrc/main/environment/common_ci.propertiessrc/main/environment/common_docker.propertiessrc/main/environment/common_example.propertiessrc/main/java/com/wipro/fhir/controller/generateresource/ResourceRequestGateway.javasrc/main/java/com/wipro/fhir/controller/test/Test.javasrc/main/java/com/wipro/fhir/controller/v3/abha/CreateAbhaV3Controller.javasrc/main/java/com/wipro/fhir/controller/v3/careContext/CareContextLinkingController.javasrc/main/java/com/wipro/fhir/data/mongo/care_context/GenerateTokenAbdmResponses.javasrc/main/java/com/wipro/fhir/data/resource_model/ImmunizationDataModel.javasrc/main/java/com/wipro/fhir/data/resource_model/MedicalHistoryDataModel.javasrc/main/java/com/wipro/fhir/data/resource_model/OrganizationDataModel.javasrc/main/java/com/wipro/fhir/data/resource_model/PractitionerDataModel.javasrc/main/java/com/wipro/fhir/data/v3/careContext/AddCareContextRequest.javasrc/main/java/com/wipro/fhir/data/v3/careContext/CareContextLinkTokenRequest.javasrc/main/java/com/wipro/fhir/data/v3/careContext/CareContexts.javasrc/main/java/com/wipro/fhir/data/v3/careContext/GenerateCareContextTokenRequest.javasrc/main/java/com/wipro/fhir/data/v3/careContext/LinkCareContextRequest.javasrc/main/java/com/wipro/fhir/data/v3/careContext/PatientCareContext.javasrc/main/java/com/wipro/fhir/repo/common/PatientEligibleForResourceCreationRepo.javasrc/main/java/com/wipro/fhir/repo/mongo/generateToken_response/GenerateTokenAbdmResponsesRepo.javasrc/main/java/com/wipro/fhir/repo/v3/careContext/CareContextRepo.javasrc/main/java/com/wipro/fhir/service/bundle_creation/BundleValidator.javasrc/main/java/com/wipro/fhir/service/bundle_creation/DiagnosticRecordResourceBundle.javasrc/main/java/com/wipro/fhir/service/bundle_creation/DiagnosticRecordResourceBundleImpl.javasrc/main/java/com/wipro/fhir/service/bundle_creation/DischargeSummaryResourceBundle.javasrc/main/java/com/wipro/fhir/service/bundle_creation/DischargeSummaryResourceBundleImpl.javasrc/main/java/com/wipro/fhir/service/bundle_creation/ImmunizationRecordResourceBundle.javasrc/main/java/com/wipro/fhir/service/bundle_creation/ImmunizationRecordResourceBundleImpl.javasrc/main/java/com/wipro/fhir/service/bundle_creation/OPConsultResourceBundle.javasrc/main/java/com/wipro/fhir/service/bundle_creation/OPConsultResourceBundleImpl.javasrc/main/java/com/wipro/fhir/service/bundle_creation/PrescriptionResourceBundle.javasrc/main/java/com/wipro/fhir/service/bundle_creation/PrescriptionResourceBundleImpl.javasrc/main/java/com/wipro/fhir/service/bundle_creation/WellnessRecordResourceBundle.javasrc/main/java/com/wipro/fhir/service/bundle_creation/WellnessRecordResourceBundleImpl.javasrc/main/java/com/wipro/fhir/service/common/CommonServiceImpl.javasrc/main/java/com/wipro/fhir/service/ndhm/Common_NDHMService.javasrc/main/java/com/wipro/fhir/service/ndhm/Common_NDHMServiceImpl.javasrc/main/java/com/wipro/fhir/service/ndhm/LinkCareContext_NDHMServiceImpl.javasrc/main/java/com/wipro/fhir/service/resource_gateway/DiagnosticReportRecord.javasrc/main/java/com/wipro/fhir/service/resource_gateway/DiagnosticReportRecordImpl.javasrc/main/java/com/wipro/fhir/service/resource_gateway/OPConsultRecordBundle.javasrc/main/java/com/wipro/fhir/service/resource_gateway/OPConsultRecordBundleImpl.javasrc/main/java/com/wipro/fhir/service/resource_gateway/PrescriptionRecordBundle.javasrc/main/java/com/wipro/fhir/service/resource_gateway/PrescriptionRecordBundleImpl.javasrc/main/java/com/wipro/fhir/service/resource_model/DiagnosticReportResource.javasrc/main/java/com/wipro/fhir/service/resource_model/EncounterResource.javasrc/main/java/com/wipro/fhir/service/resource_model/ImmunizationResource.javasrc/main/java/com/wipro/fhir/service/resource_model/MedicalHistoryResource.javasrc/main/java/com/wipro/fhir/service/resource_model/MedicationRequestResource.javasrc/main/java/com/wipro/fhir/service/resource_model/ObservationResource.javasrc/main/java/com/wipro/fhir/service/resource_model/OrganizationResource.javasrc/main/java/com/wipro/fhir/service/resource_model/PatientResource.javasrc/main/java/com/wipro/fhir/service/resource_model/PractitionerResource.javasrc/main/java/com/wipro/fhir/service/v3/abha/CreateAbhaV3ServiceImpl.javasrc/main/java/com/wipro/fhir/service/v3/careContext/CareContextLinkingService.javasrc/main/java/com/wipro/fhir/service/v3/careContext/CareContextLinkingServiceImpl.java
π€ Files with no reviewable changes (9)
- src/main/java/com/wipro/fhir/service/resource_model/DiagnosticReportResource.java
- src/main/java/com/wipro/fhir/service/resource_gateway/DiagnosticReportRecord.java
- src/main/java/com/wipro/fhir/service/resource_gateway/DiagnosticReportRecordImpl.java
- src/main/java/com/wipro/fhir/service/resource_gateway/PrescriptionRecordBundleImpl.java
- src/main/java/com/wipro/fhir/service/resource_gateway/OPConsultRecordBundle.java
- src/main/java/com/wipro/fhir/service/resource_model/PatientResource.java
- src/main/java/com/wipro/fhir/service/resource_gateway/OPConsultRecordBundleImpl.java
- src/main/java/com/wipro/fhir/service/resource_gateway/PrescriptionRecordBundle.java
- src/main/java/com/wipro/fhir/service/v3/abha/CreateAbhaV3ServiceImpl.java
π§° Additional context used
π§ Learnings (12)
π Learning: 2025-01-09T12:17:11.789Z
Learnt from: helenKaryamsetty
Repo: PSMRI/FHIR-API PR: 58
File: src/main/java/com/wipro/fhir/service/v3/abha/LoginAbhaV3ServiceImpl.java:0-0
Timestamp: 2025-01-09T12:17:11.789Z
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.
Applied to files:
src/main/environment/common_example.propertiessrc/main/java/com/wipro/fhir/service/ndhm/Common_NDHMService.javasrc/main/java/com/wipro/fhir/data/mongo/care_context/GenerateTokenAbdmResponses.javasrc/main/java/com/wipro/fhir/service/ndhm/LinkCareContext_NDHMServiceImpl.javasrc/main/java/com/wipro/fhir/service/ndhm/Common_NDHMServiceImpl.java
π Learning: 2024-12-09T16:01:39.809Z
Learnt from: helenKaryamsetty
Repo: PSMRI/FHIR-API PR: 52
File: src/main/java/com/wipro/fhir/service/v3/abha/LoginAbhaV3ServiceImpl.java:84-91
Timestamp: 2024-12-09T16:01:39.809Z
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.
Applied to files:
src/main/environment/common_example.properties
π Learning: 2025-06-17T12:45:58.739Z
Learnt from: vishwab1
Repo: PSMRI/FHIR-API PR: 107
File: src/main/java/com/wipro/fhir/config/CorsConfig.java:24-26
Timestamp: 2025-06-17T12:45:58.739Z
Learning: FHIR APIs often require allowing all headers (`allowedHeaders("*")`) in CORS configuration due to the need for custom headers for various integrations and healthcare standards compliance, making restrictive header lists impractical.
Applied to files:
src/main/environment/common_example.properties
π Learning: 2024-12-09T16:09:31.513Z
Learnt from: helenKaryamsetty
Repo: PSMRI/FHIR-API PR: 52
File: src/main/java/com/wipro/fhir/controller/v3/abha/LoginAbhaV3Controller.java:18-20
Timestamp: 2024-12-09T16:09:31.513Z
Learning: In the Java Spring Boot project, all controllers, including `LoginAbhaV3Controller.java` at `src/main/java/com/wipro/fhir/controller/v3/abha/`, use the `CrossOrigin` annotation without parameters to maintain consistency across the codebase.
Applied to files:
src/main/java/com/wipro/fhir/controller/v3/abha/CreateAbhaV3Controller.javasrc/main/java/com/wipro/fhir/controller/v3/careContext/CareContextLinkingController.javasrc/main/java/com/wipro/fhir/service/ndhm/Common_NDHMServiceImpl.java
π Learning: 2024-12-10T14:52:59.847Z
Learnt from: helenKaryamsetty
Repo: PSMRI/FHIR-API PR: 52
File: src/main/java/com/wipro/fhir/controller/v3/abha/CreateAbhaV3Controller.java:51-68
Timestamp: 2024-12-10T14:52:59.847Z
Learning: In the FHIR-API project, when reviewing code in Java controllers (e.g., `CreateAbhaV3Controller.java`), the team prefers to retain raw request logging for debugging purposes. Therefore, suggestions to remove or modify logging statements related to raw requests should be ignored.
Applied to files:
src/main/java/com/wipro/fhir/controller/v3/abha/CreateAbhaV3Controller.javasrc/main/java/com/wipro/fhir/controller/v3/careContext/CareContextLinkingController.java
π Learning: 2024-11-20T07:41:40.038Z
Learnt from: helenKaryamsetty
Repo: PSMRI/FHIR-API PR: 46
File: src/main/java/com/wipro/fhir/data/mongo/care_context/SaveFacilityIdForVisit.java:7-8
Timestamp: 2024-11-20T07:41:40.038Z
Learning: In the `SaveFacilityIdForVisit` class (`src/main/java/com/wipro/fhir/data/mongo/care_context/SaveFacilityIdForVisit.java`), the handling of the MongoDB ID field and indexing is provided in another module and is not required in this class.
Applied to files:
src/main/java/com/wipro/fhir/data/v3/careContext/CareContexts.javasrc/main/java/com/wipro/fhir/repo/v3/careContext/CareContextRepo.javasrc/main/java/com/wipro/fhir/service/v3/careContext/CareContextLinkingServiceImpl.javasrc/main/java/com/wipro/fhir/service/common/CommonServiceImpl.javasrc/main/java/com/wipro/fhir/data/v3/careContext/PatientCareContext.javasrc/main/java/com/wipro/fhir/service/bundle_creation/DiagnosticRecordResourceBundleImpl.javasrc/main/java/com/wipro/fhir/service/bundle_creation/OPConsultResourceBundleImpl.javasrc/main/java/com/wipro/fhir/data/mongo/care_context/GenerateTokenAbdmResponses.javasrc/main/java/com/wipro/fhir/service/bundle_creation/WellnessRecordResourceBundleImpl.javasrc/main/java/com/wipro/fhir/data/v3/careContext/AddCareContextRequest.java
π Learning: 2025-02-10T10:34:55.588Z
Learnt from: indraniBan
Repo: PSMRI/FHIR-API PR: 53
File: src/main/java/com/wipro/fhir/utils/JwtUserIdValidationFilter.java:53-54
Timestamp: 2025-02-10T10:34:55.588Z
Learning: In the FHIR-API project, logging JWT token processing (without the actual token value) is acceptable and required for analysis purposes.
Applied to files:
src/main/java/com/wipro/fhir/controller/v3/careContext/CareContextLinkingController.java
π Learning: 2025-04-08T10:36:02.237Z
Learnt from: helenKaryamsetty
Repo: PSMRI/FHIR-API PR: 68
File: src/main/java/com/wipro/fhir/controller/healthID/CreateHealthIDWithMobileOTP.java:165-165
Timestamp: 2025-04-08T10:36:02.237Z
Learning: In the FHIR-API project, logging beneficiary IDs in response logs (e.g., "NDHM_FHIR get beneficiary Ids for HealthID response:") is acceptable and useful for debugging purposes as these IDs do not pose a security threat according to the domain expert.
Applied to files:
src/main/java/com/wipro/fhir/controller/v3/careContext/CareContextLinkingController.javasrc/main/java/com/wipro/fhir/service/ndhm/LinkCareContext_NDHMServiceImpl.java
π Learning: 2025-02-10T10:35:18.033Z
Learnt from: indraniBan
Repo: PSMRI/FHIR-API PR: 53
File: src/main/java/com/wipro/fhir/utils/JwtUserIdValidationFilter.java:67-68
Timestamp: 2025-02-10T10:35:18.033Z
Learning: In security-related components like JWT filters, avoid logging sensitive information like tokens. Instead, log boolean indicators or events/outcomes for debugging purposes.
Applied to files:
src/main/java/com/wipro/fhir/controller/v3/careContext/CareContextLinkingController.java
π Learning: 2025-02-03T12:55:47.722Z
Learnt from: indraniBan
Repo: PSMRI/FHIR-API PR: 53
File: src/main/java/com/wipro/fhir/utils/JwtAuthenticationUtil.java:49-52
Timestamp: 2025-02-03T12:55:47.722Z
Learning: In the FHIR-API project, detailed error messages in JWT authentication responses (e.g., "Invalid JWT Token!") are required as per project specifications and should not be replaced with generic messages.
Applied to files:
src/main/java/com/wipro/fhir/controller/v3/careContext/CareContextLinkingController.java
π Learning: 2024-11-20T07:45:51.578Z
Learnt from: helenKaryamsetty
Repo: PSMRI/FHIR-API PR: 46
File: src/main/java/com/wipro/fhir/service/common/CommonServiceImpl.java:365-381
Timestamp: 2024-11-20T07:45:51.578Z
Learning: In `CommonServiceImpl.java`, within the `addCareContextToMongo` method, prefer using direct switch-case statements for gender mapping instead of introducing separate enums.
Applied to files:
src/main/java/com/wipro/fhir/service/v3/careContext/CareContextLinkingServiceImpl.javasrc/main/java/com/wipro/fhir/service/common/CommonServiceImpl.java
π Learning: 2024-12-09T15:56:01.466Z
Learnt from: helenKaryamsetty
Repo: PSMRI/FHIR-API PR: 52
File: src/main/java/com/wipro/fhir/data/v3/abhaCard/EnrollByAadhaar.java:10-13
Timestamp: 2024-12-09T15:56:01.466Z
Learning: Fields `authData` and `consent` in the `EnrollByAadhaar` class (`src/main/java/com/wipro/fhir/data/v3/abhaCard/EnrollByAadhaar.java`) are not required and can remain public.
Applied to files:
src/main/java/com/wipro/fhir/data/v3/careContext/GenerateCareContextTokenRequest.javasrc/main/java/com/wipro/fhir/data/v3/careContext/AddCareContextRequest.javasrc/main/java/com/wipro/fhir/data/v3/careContext/CareContextLinkTokenRequest.java
𧬠Code graph analysis (16)
src/main/java/com/wipro/fhir/service/resource_model/ImmunizationResource.java (1)
src/main/java/com/wipro/fhir/service/bundle_creation/ImmunizationRecordResourceBundleImpl.java (1)
Service(38-236)
src/main/java/com/wipro/fhir/data/resource_model/MedicalHistoryDataModel.java (3)
src/main/java/com/wipro/fhir/data/resource_model/OrganizationDataModel.java (1)
Component(12-88)src/main/java/com/wipro/fhir/data/resource_model/PractitionerDataModel.java (1)
Data(12-83)src/main/java/com/wipro/fhir/data/resource_model/ImmunizationDataModel.java (1)
Data(12-59)
src/main/java/com/wipro/fhir/data/v3/careContext/CareContexts.java (2)
src/main/java/com/wipro/fhir/data/v3/careContext/PatientCareContext.java (1)
Data(6-16)src/main/java/com/wipro/fhir/data/mongo/care_context/CareContexts.java (1)
CareContexts(26-72)
src/main/java/com/wipro/fhir/service/v3/careContext/CareContextLinkingServiceImpl.java (3)
src/main/java/com/wipro/fhir/service/ndhm/Common_NDHMServiceImpl.java (1)
Service(45-202)src/main/java/com/wipro/fhir/service/v3/abha/CreateAbhaV3ServiceImpl.java (1)
Service(48-460)src/main/java/com/wipro/fhir/data/mongo/care_context/CareContexts.java (1)
CareContexts(26-72)
src/main/java/com/wipro/fhir/data/v3/careContext/GenerateCareContextTokenRequest.java (6)
src/main/java/com/wipro/fhir/data/mongo/care_context/GenerateTokenAbdmResponses.java (1)
Data(14-39)src/main/java/com/wipro/fhir/data/v3/careContext/AddCareContextRequest.java (1)
Data(5-20)src/main/java/com/wipro/fhir/data/v3/careContext/CareContextLinkTokenRequest.java (1)
Data(5-15)src/main/java/com/wipro/fhir/data/v3/careContext/CareContexts.java (1)
Data(5-11)src/main/java/com/wipro/fhir/data/v3/careContext/LinkCareContextRequest.java (1)
Data(6-14)src/main/java/com/wipro/fhir/data/v3/careContext/PatientCareContext.java (1)
Data(6-16)
src/main/java/com/wipro/fhir/data/resource_model/PractitionerDataModel.java (3)
src/main/java/com/wipro/fhir/data/resource_model/OrganizationDataModel.java (1)
Component(12-88)src/main/java/com/wipro/fhir/data/resource_model/MedicalHistoryDataModel.java (1)
Data(14-63)src/main/java/com/wipro/fhir/data/resource_model/ImmunizationDataModel.java (1)
Data(12-59)
src/main/java/com/wipro/fhir/data/v3/careContext/PatientCareContext.java (1)
src/main/java/com/wipro/fhir/data/v3/careContext/CareContexts.java (1)
Data(5-11)
src/main/java/com/wipro/fhir/service/bundle_creation/DiagnosticRecordResourceBundleImpl.java (13)
src/main/java/com/wipro/fhir/service/resource_model/MedicalHistoryResource.java (1)
Service(19-73)src/main/java/com/wipro/fhir/service/bundle_creation/DischargeSummaryResourceBundleImpl.java (1)
Service(56-444)src/main/java/com/wipro/fhir/service/bundle_creation/ImmunizationRecordResourceBundleImpl.java (1)
Service(38-236)src/main/java/com/wipro/fhir/service/bundle_creation/OPConsultResourceBundleImpl.java (1)
Service(49-340)src/main/java/com/wipro/fhir/service/bundle_creation/PrescriptionResourceBundleImpl.java (1)
Service(43-228)src/main/java/com/wipro/fhir/service/bundle_creation/WellnessRecordResourceBundleImpl.java (1)
Service(38-257)src/main/java/com/wipro/fhir/service/common/CommonServiceImpl.java (1)
Service(94-742)src/main/java/com/wipro/fhir/service/resource_model/ImmunizationResource.java (1)
Service(22-103)src/main/java/com/wipro/fhir/service/resource_model/MedicationRequestResource.java (1)
Service(52-168)src/main/java/com/wipro/fhir/service/resource_model/OrganizationResource.java (1)
Service(37-110)src/main/java/com/wipro/fhir/service/resource_model/PractitionerResource.java (1)
Service(43-142)src/main/java/com/wipro/fhir/service/resource_model/PatientResource.java (1)
Service(50-168)src/main/java/com/wipro/fhir/service/resource_model/DiagnosticReportResource.java (1)
Service(52-136)
src/main/java/com/wipro/fhir/service/bundle_creation/OPConsultResourceBundleImpl.java (12)
src/main/java/com/wipro/fhir/service/resource_model/MedicalHistoryResource.java (1)
Service(19-73)src/main/java/com/wipro/fhir/service/bundle_creation/DiagnosticRecordResourceBundleImpl.java (1)
Service(42-253)src/main/java/com/wipro/fhir/service/bundle_creation/DischargeSummaryResourceBundleImpl.java (1)
Service(56-444)src/main/java/com/wipro/fhir/service/bundle_creation/ImmunizationRecordResourceBundleImpl.java (1)
Service(38-236)src/main/java/com/wipro/fhir/service/bundle_creation/PrescriptionResourceBundleImpl.java (1)
Service(43-228)src/main/java/com/wipro/fhir/service/bundle_creation/WellnessRecordResourceBundleImpl.java (1)
Service(38-257)src/main/java/com/wipro/fhir/service/common/CommonServiceImpl.java (1)
Service(94-742)src/main/java/com/wipro/fhir/service/resource_model/ImmunizationResource.java (1)
Service(22-103)src/main/java/com/wipro/fhir/service/resource_model/OrganizationResource.java (1)
Service(37-110)src/main/java/com/wipro/fhir/service/resource_model/PractitionerResource.java (1)
Service(43-142)src/main/java/com/wipro/fhir/service/resource_model/PatientResource.java (1)
Service(50-168)src/main/java/com/wipro/fhir/service/resource_model/DiagnosticReportResource.java (1)
Service(52-136)
src/main/java/com/wipro/fhir/data/mongo/care_context/GenerateTokenAbdmResponses.java (4)
src/main/java/com/wipro/fhir/data/v3/careContext/AddCareContextRequest.java (1)
Data(5-20)src/main/java/com/wipro/fhir/data/v3/careContext/CareContexts.java (1)
Data(5-11)src/main/java/com/wipro/fhir/data/v3/careContext/GenerateCareContextTokenRequest.java (1)
Data(5-14)src/main/java/com/wipro/fhir/data/v3/careContext/LinkCareContextRequest.java (1)
Data(6-14)
src/main/java/com/wipro/fhir/service/bundle_creation/ImmunizationRecordResourceBundleImpl.java (8)
src/main/java/com/wipro/fhir/service/bundle_creation/DiagnosticRecordResourceBundleImpl.java (1)
Service(42-253)src/main/java/com/wipro/fhir/service/bundle_creation/OPConsultResourceBundleImpl.java (1)
Service(49-340)src/main/java/com/wipro/fhir/service/bundle_creation/PrescriptionResourceBundleImpl.java (1)
Service(43-228)src/main/java/com/wipro/fhir/service/common/CommonServiceImpl.java (1)
Service(94-742)src/main/java/com/wipro/fhir/service/resource_model/ImmunizationResource.java (1)
Service(22-103)src/main/java/com/wipro/fhir/service/resource_model/OrganizationResource.java (1)
Service(37-110)src/main/java/com/wipro/fhir/service/resource_model/PractitionerResource.java (1)
Service(43-142)src/main/java/com/wipro/fhir/service/resource_model/PatientResource.java (1)
Service(50-168)
src/main/java/com/wipro/fhir/service/bundle_creation/DischargeSummaryResourceBundleImpl.java (14)
src/main/java/com/wipro/fhir/service/resource_model/MedicalHistoryResource.java (1)
Service(19-73)src/main/java/com/wipro/fhir/service/bundle_creation/DiagnosticRecordResourceBundleImpl.java (1)
Service(42-253)src/main/java/com/wipro/fhir/service/bundle_creation/ImmunizationRecordResourceBundleImpl.java (1)
Service(38-236)src/main/java/com/wipro/fhir/service/bundle_creation/OPConsultResourceBundleImpl.java (1)
Service(49-340)src/main/java/com/wipro/fhir/service/bundle_creation/PrescriptionResourceBundleImpl.java (1)
Service(43-228)src/main/java/com/wipro/fhir/service/bundle_creation/WellnessRecordResourceBundleImpl.java (1)
Service(38-257)src/main/java/com/wipro/fhir/service/common/CommonServiceImpl.java (1)
Service(94-742)src/main/java/com/wipro/fhir/service/resource_model/EncounterResource.java (1)
Service(52-195)src/main/java/com/wipro/fhir/service/resource_model/ImmunizationResource.java (1)
Service(22-103)src/main/java/com/wipro/fhir/service/resource_model/MedicationRequestResource.java (1)
Service(52-168)src/main/java/com/wipro/fhir/service/resource_model/OrganizationResource.java (1)
Service(37-110)src/main/java/com/wipro/fhir/service/resource_model/PractitionerResource.java (1)
Service(43-142)src/main/java/com/wipro/fhir/service/resource_model/PatientResource.java (1)
Service(50-168)src/main/java/com/wipro/fhir/service/resource_model/DiagnosticReportResource.java (1)
Service(52-136)
src/main/java/com/wipro/fhir/data/v3/careContext/LinkCareContextRequest.java (6)
src/main/java/com/wipro/fhir/data/mongo/care_context/GenerateTokenAbdmResponses.java (1)
Data(14-39)src/main/java/com/wipro/fhir/data/v3/careContext/AddCareContextRequest.java (1)
Data(5-20)src/main/java/com/wipro/fhir/data/v3/careContext/CareContextLinkTokenRequest.java (1)
Data(5-15)src/main/java/com/wipro/fhir/data/v3/careContext/CareContexts.java (1)
Data(5-11)src/main/java/com/wipro/fhir/data/v3/careContext/GenerateCareContextTokenRequest.java (1)
Data(5-14)src/main/java/com/wipro/fhir/data/v3/careContext/PatientCareContext.java (1)
Data(6-16)
src/main/java/com/wipro/fhir/service/ndhm/Common_NDHMServiceImpl.java (1)
src/main/java/com/wipro/fhir/service/v3/careContext/CareContextLinkingServiceImpl.java (1)
Service(53-399)
src/main/java/com/wipro/fhir/data/v3/careContext/AddCareContextRequest.java (6)
src/main/java/com/wipro/fhir/data/mongo/care_context/GenerateTokenAbdmResponses.java (1)
Data(14-39)src/main/java/com/wipro/fhir/data/v3/careContext/CareContextLinkTokenRequest.java (1)
Data(5-15)src/main/java/com/wipro/fhir/data/v3/careContext/CareContexts.java (1)
Data(5-11)src/main/java/com/wipro/fhir/data/v3/careContext/GenerateCareContextTokenRequest.java (1)
Data(5-14)src/main/java/com/wipro/fhir/data/v3/careContext/LinkCareContextRequest.java (1)
Data(6-14)src/main/java/com/wipro/fhir/data/v3/careContext/PatientCareContext.java (1)
Data(6-16)
src/main/java/com/wipro/fhir/data/v3/careContext/CareContextLinkTokenRequest.java (5)
src/main/java/com/wipro/fhir/data/mongo/care_context/GenerateTokenAbdmResponses.java (1)
Data(14-39)src/main/java/com/wipro/fhir/data/v3/careContext/AddCareContextRequest.java (1)
Data(5-20)src/main/java/com/wipro/fhir/data/v3/careContext/CareContexts.java (1)
Data(5-11)src/main/java/com/wipro/fhir/data/v3/careContext/GenerateCareContextTokenRequest.java (1)
Data(5-14)src/main/java/com/wipro/fhir/data/v3/careContext/PatientCareContext.java (1)
Data(6-16)
πͺ GitHub Actions: Commit Compliance
src/main/environment/common_docker.properties
[error] 1-1: commitlint: subject may not be empty [subject-empty]. type may not be empty [type-empty].
| public OrganizationDataModel(Object[] objArr) throws FHIRException { | ||
|
|
||
| try { | ||
|
|
||
| this.benVisitID = objArr[0] != null ? Long.parseLong(objArr[0].toString()) : null; | ||
| this.serviceProviderID = objArr[1] != null ? Short.parseShort(objArr[1].toString()) : null; | ||
| this.serviceProviderName = objArr[2] != null ? objArr[2].toString() : null; | ||
|
|
||
| this.stateID = objArr[3] != null ? Integer.parseInt(objArr[3].toString()) : null; | ||
| this.stateName = objArr[4] != null ? objArr[4].toString() : null; | ||
|
|
||
| this.districtID = objArr[5] != null ? Integer.parseInt(objArr[5].toString()) : null; | ||
| this.districtName = objArr[6] != null ? objArr[6].toString() : null; | ||
|
|
||
| this.locationName = objArr[7] != null ? objArr[7].toString() : null; | ||
| this.address = objArr[8] != null ? objArr[8].toString() : null; | ||
|
|
||
| this.serviceID = objArr[9] != null ? Short.parseShort(objArr[9].toString()) : null; | ||
| this.serviceName = objArr[10] != null ? objArr[10].toString() : null; | ||
|
|
||
| this.isNational = objArr[11] != null | ||
| ? objArr[11].toString().equalsIgnoreCase("true") || objArr[11].toString().equals("1") | ||
| : null; | ||
|
|
||
| this.abdmFacilityId = objArr[12] != null ? objArr[12].toString() : null; | ||
| this.abdmFacilityName = objArr[13] != null ? objArr[13].toString() : null; | ||
|
|
||
| this.psAddMapID = objArr[14] != null ? Integer.parseInt(objArr[14].toString()) : null; | ||
| this.providerServiceMapID = objArr[15] != null ? Integer.parseInt(objArr[15].toString()) : null; | ||
|
|
||
| } catch (Exception e) { | ||
| throw new FHIRException("Organization resource failed with error - " + e.getMessage()); | ||
| } | ||
|
|
||
| } |
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.
π οΈ Refactor suggestion | π Major
Add array length validation to prevent ArrayIndexOutOfBoundsException.
The constructor accesses array indices 0-15 without first validating that objArr has sufficient length. This could lead to ArrayIndexOutOfBoundsException if the stored procedure returns fewer columns than expected.
π Proposed fix
public OrganizationDataModel(Object[] objArr) throws FHIRException {
try {
+ if (objArr == null || objArr.length < 16) {
+ throw new FHIRException("Invalid organization data array: expected at least 16 elements");
+ }
this.benVisitID = objArr[0] != null ? Long.parseLong(objArr[0].toString()) : null;π 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.
| public OrganizationDataModel(Object[] objArr) throws FHIRException { | |
| try { | |
| this.benVisitID = objArr[0] != null ? Long.parseLong(objArr[0].toString()) : null; | |
| this.serviceProviderID = objArr[1] != null ? Short.parseShort(objArr[1].toString()) : null; | |
| this.serviceProviderName = objArr[2] != null ? objArr[2].toString() : null; | |
| this.stateID = objArr[3] != null ? Integer.parseInt(objArr[3].toString()) : null; | |
| this.stateName = objArr[4] != null ? objArr[4].toString() : null; | |
| this.districtID = objArr[5] != null ? Integer.parseInt(objArr[5].toString()) : null; | |
| this.districtName = objArr[6] != null ? objArr[6].toString() : null; | |
| this.locationName = objArr[7] != null ? objArr[7].toString() : null; | |
| this.address = objArr[8] != null ? objArr[8].toString() : null; | |
| this.serviceID = objArr[9] != null ? Short.parseShort(objArr[9].toString()) : null; | |
| this.serviceName = objArr[10] != null ? objArr[10].toString() : null; | |
| this.isNational = objArr[11] != null | |
| ? objArr[11].toString().equalsIgnoreCase("true") || objArr[11].toString().equals("1") | |
| : null; | |
| this.abdmFacilityId = objArr[12] != null ? objArr[12].toString() : null; | |
| this.abdmFacilityName = objArr[13] != null ? objArr[13].toString() : null; | |
| this.psAddMapID = objArr[14] != null ? Integer.parseInt(objArr[14].toString()) : null; | |
| this.providerServiceMapID = objArr[15] != null ? Integer.parseInt(objArr[15].toString()) : null; | |
| } catch (Exception e) { | |
| throw new FHIRException("Organization resource failed with error - " + e.getMessage()); | |
| } | |
| } | |
| public OrganizationDataModel(Object[] objArr) throws FHIRException { | |
| try { | |
| if (objArr == null || objArr.length < 16) { | |
| throw new FHIRException("Invalid organization data array: expected at least 16 elements"); | |
| } | |
| this.benVisitID = objArr[0] != null ? Long.parseLong(objArr[0].toString()) : null; | |
| this.serviceProviderID = objArr[1] != null ? Short.parseShort(objArr[1].toString()) : null; | |
| this.serviceProviderName = objArr[2] != null ? objArr[2].toString() : null; | |
| this.stateID = objArr[3] != null ? Integer.parseInt(objArr[3].toString()) : null; | |
| this.stateName = objArr[4] != null ? objArr[4].toString() : null; | |
| this.districtID = objArr[5] != null ? Integer.parseInt(objArr[5].toString()) : null; | |
| this.districtName = objArr[6] != null ? objArr[6].toString() : null; | |
| this.locationName = objArr[7] != null ? objArr[7].toString() : null; | |
| this.address = objArr[8] != null ? objArr[8].toString() : null; | |
| this.serviceID = objArr[9] != null ? Short.parseShort(objArr[9].toString()) : null; | |
| this.serviceName = objArr[10] != null ? objArr[10].toString() : null; | |
| this.isNational = objArr[11] != null | |
| ? objArr[11].toString().equalsIgnoreCase("true") || objArr[11].toString().equals("1") | |
| : null; | |
| this.abdmFacilityId = objArr[12] != null ? objArr[12].toString() : null; | |
| this.abdmFacilityName = objArr[13] != null ? objArr[13].toString() : null; | |
| this.psAddMapID = objArr[14] != null ? Integer.parseInt(objArr[14].toString()) : null; | |
| this.providerServiceMapID = objArr[15] != null ? Integer.parseInt(objArr[15].toString()) : null; | |
| } catch (Exception e) { | |
| throw new FHIRException("Organization resource failed with error - " + e.getMessage()); | |
| } | |
| } |
π€ Prompt for AI Agents
In src/main/java/com/wipro/fhir/data/resource_model/OrganizationDataModel.java
around lines 43 to 77, the constructor reads objArr[0]..objArr[15] without
verifying objArr length which can cause ArrayIndexOutOfBoundsException; add a
guard that objArr is not null and objArr.length >= 16 before accessing indices,
and if the check fails either throw a clear FHIRException indicating
insufficient columns (including actual length) or set missing fields to null
based on expected behavior; implement the simplest fix consistent with project
error handling (validate length up-front and throw a descriptive FHIRException)
so subsequent index accesses are safe.
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.
@coderabbitai this is checked before calling this method, so not required here
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.
@helenKaryamsetty, understood! Thank you for clarifying that the array length validation is handled before calling the constructor. I've noted this pattern for future reviews.
βοΈ Learnings added
Learnt from: helenKaryamsetty
Repo: PSMRI/FHIR-API PR: 128
File: src/main/java/com/wipro/fhir/data/resource_model/OrganizationDataModel.java:43-77
Timestamp: 2025-12-30T10:16:44.915Z
Learning: In the FHIR-API project, data model constructors (such as OrganizationDataModel, PractitionerDataModel, MedicalHistoryDataModel, ImmunizationDataModel) that accept Object[] arrays have validation performed at the caller level before invoking the constructor. Array length validation is not required within these constructors.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
π§ Learnings used
Learnt from: helenKaryamsetty
Repo: PSMRI/FHIR-API PR: 46
File: src/main/java/com/wipro/fhir/data/mongo/care_context/SaveFacilityIdForVisit.java:7-8
Timestamp: 2024-11-20T07:41:40.038Z
Learning: In the `SaveFacilityIdForVisit` class (`src/main/java/com/wipro/fhir/data/mongo/care_context/SaveFacilityIdForVisit.java`), the handling of the MongoDB ID field and indexing is provided in another module and is not required in this class.
| public PractitionerDataModel(Object[] objArr) throws FHIRException { | ||
|
|
||
| try { | ||
|
|
||
| this.benVisitID = objArr[0] != null ? Integer.parseInt(objArr[0].toString()) : null; | ||
| this.userID = objArr[1] != null ? Integer.parseInt(objArr[1].toString()) : null; | ||
|
|
||
| this.fullName = objArr[2] != null ? objArr[2].toString() : null; | ||
|
|
||
| this.dob = objArr[3] != null ? (objArr[3] instanceof Date ? (Date) objArr[3] : null) : null; | ||
|
|
||
| this.employeeID = objArr[4] != null ? objArr[4].toString() : null; | ||
| this.contactNo = objArr[5] != null ? objArr[5].toString() : null; | ||
| this.emailID = objArr[6] != null ? objArr[6].toString() : null; | ||
| this.qualificationName = objArr[7] != null ? objArr[7].toString() : null; | ||
| this.designationName = objArr[8] != null ? objArr[8].toString() : null; | ||
| this.genderName = objArr[9] != null ? objArr[9].toString() : null; | ||
|
|
||
| this.genderID = objArr[10] != null ? Integer.parseInt(objArr[10].toString()) : null; | ||
| this.serviceProviderID = objArr[11] != null ? Integer.parseInt(objArr[11].toString()) : null; | ||
|
|
||
| this.visitCode = objArr[12] != null ? Long.parseLong(objArr[12].toString()) : null; | ||
|
|
||
| this.createdBy = objArr[13] != null ? objArr[13].toString() : null; | ||
|
|
||
| this.createdDate = objArr[14] != null ? (objArr[14] instanceof Timestamp ? (Timestamp) objArr[14] : null) | ||
| : null; | ||
| } catch (Exception e) { | ||
| throw new FHIRException("Practitioner resource failed with error - " + e.getMessage()); | ||
| } | ||
|
|
||
| } |
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.
π οΈ Refactor suggestion | π Major
Add array length validation to prevent ArrayIndexOutOfBoundsException.
The constructor accesses array indices 0-14 without validating that objArr has sufficient length. Add a length check at the beginning to fail fast with a clear error message if the array is too short.
π Proposed fix
public PractitionerDataModel(Object[] objArr) throws FHIRException {
try {
+ if (objArr == null || objArr.length < 15) {
+ throw new FHIRException("Invalid practitioner data array: expected at least 15 elements");
+ }
this.benVisitID = objArr[0] != null ? Integer.parseInt(objArr[0].toString()) : null;π€ Prompt for AI Agents
In src/main/java/com/wipro/fhir/data/resource_model/PractitionerDataModel.java
around lines 42 to 73, the constructor reads indices 0β14 from objArr without
validating the array length; add a defensive check at the start: verify objArr
is not null and objArr.length >= 15 and if not throw a FHIRException with a
clear message like "PractitionerDataModel expects an Object[] of length >=15,
got X" so the method fails fast and avoids ArrayIndexOutOfBoundsException; keep
the existing try/catch for parsing errors after this initial validation.
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.
@coderabbitai this was checked in previous method, so not required here
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.
π§© Analysis chain
π Script executed:
#!/bin/bash
# Check the full PractitionerDataModel class to see if there's a getPractitioner factory method
cat src/main/java/com/wipro/fhir/data/resource_model/PractitionerDataModel.java
Length of output: 2451
π Script executed:
#!/bin/bash
# Search for all places where PractitionerDataModel constructor is called
rg -n "new PractitionerDataModel" --type java -C 5
Length of output: 925
π Script executed:
#!/bin/bash
# Check similar data model classes for validation patterns
cat src/main/java/com/wipro/fhir/data/resource_model/OrganizationDataModel.java
Length of output: 2597
π Script executed:
#!/bin/bash
# Check MedicalHistoryDataModel for similar patterns
cat src/main/java/com/wipro/fhir/data/resource_model/MedicalHistoryDataModel.java
Length of output: 1910
@helenKaryamsetty, you're right that the getPractitioner(Object[] resultSet) method validates the array before calling the constructor. I can see it checks for null and empty arrays at line 77-78 before instantiating the object.
That said, the current validation only checks resultSet.length == 0, not whether it has at least 15 elements, so arrays with length 1-14 would still cause an ArrayIndexOutOfBoundsException. But if the stored procedure always returns the expected column count, this shouldn't be an issue in practice.
I understand your design decision to keep the validation at the factory method level. Thanks for the clarification!
| public interface CareContextRepo extends CrudRepository<PatientEligibleForResourceCreation, BigInteger> { | ||
|
|
||
| @Query(value="SELECT COUNT(*) FROM t_phy_vitals WHERE VisitCode = :visitCode", nativeQuery = true) | ||
| public int hasPhyVitals(String visitCode); | ||
|
|
||
| @Query(value="SELECT COUNT(*) FROM t_prescribeddrug WHERE VisitCode = :visitCode", nativeQuery = true) | ||
| public int hasPrescribedDrugs(String visitCode); | ||
|
|
||
| @Query(value="SELECT COUNT(*) FROM t_lab_testorder WHERE VisitCode = :visitCode", nativeQuery = true) | ||
| public int hasLabtestsDone(String visitCode); | ||
|
|
||
| @Query(value="SELECT COUNT(*) FROM t_childvaccinedetail1 WHERE VisitCode = :visitCode", nativeQuery = true) | ||
| public int hasVaccineDetails(String visitCode); | ||
|
|
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.
Missing @Param annotations will cause runtime failures.
The native query methods use named parameters (:visitCode) but the method parameters lack the @Param annotation. Spring Data JPA requires explicit @Param bindings for named parameters in native queries; otherwise, a runtime exception will occur.
π Proposed fix to add @param annotations
package com.wipro.fhir.repo.v3.careContext;
import java.math.BigInteger;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.repository.query.Param;
import com.wipro.fhir.data.request_handler.PatientEligibleForResourceCreation;
public interface CareContextRepo extends CrudRepository<PatientEligibleForResourceCreation, BigInteger> {
@Query(value="SELECT COUNT(*) FROM t_phy_vitals WHERE VisitCode = :visitCode", nativeQuery = true)
- public int hasPhyVitals(String visitCode);
+ public int hasPhyVitals(@Param("visitCode") String visitCode);
@Query(value="SELECT COUNT(*) FROM t_prescribeddrug WHERE VisitCode = :visitCode", nativeQuery = true)
- public int hasPrescribedDrugs(String visitCode);
+ public int hasPrescribedDrugs(@Param("visitCode") String visitCode);
@Query(value="SELECT COUNT(*) FROM t_lab_testorder WHERE VisitCode = :visitCode", nativeQuery = true)
- public int hasLabtestsDone(String visitCode);
+ public int hasLabtestsDone(@Param("visitCode") String visitCode);
@Query(value="SELECT COUNT(*) FROM t_childvaccinedetail1 WHERE VisitCode = :visitCode", nativeQuery = true)
- public int hasVaccineDetails(String visitCode);
+ public int hasVaccineDetails(@Param("visitCode") String visitCode);
}π€ Prompt for AI Agents
In src/main/java/com/wipro/fhir/repo/v3/careContext/CareContextRepo.java around
lines 10 to 23, the native query methods declare named parameter :visitCode but
the method parameters are missing @Param bindings which will fail at runtime;
fix each method by annotating the visitCode parameter with @Param("visitCode")
(and add the import org.springframework.data.repository.query.Param if not
present) so Spring Data JPA can bind the named parameter for hasPhyVitals,
hasPrescribedDrugs, hasLabtestsDone, and hasVaccineDetails.
| Composition PopulateDischargeSummaryComposition(ResourceRequestHandler resourceRequestHandler, | ||
| PatientEligibleForResourceCreation p, Practitioner practitioner, Organization organization, Patient patient, | ||
| Encounter encounter, List<Condition> chiefComplaints, List<Condition> physicalExam, | ||
| List<AllergyIntolerance> allergyList, FamilyMemberHistory familyMemberHistory, | ||
| List<MedicationStatement> pastMedicalHistoryConditions, List<MedicationRequest> medicationRequests, | ||
| List<DiagnosticReport> procedures); | ||
|
|
||
| String PopulateDischargeSummaryResourceBundle(ResourceRequestHandler resourceRequestHandler, | ||
| PatientEligibleForResourceCreation p) throws FHIRException; |
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.
π οΈ Refactor suggestion | π Major
Method names should follow camelCase convention.
Java convention is to start method names with a lowercase letter. PopulateDischargeSummaryComposition and PopulateDischargeSummaryResourceBundle should be populateDischargeSummaryComposition and populateDischargeSummaryResourceBundle.
Suggested fix
- Composition PopulateDischargeSummaryComposition(ResourceRequestHandler resourceRequestHandler,
+ Composition populateDischargeSummaryComposition(ResourceRequestHandler resourceRequestHandler,
PatientEligibleForResourceCreation p, Practitioner practitioner, Organization organization, Patient patient,
Encounter encounter, List<Condition> chiefComplaints, List<Condition> physicalExam,
List<AllergyIntolerance> allergyList, FamilyMemberHistory familyMemberHistory,
List<MedicationStatement> pastMedicalHistoryConditions, List<MedicationRequest> medicationRequests,
List<DiagnosticReport> procedures);
- String PopulateDischargeSummaryResourceBundle(ResourceRequestHandler resourceRequestHandler,
+ String populateDischargeSummaryResourceBundle(ResourceRequestHandler resourceRequestHandler,
PatientEligibleForResourceCreation p) throws FHIRException;π 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.
| Composition PopulateDischargeSummaryComposition(ResourceRequestHandler resourceRequestHandler, | |
| PatientEligibleForResourceCreation p, Practitioner practitioner, Organization organization, Patient patient, | |
| Encounter encounter, List<Condition> chiefComplaints, List<Condition> physicalExam, | |
| List<AllergyIntolerance> allergyList, FamilyMemberHistory familyMemberHistory, | |
| List<MedicationStatement> pastMedicalHistoryConditions, List<MedicationRequest> medicationRequests, | |
| List<DiagnosticReport> procedures); | |
| String PopulateDischargeSummaryResourceBundle(ResourceRequestHandler resourceRequestHandler, | |
| PatientEligibleForResourceCreation p) throws FHIRException; | |
| Composition populateDischargeSummaryComposition(ResourceRequestHandler resourceRequestHandler, | |
| PatientEligibleForResourceCreation p, Practitioner practitioner, Organization organization, Patient patient, | |
| Encounter encounter, List<Condition> chiefComplaints, List<Condition> physicalExam, | |
| List<AllergyIntolerance> allergyList, FamilyMemberHistory familyMemberHistory, | |
| List<MedicationStatement> pastMedicalHistoryConditions, List<MedicationRequest> medicationRequests, | |
| List<DiagnosticReport> procedures); | |
| String populateDischargeSummaryResourceBundle(ResourceRequestHandler resourceRequestHandler, | |
| PatientEligibleForResourceCreation p) throws FHIRException; |
π€ Prompt for AI Agents
In
src/main/java/com/wipro/fhir/service/bundle_creation/DischargeSummaryResourceBundle.java
around lines 26 to 34, the two method declarations use PascalCase names
(`PopulateDischargeSummaryComposition`,
`PopulateDischargeSummaryResourceBundle`) instead of Java camelCase; rename them
to `populateDischargeSummaryComposition` and
`populateDischargeSummaryResourceBundle` (update declaration and any
references/implementations) and ensure method calls, overrides, and implementing
classes/interfaces are updated to match the new names and compile.
src/main/java/com/wipro/fhir/service/resource_model/MedicalHistoryResource.java
Show resolved
Hide resolved
| if (null != careContextLinkRequest.getAbdmFacilityId() | ||
| && "" != careContextLinkRequest.getAbdmFacilityId()) { | ||
| headers.add("X-HIP-ID", careContextLinkRequest.getAbdmFacilityId()); | ||
| } else { | ||
| headers.add("X-HIP-ID", abdmFacilityId); | ||
| } |
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.
Critical: String comparison using != instead of !equals().
Lines 115 and 248 use "" != string for string comparison, which compares object references rather than values. This will almost always evaluate to true even for empty strings, causing the condition to incorrectly pass.
π Proposed fix
- if (null != careContextLinkRequest.getAbdmFacilityId()
- && "" != careContextLinkRequest.getAbdmFacilityId()) {
+ if (null != careContextLinkRequest.getAbdmFacilityId()
+ && !careContextLinkRequest.getAbdmFacilityId().isEmpty()) {π 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.
| if (null != careContextLinkRequest.getAbdmFacilityId() | |
| && "" != careContextLinkRequest.getAbdmFacilityId()) { | |
| headers.add("X-HIP-ID", careContextLinkRequest.getAbdmFacilityId()); | |
| } else { | |
| headers.add("X-HIP-ID", abdmFacilityId); | |
| } | |
| if (null != careContextLinkRequest.getAbdmFacilityId() | |
| && !careContextLinkRequest.getAbdmFacilityId().isEmpty()) { | |
| headers.add("X-HIP-ID", careContextLinkRequest.getAbdmFacilityId()); | |
| } else { | |
| headers.add("X-HIP-ID", abdmFacilityId); | |
| } |
π€ Prompt for AI Agents
In
src/main/java/com/wipro/fhir/service/v3/careContext/CareContextLinkingServiceImpl.java
around lines 114-119 (and the other occurrence at ~248), the code uses reference
comparison ("" != string) which is incorrect; change the checks to a proper
value check such as: ensure the string is not null and not empty using either
!careContextLinkRequest.getAbdmFacilityId().isEmpty() or
!careContextLinkRequest.getAbdmFacilityId().equals("") (or use
StringUtils.isNotBlank/getAbdmFacilityId() != null &&
!getAbdmFacilityId().isBlank() for Java 11+), and apply the same fix at the
other occurrence to correctly choose between
careContextLinkRequest.getAbdmFacilityId() and abdmFacilityId.
| if (null != careContextLinkRequest.getAbhaNumber() && "" != careContextLinkRequest.getAbhaNumber()) { | ||
| String abha = careContextLinkRequest.getAbhaNumber(); | ||
| String abhaNumber = abha.replace("-", ""); | ||
| generateTokenRequest.setAbhaNumber(abhaNumber); | ||
| } |
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.
Same string comparison issue with !=.
Line 122 has the same problem: "" != careContextLinkRequest.getAbhaNumber() should use !string.isEmpty() or !string.equals("").
π Proposed fix
- if (null != careContextLinkRequest.getAbhaNumber() && "" != careContextLinkRequest.getAbhaNumber()) {
+ if (null != careContextLinkRequest.getAbhaNumber() && !careContextLinkRequest.getAbhaNumber().isEmpty()) {π 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.
| if (null != careContextLinkRequest.getAbhaNumber() && "" != careContextLinkRequest.getAbhaNumber()) { | |
| String abha = careContextLinkRequest.getAbhaNumber(); | |
| String abhaNumber = abha.replace("-", ""); | |
| generateTokenRequest.setAbhaNumber(abhaNumber); | |
| } | |
| if (null != careContextLinkRequest.getAbhaNumber() && !careContextLinkRequest.getAbhaNumber().isEmpty()) { | |
| String abha = careContextLinkRequest.getAbhaNumber(); | |
| String abhaNumber = abha.replace("-", ""); | |
| generateTokenRequest.setAbhaNumber(abhaNumber); | |
| } |
π€ Prompt for AI Agents
In
src/main/java/com/wipro/fhir/service/v3/careContext/CareContextLinkingServiceImpl.java
around lines 122 to 126, the code uses the incorrect string comparison "" !=
careContextLinkRequest.getAbhaNumber(); update the condition to properly check
for non-null and non-empty string (e.g., careContextLinkRequest.getAbhaNumber()
!= null && !careContextLinkRequest.getAbhaNumber().isEmpty() or use
!careContextLinkRequest.getAbhaNumber().trim().isEmpty() if trimming is
desired), keeping the null check first, then extract and replace hyphens as
before and set generateTokenRequest.setAbhaNumber(abhaNumber).
| if (null != addCareContextRequest.getAbdmFacilityId() | ||
| && "" != addCareContextRequest.getAbdmFacilityId()) { | ||
| headers.add("X-HIP-ID", addCareContextRequest.getAbdmFacilityId()); | ||
| } else { | ||
| headers.add("X-HIP-ID", abdmFacilityId); | ||
| } |
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.
Same string comparison issue repeated.
π Proposed fix
- if (null != addCareContextRequest.getAbdmFacilityId()
- && "" != addCareContextRequest.getAbdmFacilityId()) {
+ if (null != addCareContextRequest.getAbdmFacilityId()
+ && !addCareContextRequest.getAbdmFacilityId().isEmpty()) {π 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.
| if (null != addCareContextRequest.getAbdmFacilityId() | |
| && "" != addCareContextRequest.getAbdmFacilityId()) { | |
| headers.add("X-HIP-ID", addCareContextRequest.getAbdmFacilityId()); | |
| } else { | |
| headers.add("X-HIP-ID", abdmFacilityId); | |
| } | |
| if (null != addCareContextRequest.getAbdmFacilityId() | |
| && !addCareContextRequest.getAbdmFacilityId().isEmpty()) { | |
| headers.add("X-HIP-ID", addCareContextRequest.getAbdmFacilityId()); | |
| } else { | |
| headers.add("X-HIP-ID", abdmFacilityId); | |
| } |
π€ Prompt for AI Agents
In
src/main/java/com/wipro/fhir/service/v3/careContext/CareContextLinkingServiceImpl.java
around lines 247 to 252, the code uses "" !=
addCareContextRequest.getAbdmFacilityId() to check for an empty string which is
an incorrect reference comparison; replace this with a proper emptiness check
such as addCareContextRequest.getAbdmFacilityId() != null &&
!addCareContextRequest.getAbdmFacilityId().isEmpty() (or use
StringUtils.hasText/addAbdmFacilityId().isBlank() depending on project
conventions) so the header selection uses a correct null/empty check and avoids
incorrect string comparison.
| if (null != addCareContextRequest.getAbhaNumber() && "" != addCareContextRequest.getAbhaNumber()) { | ||
| String abha = addCareContextRequest.getAbhaNumber(); | ||
| String abhaNumber = abha.replace("-", ""); | ||
| linkCareContextRequest.setAbhaNumber(abhaNumber); | ||
| } |
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.
Same string comparison issue repeated.
π Proposed fix
- if (null != addCareContextRequest.getAbhaNumber() && "" != addCareContextRequest.getAbhaNumber()) {
+ if (null != addCareContextRequest.getAbhaNumber() && !addCareContextRequest.getAbhaNumber().isEmpty()) {π 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.
| if (null != addCareContextRequest.getAbhaNumber() && "" != addCareContextRequest.getAbhaNumber()) { | |
| String abha = addCareContextRequest.getAbhaNumber(); | |
| String abhaNumber = abha.replace("-", ""); | |
| linkCareContextRequest.setAbhaNumber(abhaNumber); | |
| } | |
| if (null != addCareContextRequest.getAbhaNumber() && !addCareContextRequest.getAbhaNumber().isEmpty()) { | |
| String abha = addCareContextRequest.getAbhaNumber(); | |
| String abhaNumber = abha.replace("-", ""); | |
| linkCareContextRequest.setAbhaNumber(abhaNumber); | |
| } |
π€ Prompt for AI Agents
In
src/main/java/com/wipro/fhir/service/v3/careContext/CareContextLinkingServiceImpl.java
around lines 278 to 282, the code uses an incorrect string comparison ("" !=
addCareContextRequest.getAbhaNumber()); replace this with a proper check such as
retrieving the value into a local String, trimming it, and using !abha.isEmpty()
or !abha.isBlank() (or StringUtils.isNotBlank(abha) if the project uses Apache
Commons) before removing dashes and setting
linkCareContextRequest.setAbhaNumber(abhaNumber); ensure null check remains and
avoid using ==/!= for string content comparison.
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes * feat: mongo query change fetch for linktoken * fix: link carecontext authorization error * feat: hiTypes addition * feat: version change for testing * fix: minor change for empty response * Simplify queries in CareContextRepo interface Removed unnecessary 'order by 1 desc' clause from queries. * fix: corrected response format * fix: minor logic change for care context linking * small correction in hiType and error message modification * modified error message * feat: new standard FHIR bundles creation * Fix environment variable for systemUrl * Fix formatting of systemUrl property * fix: taken coderabbitai comments and minor changes * fix: changed missed variable * fix: modified the constructor * Change exception message for Organization resource * Fix typo in exception message for PractitionerDataModel * fix: corrected type error * fix: correct medication histoory model class * fix: taken coderabbitai comments --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com>
|


π Description
JIRA ID: AMM-1856, AMM-1885, AMM-1886, AMM-1884, AMM-1803
Merging abdmV3 to 3.6.1 for release
β Type of Change
βΉοΈ 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
Release Notes v3.6.1
New Features
Improvements
βοΈ Tip: You can customize this high-level summary in your review settings.