Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Abdm facility and version 3 changes #52

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

helenKaryamsetty
Copy link
Member

@helenKaryamsetty helenKaryamsetty commented Dec 16, 2024

πŸ“‹ Description

JIRA ID: AMM-854, 1017,1016

Please provide a summary of the change and the motivation behind it. Include relevant context and details.


βœ… Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • πŸ”₯ Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • πŸ›  Refactor (change that is neither a fix nor a new feature)
  • βš™οΈ Config change (configuration file or build script updates)
  • πŸ“š Documentation (updates to docs or readme)
  • πŸ§ͺ Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • πŸš€ Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ Additional Information

Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced functionality for managing health facilities linked to patient visits.
    • Improved user interface localization for ABHA-related processes in Assamese, English, and Hindi.
  • Bug Fixes

    • Clarified button actions in the dialog component to enhance user experience.
  • Chores

    • Updated environment configurations to reflect changes in ABHA extension settings.

Copy link

coderabbitai bot commented Dec 16, 2024

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

πŸ”§ eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm warn config production Use --omit=dev instead.
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @angular/[email protected]
npm error Found: @angular/[email protected]
npm error node_modules/@angular/core
npm error dev @angular/core@"^16.2.0" from the root project
npm error peer @angular/core@"16.2.12" from @angular/[email protected]
npm error node_modules/@angular/animations
npm error dev @angular/animations@"^16.2.0" from the root project
npm error peer @angular/animations@"^16.0.0 || ^17.0.0" from @angular/[email protected]
npm error node_modules/@angular/material
npm error dev @angular/material@"^16.2.12" from the root project
npm error 1 more (@angular/platform-browser)
npm error 10 more (@angular/cdk, @angular/common, @angular/compiler, ...)
npm error
npm error Could not resolve dependency:
npm error peer @angular/core@"^18.0.0 || ^19.0.0" from @angular/[email protected]
npm error node_modules/@angular/material-moment-adapter
npm error dev @angular/material-moment-adapter@"^18.0.6" from the root project
npm error
npm error Conflicting peer dependency: @angular/[email protected]
npm error node_modules/@angular/core
npm error peer @angular/core@"^18.0.0 || ^19.0.0" from @angular/[email protected]
npm error node_modules/@angular/material-moment-adapter
npm error dev @angular/material-moment-adapter@"^18.0.6" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /root/.npm/_logs/2024-12-16T11_16_05_518Z-eresolve-report.txt
npm error A complete log of this run can be found in: /root/.npm/_logs/2024-12-16T11_16_05_518Z-debug-0.log

Walkthrough

This pull request introduces updates to multiple files across the application, focusing on ABHA (Ayushman Bharat Health Account) functionality. The changes include modifications to the WorkareaComponent, environment configurations, localization files, and module dependencies. The primary focus is on enhancing health ID-related features, updating ABHA extension configurations, and improving multilingual support for user interactions related to health account management.

Changes

