Skip to content

Conversation

@james-cockayne
Copy link
Contributor

…than excluded. Added unit tests.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug in concept resolution where concepts could incorrectly map to unknown concepts instead of being excluded. The fix refactors the StandardConceptResolver class by extracting data access logic into a separate provider and correcting the resolution logic to properly exclude concepts when no valid mapping exists.

Key Changes:

  • Introduced IStandardConceptResolverDataProvider interface and implementation to separate data access from resolution logic
  • Fixed concept resolution logic to return empty array instead of unknown concept ID (0) when domain mapping is invalid
  • Added comprehensive unit tests covering various concept resolution scenarios

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
OmopTransformer/ConceptResolution/StandardConceptResolver.cs Fixed return logic to exclude concepts (return early with resolved concepts) and refactored to use data provider interface
OmopTransformer/ConceptResolution/IStandardConceptResolverDataProvider.cs New interface for data provider abstraction
OmopTransformer/ConceptResolution/StandardConceptResolverDataProvider.cs New implementation extracting data access logic from StandardConceptResolver
OmopTransformer/ConceptResolution/ConceptCodeMapRow.cs Extracted data model class previously nested in StandardConceptResolver
OmopTransformer/ConceptResolution/ConceptRelationshipRow.cs Extracted data model class previously nested in StandardConceptResolver
OmopTransformerTests/ConceptResolution/StandardConceptResolverTests.cs Comprehensive unit tests covering various concept resolution scenarios
OmopTransformer/Program.cs Registered new data provider in dependency injection container
OmopTransformer/SUS/APC/SusAPCTransformer.cs Added namespace import and test code in constructor
Multiple files Added namespace imports for ConceptResolution

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +152 to +153

return resolvedConcepts;
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

This return statement is inside the foreach loop, causing the method to return after processing only the first row. The return should be outside the foreach loop to process all mappings.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

return resolvedConcepts; is not inside a loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@copilot return resolvedConcepts; is not inside a loop?

Copy link
Contributor

Copilot AI commented Dec 12, 2025

@james-cockayne I've opened a new pull request, #307, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Dec 12, 2025

@james-cockayne I've opened a new pull request, #308, to work on those changes. Once the pull request is ready, I'll request review from you.

@james-cockayne james-cockayne merged commit e6a6674 into main Dec 12, 2025
1 check passed
@james-cockayne james-cockayne deleted the bugfix/out_of_domain_concept_map branch December 15, 2025 09:55
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