Skip to content

Conversation

@james-cockayne
Copy link
Contributor

…oncepts to standard concepts, map to 0 if no results are found, but continue to map to nothing if a concept is found but it resides in the wrong domain.

…oncepts to standard concepts, map to 0 if no results are found, but continue to map to nothing if a concept is found but it resides in the wrong domain.
Copy link
Contributor

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 renames ConceptResolver to StandardConceptResolver and updates the return behavior for concept lookups to return an unknown concept ID (0) instead of null when mappings are not found. Additionally, SQL queries in documentation are standardized, and deduplication logic is enhanced to handle records with unknown concept IDs.

  • Renamed ConceptResolver to StandardConceptResolver throughout the codebase
  • Changed ConceptLookup.GetConceptCode() return type from int? to int, returning 0 for unknown concepts
  • Enhanced deduplication logic in recorder classes to differentiate records with unknown concept IDs (0) by comparing source values

Reviewed Changes

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

Show a summary per file
File Description
StandardConceptResolver.cs Renamed class from ConceptResolver and updated logic to return unknown concept ID (0) when mappings fail
ConceptLookup.cs Changed return type from nullable to non-nullable int, returning 0 for unknown concepts
RecordTransformer.cs Updated to use renamed StandardConceptResolver
Multiple selector files Updated constructor parameters to use StandardConceptResolver
Multiple transformer files Updated constructor parameters and field types to use StandardConceptResolver
Program.cs Updated service registration for renamed class
Multiple recorder files Added deduplication checks for records with concept_id = 0
Documentation files Standardized SQL query formatting (replaced top 1 with limit 1, renamed PatientId to NhsNumber, changed table alias)
Comments suppressed due to low confidence (2)

OmopTransformer/StandardConceptResolver.cs:132

  • [nitpick] Corrected spelling of 'empty' to 'empty array' for clarity, as the method returns an array.
    OmopTransformer/StandardConceptResolver.cs:134
  • The expression 'A == false' can be simplified to '!A'.

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

and co.person_id = p.person_id
and co.RecordConnectionIdentifier = r.RecordConnectionIdentifier
and co.condition_concept_id = r.condition_concept_id
and (co.condition_concept_id != 0 or and co.condition_source_value = r.condition_source_value)
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

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

Syntax error in SQL: duplicate 'or and' keywords. Should be either 'or' or 'and', not both. The correct syntax should be and (co.condition_concept_id != 0 or co.condition_source_value = r.condition_source_value).

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.

@copilot open a new pull request to apply changes based on this feedback

and co.person_id = p.person_id
and co.RecordConnectionIdentifier = r.RecordConnectionIdentifier
and co.condition_concept_id = r.condition_concept_id
and (co.condition_concept_id != 0 or and co.condition_source_value = r.condition_source_value)
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

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

Syntax error in SQL: duplicate 'or and' keywords. Should be either 'or' or 'and', not both. The correct syntax should be and (co.condition_concept_id != 0 or co.condition_source_value = r.condition_source_value).

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.

@copilot open a new pull request to apply changes based on this feedback

Copy link
Contributor

Copilot AI commented Nov 4, 2025

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

Copy link
Contributor

Copilot AI commented Nov 4, 2025

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

@james-cockayne james-cockayne marked this pull request as ready for review December 4, 2025 12:33
@james-cockayne james-cockayne merged commit 9aa656f into main Dec 10, 2025
1 check passed
@james-cockayne james-cockayne deleted the feature/map_to_unknown_concept branch December 10, 2025 09:44
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.

4 participants