File Change Summary
src/app/app-modules/nurse-doctor/workarea/workarea.component.ts Added new methods getMappedAbdmFacility() and saveAbdmFacilityForVisit(), introduced abdmFacilityId and abdmFacilityName properties
src/app/app.module.ts Replaced RegistrarModule with RegistrationModule, added RegistrarService to providers
src/assets/*.json (Assamese, English, Hindi) Added multiple localization keys for ABHA-related interactions and messages
src/environments/*.ts Updated abhaExtension from @abdm to @sbx across development environment files
src/app/app-modules/core/components/common-dialog/common-dialog.component.html Modified button event binding in alert section to explicitly close dialog

Sequence Diagram

sequenceDiagram
    participant User
    participant WorkareaComponent
    participant RegistrarService
    
    User->>WorkareaComponent: Initiate Health ID Retrieval
    WorkareaComponent->>RegistrarService: Get Mapped ABDM Facility
    RegistrarService-->>WorkareaComponent: Return Facility Details
    WorkareaComponent->>WorkareaComponent: Save Facility for Visit
    WorkareaComponent->>WorkareaComponent: Retrieve Health ID Details
Loading

Suggested Reviewers

  • drtechie
  • ravishanigarapu

Poem

🐰 A Rabbit's ABHA Tale πŸ₯

In code's green warren, changes hop along,
ABHA's journey, precise and strong.
Extensions shift, from @abdm to @sbx,
Multilingual magic, our system now flexes!
Hippity-hop, health records take flight! πŸš€

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❀️ Share
πŸͺ§ Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (6)
src/app/app-modules/nurse-doctor/workarea/workarea.component.ts (3)

3255-3255: Remove unnecessary console.log statements.

Avoid using console.log in production code. Consider removing it or using a proper logging mechanism.

Apply this diff:

-    console.log('workLocationId', workLocationId);

3266-3270: Use appropriate method for displaying error messages.

Using confirmationService.confirm() for error messages may confuse users. Consider using confirmationService.alert() to display errors.

Apply this diff:

-          this.confirmationService.confirm(res.errorMessage, 'info');
+          this.confirmationService.alert(res.errorMessage, 'error');

3287-3287: Remove unnecessary console.log statements.

Avoid using console.log in production code. Consider removing it or using a proper logging mechanism.

Apply this diff:

-        console.log('Abdm saved successfully');
src/app/app.module.ts (1)

34-35: Avoid redundant provider declaration for RegistrarService.

If RegistrarService is already provided by RegistrationModule, it doesn't need to be added separately to the providers array in AppModule. This prevents potential duplication and ensures a single instance of the service.

src/app/app-modules/core/components/common-dialog/common-dialog.component.html (1)

51-56: Remove redundant event binding on the button.

Using both (click)="dialogRef.close(true)" and mat-dialog-close is redundant. Since you're already handling the click event to close the dialog and pass a value, you can remove mat-dialog-close.

Apply this diff:

<button
  class="full-width-login button-ok"
  (click)="dialogRef.close(true)"
- mat-dialog-close
  cdkFocusInitial
>
src/assets/English.json (1)

1722-1737: Consider improving message clarity and consistency.

  1. Inconsistent message formatting:
  • "ABHA Search Mode*" has an asterisk while other similar keys don't
  • Inconsistent capitalization in "Please Enter" vs "Please enter"
  1. Unclear messages:
  • "Issue in printing ABHA Card" could be more specific about the error

Consider these improvements:

-        "abhaSearchMode": "ABHA Search Mode*",
+        "abhaSearchMode": "ABHA Search Mode",
-        "enterCorrectAuthIdForAuthMode": "Please Enter correct Authentication ID for choosen AuthMode",
+        "enterCorrectAuthIdForAuthMode": "Please enter correct Authentication ID for chosen Auth Mode",
-        "issueInAbhaCard": "Issue in printing ABHA Card",
+        "issueInAbhaCard": "Unable to print ABHA Card. Please try again.",
πŸ“œ Review details

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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 027fefd and 21f28b5.

πŸ“’ Files selected for processing (10)
  • Common-UI (1 hunks)
  • src/app/app-modules/core/components/common-dialog/common-dialog.component.html (1 hunks)
  • src/app/app-modules/nurse-doctor/workarea/workarea.component.ts (4 hunks)
  • src/app/app.module.ts (3 hunks)
  • src/assets/Assamese.json (1 hunks)
  • src/assets/English.json (1 hunks)
  • src/assets/Hindi.json (1 hunks)
  • src/environments/environment.dev.ts (1 hunks)
  • src/environments/environment.development.ts (1 hunks)
  • src/environments/environment.ts (1 hunks)
βœ… Files skipped from review due to trivial changes (1)
  • Common-UI
πŸ”‡ Additional comments (5)
src/app/app-modules/nurse-doctor/workarea/workarea.component.ts (2)

61-61: Import RegistrarService for ABDM facility mapping.

The import of RegistrarService is necessary for fetching the mapped ABDM facility details.


3272-3275: Verify the necessity of calling saveAbdmFacilityForVisit() after errors.

saveAbdmFacilityForVisit() is called even when there is an error in fetching the mapped ABDM facility. Please verify if this is the intended behavior, as it might attempt to save a null abdmFacilityId.

src/environments/environment.ts (1)

72-72: Update 'abhaExtension' value for correct configuration.

The change from @abdm to @sbx reflects the updated configuration. Ensure this value matches the required environment setup.

src/environments/environment.development.ts (1)

69-69: LGTM! Configuration is consistent

The ABHA extension change to @sbx is consistent with the dev environment configuration.

src/assets/Assamese.json (1)

1715-1730: LGTM! Translations are consistent with English counterparts.

The new ABHA-related translations maintain proper context and follow the established localization patterns.

Comment on lines +181 to +182
abdmFacilityId = null;
abdmFacilityName = null;
Copy link

@coderabbitai coderabbitai bot Dec 16, 2024

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

Add type annotations to class properties.

Please specify the types for abdmFacilityId and abdmFacilityName to enhance type safety and code readability.

Apply this diff to add type annotations:

-  abdmFacilityId = null;
-  abdmFacilityName = null;
+  abdmFacilityId: string | null = null;
+  abdmFacilityName: string | null = 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.

Suggested change
abdmFacilityId = null;
abdmFacilityName = null;
abdmFacilityId: string | null = null;
abdmFacilityName: string | null = null;

Copy link
Member Author

Choose a reason for hiding this comment

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

Its maintained like that all over the project. hence following the same

Copy link

Choose a reason for hiding this comment

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

@helenKaryamsetty, understood. Maintaining consistency with the existing codebase is important. Thank you for the clarification.


✏️ Learnings added
Learnt from: helenKaryamsetty
PR: PSMRI/TM-UI#52
File: src/app/app-modules/nurse-doctor/workarea/workarea.component.ts:181-182
Timestamp: 2024-12-16T11:12:21.288Z
Learning: In the `src/app/app-modules/nurse-doctor/workarea/workarea.component.ts` file, and throughout the Angular project, class properties are declared without explicit type annotations to maintain consistency.

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.

Comment on lines +3244 to +3255
getMappedAbdmFacility() {
const locationData: any = localStorage.getItem('loginDataResponse');
const jsonLoccationData = JSON.parse(locationData);
let workLocationId: any;
if (jsonLoccationData?.previlegeObj[0]?.roles) {
const roles = jsonLoccationData?.previlegeObj[0]?.roles;
roles.find((item: any) => {
item.RoleName.toLowerCase() === 'doctor';
workLocationId = item.workingLocationID;
});
}
console.log('workLocationId', workLocationId);
Copy link

@coderabbitai coderabbitai bot Dec 16, 2024

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix logical error in roles.find() callback function.

The callback function in roles.find() does not return a boolean value, which means the find method will not work as expected. Additionally, there are typos in variable names.

Apply this diff to correct the issue:

-    const jsonLoccationData = JSON.parse(locationData);
+    const jsonLocationData = JSON.parse(locationData);

-    if (jsonLoccationData?.previlegeObj[0]?.roles) {
-      const roles = jsonLoccationData?.previlegeObj[0]?.roles;
+    if (jsonLocationData?.privilegeObj[0]?.roles) {
+      const roles = jsonLocationData?.privilegeObj[0]?.roles;

-      roles.find((item: any) => {
-        item.RoleName.toLowerCase() === 'doctor';
-        workLocationId = item.workingLocationID;
-      });
+      const doctorRole = roles.find((item: any) => item.RoleName.toLowerCase() === 'doctor');
+      if (doctorRole) {
+        workLocationId = doctorRole.workingLocationID;
+      }
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
getMappedAbdmFacility() {
const locationData: any = localStorage.getItem('loginDataResponse');
const jsonLoccationData = JSON.parse(locationData);
let workLocationId: any;
if (jsonLoccationData?.previlegeObj[0]?.roles) {
const roles = jsonLoccationData?.previlegeObj[0]?.roles;
roles.find((item: any) => {
item.RoleName.toLowerCase() === 'doctor';
workLocationId = item.workingLocationID;
});
}
console.log('workLocationId', workLocationId);
getMappedAbdmFacility() {
const locationData: any = localStorage.getItem('loginDataResponse');
const jsonLocationData = JSON.parse(locationData);
let workLocationId: any;
if (jsonLocationData?.privilegeObj[0]?.roles) {
const roles = jsonLocationData?.privilegeObj[0]?.roles;
const doctorRole = roles.find((item: any) => item.RoleName.toLowerCase() === 'doctor');
if (doctorRole) {
workLocationId = doctorRole.workingLocationID;
}
}
console.log('workLocationId', workLocationId);

Copy link
Member Author

Choose a reason for hiding this comment

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

I dont need a booelan keyword but data is needed and i want to use find() method only for my code purpose

Copy link

Choose a reason for hiding this comment

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

@helenKaryamsetty, understood. If you prefer using the find() method in this way for your code, that's perfectly fine. Let me know if there's anything else I can assist with.


✏️ Learnings added
Learnt from: helenKaryamsetty
PR: PSMRI/TM-UI#52
File: src/app/app-modules/nurse-doctor/workarea/workarea.component.ts:3244-3255
Timestamp: 2024-12-16T11:11:54.647Z
Learning: In `src/app/app-modules/nurse-doctor/workarea/workarea.component.ts`, the developer prefers to use the `find()` method without explicitly returning a boolean in the callback function.

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.

@@ -66,7 +66,7 @@ export const environment = {
RBSTest: `RBS Test`,
visualAcuityTest: `Visual Acuity Test`,
haemoglobinTest: `Haemoglobin Test`,
abhaExtension: `@abdm`,
abhaExtension: `@sbx`,
Copy link

@coderabbitai coderabbitai bot Dec 16, 2024

Choose a reason for hiding this comment

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

πŸ’‘ Codebase verification

Inconsistent ABHA extension configuration detected across environments

The ABHA extension configuration shows a mix of values:

  • Development environments (dev, development, base) use @sbx
  • Production, test, and CI environments use @abdm

This inconsistency might be intentional as it separates sandbox (@sbx) for development from production (@abdm), but the test environment using @abdm instead of @sbx seems unusual for a testing setup.

  • src/environments/environment.test.ts: Consider changing @abdm to @sbx to maintain consistency with other non-production environments
  • src/environments/environment.ci.ts.template: Consider changing @abdm to @sbx if CI environment is used for testing
πŸ”— Analysis chain

Verify the ABHA extension configuration change

The ABHA extension has been changed from @abdm to @sbx. This appears to be switching from production to sandbox environment.

Let's verify if this change is consistent across all environment files and check for any related configuration:


Let's check the actual values of abhaExtension across these environment files to ensure consistency.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check ABHA extension configuration across environment files
# Expected: Consistent @sbx configuration in all environment files

echo "Checking ABHA extension configuration across environment files..."
rg -l "abhaExtension.*@(abdm|sbx)" src/environments/

Length of output: 425


Script:

#!/bin/bash
# Check the actual values of abhaExtension across environment files
echo "Content of abhaExtension in environment files:"
rg "abhaExtension.*@(abdm|sbx)" src/environments/

Length of output: 537

Copy link
Member Author

Choose a reason for hiding this comment

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

@coderabbitai i have added those values based on environments... in dev environment it is sbx and prod environment it is abdm

Copy link

Choose a reason for hiding this comment

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

@helenKaryamsetty, thank you for the clarification. I'll note that you've intentionally set abhaExtension to @sbx in development environments and @abdm in production environments to differentiate between them.


✏️ Learnings added
Learnt from: helenKaryamsetty
PR: PSMRI/TM-UI#52
File: src/environments/environment.dev.ts:69-69
Timestamp: 2024-12-16T11:10:14.588Z
Learning: In the `environment` files of the project, the `abhaExtension` configuration is intentionally set to `@sbx` in development environments (e.g., `src/environments/environment.dev.ts`, `src/environments/environment.development.ts`) and to `@abdm` in production environments (e.g., `src/environments/environment.prod.ts`). This setup differentiates between sandbox and production environments.

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.

src/assets/Hindi.json Show resolved Hide resolved
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required β‰₯ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

πŸ“œ Review details

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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 21f28b5 and 86bd579.

πŸ“’ Files selected for processing (1)
  • src/app/app-modules/nurse-doctor/workarea/workarea.component.ts (4 hunks)
πŸ”‡ Additional comments (3)
src/app/app-modules/nurse-doctor/workarea/workarea.component.ts (3)

181-182: LGTM!

The properties are correctly initialized to store ABDM facility details, following the project's conventions.


3279-3296: LGTM!

The method follows good practices for saving ABDM facility details:

  • Clean request object construction
  • Proper error handling
  • Appropriate user feedback

Line range hint 3226-3243: LGTM!

The integration of ABDM facility mapping with health ID linking follows a logical sequence and ensures proper data availability.

Comment on lines +3244 to +3255
getMappedAbdmFacility() {
const locationData: any = localStorage.getItem('loginDataResponse');
const jsonLoccationData = JSON.parse(locationData);
let workLocationId: any;
if (jsonLoccationData?.previlegeObj[0]?.roles) {
const roles = jsonLoccationData?.previlegeObj[0]?.roles;
roles.find((item: any) => {
item.RoleName.toLowerCase() === 'doctor';
workLocationId = item.workingLocationID;
});
}
console.log('workLocationId', workLocationId);
Copy link

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

Fix typos and add error handling for JSON parsing.

The code has the following issues:

  1. Variable name typo: jsonLoccationData should be jsonLocationData
  2. Property path typo: previlegeObj should be privilegeObj
  3. Missing error handling for JSON.parse

Apply this diff to fix the issues:

-    const jsonLoccationData = JSON.parse(locationData);
+    try {
+      const jsonLocationData = JSON.parse(locationData);
+
+      if (jsonLocationData?.privilegeObj[0]?.roles) {
+        const roles = jsonLocationData?.privilegeObj[0]?.roles;
+        roles.find((item: any) => {
+          item.RoleName.toLowerCase() === 'doctor';
+          workLocationId = item.workingLocationID;
+        });
+      }
+    } catch (error) {
+      console.error('Error parsing location data:', error);
+      return;
+    }
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
getMappedAbdmFacility() {
const locationData: any = localStorage.getItem('loginDataResponse');
const jsonLoccationData = JSON.parse(locationData);
let workLocationId: any;
if (jsonLoccationData?.previlegeObj[0]?.roles) {
const roles = jsonLoccationData?.previlegeObj[0]?.roles;
roles.find((item: any) => {
item.RoleName.toLowerCase() === 'doctor';
workLocationId = item.workingLocationID;
});
}
console.log('workLocationId', workLocationId);
getMappedAbdmFacility() {
const locationData: any = localStorage.getItem('loginDataResponse');
try {
const jsonLocationData = JSON.parse(locationData);
if (jsonLocationData?.privilegeObj[0]?.roles) {
const roles = jsonLocationData?.privilegeObj[0]?.roles;
roles.find((item: any) => {
item.RoleName.toLowerCase() === 'doctor';
workLocationId = item.workingLocationID;
});
}
} catch (error) {
console.error('Error parsing location data:', error);
return;
}
console.log('workLocationId', workLocationId);

if (jsonLoccationData?.previlegeObj[0]?.roles) {
const roles = jsonLoccationData?.previlegeObj[0]?.roles;
roles.find((item: any) => {
item.RoleName.toLowerCase() === 'doctor';
Copy link
Member

Choose a reason for hiding this comment

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

comparison?

Copy link
Member Author

Choose a reason for hiding this comment

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

@drtechie Yes, we are fetching the role mapped to userName and only giving carecontext facility details if the role is doctor.

@devikasuresh20 devikasuresh20 merged commit 35863b2 into PSMRI:develop Dec 16, 2024
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants