Skip to content

Refactor CodeableConceptCdMapper#1136

Merged
MartinWheelerMT merged 6 commits intomainfrom
refactor-codeable-concept-cd-mapper
Mar 5, 2025
Merged

Refactor CodeableConceptCdMapper#1136
MartinWheelerMT merged 6 commits intomainfrom
refactor-codeable-concept-cd-mapper

Conversation

@MartinWheelerMT
Copy link
Collaborator

@MartinWheelerMT MartinWheelerMT commented Mar 5, 2025

What

  • Refactor mapCodeableConceptForMedication and mapCodeableConceptToCd to reduce code duplication.
  • Refactor mapCodeableConceptToCdForAllergy for readability.
  • Add a test case when mapping to null flavor codeable concept for allergy when a SNOMED code is not present.
  • Remove unnecessary nesting in findOriginalTextForAllergy as the equals already handles case where it is not present.
  • Remove check for resolved clinical status as call to method getOriginalTextForActiveAllergy yields as the fallback method contains the exact same functionality.
  • Removed unnecessary isEmpty check as fallback was to return an Optional.empty() which so this is already implied.

Why

Improving code quality and readability, preparing for further work on NIAD-3304

Type of change

Please delete options that are not relevant.

  • Internal change (non-breaking change with no effect on the functionality affecting end users)

Checklist:

  • I have performed a self-review of my code
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

* Refactor `mapCodeableConceptForMedication` and `mapCodeableConceptToCd` to reduce code duplication.
* Refactor `mapCodeableConceptToCdForAllergy` for readability
…ither ACTIVE nor RESOLVED.

* Remove unnecessary nesting in `findOriginalTextForAllergy` as the equals already handles case where it is not present.
…riginalTextForActiveAllergy` yields as the fallback method contains the exact same functionality.
…tional.empty() which so this is already implied.

* Refactor method to functional style for code consistency
@MartinWheelerMT MartinWheelerMT marked this pull request as ready for review March 5, 2025 16:05
@MartinWheelerMT MartinWheelerMT enabled auto-merge (squash) March 5, 2025 16:05
* Remove now unnecessary test
@github-actions
Copy link

github-actions bot commented Mar 5, 2025

Looks good. All 33 mutations in this change were killed.

class surviving killed
💯uk.nhs.adaptors.gp2gp.ehr.mapper.CodeableConceptCdMapper 0 33

See https://pitest.org

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 5, 2025

@MartinWheelerMT MartinWheelerMT merged commit 1964f7f into main Mar 5, 2025
15 checks passed
@MartinWheelerMT MartinWheelerMT deleted the refactor-codeable-concept-cd-mapper branch March 5, 2025 17:03
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.

2 participants