Skip to content

VED-898: Refactor RecordAttributes so it handles Immunization FHIR object rather than a dictionary#1259

Merged
Thomas-Boyle merged 8 commits intomasterfrom
898-refactor-recordattributes
Mar 4, 2026
Merged

VED-898: Refactor RecordAttributes so it handles Immunization FHIR object rather than a dictionary#1259
Thomas-Boyle merged 8 commits intomasterfrom
898-refactor-recordattributes

Conversation

@Thomas-Boyle
Copy link
Copy Markdown
Contributor

Summary

  • Refactor: RecordAttributes in the FHIR repository now works with FHIR Immunization entities instead of plain dicts; key derivation (PK, PatientPK, PatientSK, IdentifierPK) is unchanged.
  • Repository: ImmunizationRepository.create_immunization and update_immunization now take Immunization objects and persist them via immunization.json(use_decimal=True).
  • Service: FhirService.update_immunization parses both the incoming payload and the existing stored resource into Immunization entities and passes the new entity to the repo.

External API, validation, authorisation, versioning, and DynamoDB schema are unchanged.

…ed methods in FhirService and tests. This change enhances type safety and improves the handling of immunization data throughout the repository and service layers.
EmptyCommit:
Copy link
Copy Markdown
Contributor

@edhall-nhs edhall-nhs left a comment

Choose a reason for hiding this comment

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

Looks good. Only one comment about naming which I think needs addressing. See other optional comments about further refactoring.

Comment thread lambdas/backend/src/service/fhir_service.py Outdated
Comment thread lambdas/backend/src/service/fhir_service.py Outdated
"""Build DynamoDB attributes from a FHIR Immunization resource."""
imms_dict = immunization.dict()
patient_resolved = patient if patient is not None else get_contained_patient(imms_dict)
nhs_number = get_nhs_number(imms_dict)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Like mentioned in this comment, could probably be a separate ticket to refactor all these helpers so they use the Immunization object

…y and enhance get_vaccine_type to accept Immunization model. Update references accordingly.
Copy link
Copy Markdown
Contributor

@Akol125 Akol125 left a comment

Choose a reason for hiding this comment

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

Looks good to me, also like the change from self. to cls() in the from_immunization function.

Copy link
Copy Markdown
Contributor

@edhall-nhs edhall-nhs left a comment

Choose a reason for hiding this comment

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

Lgmt!

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 4, 2026

@Thomas-Boyle Thomas-Boyle temporarily deployed to internal-dev-sandbox March 4, 2026 10:44 — with GitHub Actions Inactive
@Thomas-Boyle Thomas-Boyle temporarily deployed to internal-dev-sandbox March 4, 2026 10:48 — with GitHub Actions Inactive
@Thomas-Boyle Thomas-Boyle temporarily deployed to internal-dev-sandbox March 4, 2026 10:49 — with GitHub Actions Inactive
@Thomas-Boyle Thomas-Boyle merged commit 83202f6 into master Mar 4, 2026
17 checks passed
@Thomas-Boyle Thomas-Boyle deleted the 898-refactor-recordattributes branch March 4, 2026 11:17
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