Skip to content

Refactor AllergyStructureMapper#1430

Draft
MartinWheelerMT wants to merge 3 commits intomainfrom
refactor-allergy-structure-mapper
Draft

Refactor AllergyStructureMapper#1430
MartinWheelerMT wants to merge 3 commits intomainfrom
refactor-allergy-structure-mapper

Conversation

@MartinWheelerMT
Copy link
Copy Markdown
Collaborator

@MartinWheelerMT MartinWheelerMT commented Jan 20, 2026

What

  • Move pertinent information mapping to separate mapper PertinentInformationAllergyMapper, in the same way it is handled for observation values.
  • Remove enum -> primitive string mapping when building the category and use the fhir model enums for comparison instead.
  • Inject new mapper into class and use real implementation in tests as classes.
  • Tidy code for readability.

Why

AllergyStructureMapper was difficult to read and contained code duplication, along with containing a number of pertinent information builders which could be refactored into another component and injected, in the same style as we handle the pertinent information for Observation values.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Internal change (non-breaking change with no effect on the functionality affecting end users)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • 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
  • I have updated the Changelog with details of my change in the UNRELEASED section if this change will affect end users

* Move pertinent information mapping to separate mapper `PertinentInformationAllergyMapper`, in the same way it is handled for observation values.
* Remove enum -> primitive string mapping when building the category and use the fhir model enums for comparison instead.
* Inject new mapper into class and use real implementation in tests as classes.
* Tidy code for readability.
@github-actions
Copy link
Copy Markdown

  • Surviving mutants in this change: 16
  • Killed mutants in this change: 76
class surviving killed
🧟uk.nhs.adaptors.gp2gp.ehr.mapper.PertinentInformationAllergyMapper 9 40
🧟uk.nhs.adaptors.gp2gp.ehr.mapper.AllergyStructureMapper 7 36

See https://pitest.org

@sonarqubecloud
Copy link
Copy Markdown

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.

1 participant