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

Entity Mapping Update #2823

Merged
merged 18 commits into from
Feb 7, 2025
Merged

Entity Mapping Update #2823

merged 18 commits into from
Feb 7, 2025

Conversation

sadaf895
Copy link
Contributor

@sadaf895 sadaf895 commented Jan 29, 2025

closes: #2427

kumarannathan and others added 3 commits December 9, 2024 00:09
feat(EntityDatatype): enhance `importMapFunction` logic and update type handling with robust matching

- Improved `importMapFunction` with better type handling and JSDoc annotations for clarity.
  - Added normalization logic to handle mismatches between imported values (numbers) and entity fields (strings), ensuring robust matching.
  - Handles cases where imported values are null or undefined gracefully.
  - Ensures matching entities in the database are mapped correctly, and undefined is returned for non-matching values without errors.
- Refactored the code for improved readability and maintainability:
  - Introduced `normalizeValue` to standardize value comparison.
  - Streamlined error handling and entity lookups.
- Added detailed unit tests for `importMapFunction`:
  - Validates mapping to existing entities when values are exact or type-convertible matches.
  - Ensures undefined is returned for non-matching values.
  - Covers scenarios for mismatched types between imported and entity field values.
- Utilized `mockEntityMapper` to simulate database interactions in tests.
- Updated GPLv3 license header and modernized class structure while preserving existing functionality.

Enhances the reliability of `EntityDatatype` and ensures consistent behavior during imports and anonymization processes.
Copy link
Contributor

Deployed to https://pr-2823.aam-digital.net/

@sadaf895 sadaf895 requested a review from sleidig January 29, 2025 13:39
@sadaf895 sadaf895 changed the title Kumaran nathan Entity Mapping Update Jan 29, 2025
@sleidig sleidig mentioned this pull request Jan 30, 2025
test: write test to handle numeric-string mismatch string
@sleidig sleidig marked this pull request as draft January 30, 2025 15:04
@sadaf895 sadaf895 marked this pull request as ready for review February 3, 2025 13:07
Copy link
Member

@sleidig sleidig left a comment

Choose a reason for hiding this comment

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

works well. Suggesting just some tiny code simplifications.

Copy link
Member

@sleidig sleidig left a comment

Choose a reason for hiding this comment

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

Thanks, @sadaf895 ! And thanks, @kumarannathan ! 🙏

@sleidig sleidig merged commit 22c80c9 into master Feb 7, 2025
13 checks passed
@sleidig sleidig deleted the Kumaran-Nathan branch February 7, 2025 13:32
@aam-digital-ci
Copy link
Collaborator

🎉 This PR is included in version 3.46.2-master.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@aam-digital-ci aam-digital-ci added the released on @master managed by CI (semantic-release) label Feb 7, 2025
@aam-digital-ci
Copy link
Collaborator

🎉 This PR is included in version 3.46.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@aam-digital-ci aam-digital-ci added the released managed by CI (semantic-release) label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @master managed by CI (semantic-release) released managed by CI (semantic-release)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Import: columns with numbers are not converted to string for importMapping lookups
4 participants