Skip to content

NPA-6546: fix end to end tests#121

Closed
ehallam wants to merge 5 commits intomainfrom
task/NPA-6546/fix-end-to-end-tests
Closed

NPA-6546: fix end to end tests#121
ehallam wants to merge 5 commits intomainfrom
task/NPA-6546/fix-end-to-end-tests

Conversation

@ehallam
Copy link
Copy Markdown

@ehallam ehallam commented Apr 15, 2026

Pull Request

🧾 Ticket Link

https://nhsd-jira.digital.nhs.uk/browse/NPA-6546


📄 Description/Summary of Changes

  • We have two classes, Demographics, and specific Patient models for TPP and EMIS that inherit from Demographics
  • Since we were using Demographics in the forwards_response.py file, pydantic was dropping all the extra fields we have on the specific TPP and EMIS Patient classes because it was using the types declared in forwards_response.py not the runtime types
  • Using SerializeAsAny makes Pydantic serialise the actual runtime types and not drop the extra fields

🧪 Developer Testing Carried Out


📋 PR Principles

  • Keep PRs Small and Focused: Ensure the PR addresses a single task or feature to make it easier to review.
  • Multiple PRs for one Ticket: When splitting work into multiple PRs, clearly describe what this PR addresses and outline the remaining work to complete the ticket.
  • Ensure Tests Are Included: Add or update unit, integration, or end-to-end tests to cover the changes made.
  • Follow Coding Standards: Ensure the code adheres to the team's coding guidelines and best practices.
  • Resolve Comments Promptly: If you raise a comment, ensure you follow up and resolve it before approving the PR to maintain clarity and ensure comments are addressed.
  • Foster Learning: PR reviews are an opportunity to share knowledge, provide constructive feedback, and encourage a collaborative environment.

🏷️ Naming Conventions Reminder

Please ensure the following naming conventions are followed:

  • PR title follows the format: NPA-XXXX: <short-description>
  • Branch name follows the convention: <type>/NPA-XXXX/<short-description>
  • Commit messages follow the template: NPA-XXXX: <short-description>

Copy link
Copy Markdown
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 updates the EMIS response modelling to align with the “Person” concept and adjusts base response typing to better support serializing concrete demographic subclasses, with corresponding EMIS unit test updates to fix failing end-to-end expectations.

Changes:

  • Rename EMIS Patient model to Person and update SessionResponse to use Person for user/patients.
  • Update EmisClient to construct Person objects when transforming/parsing the downstream response.
  • Update ForwardResponse to use SerializeAsAny for user and patients to preserve subclass serialization behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
app/api/infrastructure/emis/tests/test_client.py Updates EMIS client tests to use Person instead of Patient.
app/api/infrastructure/emis/models.py Renames PatientPerson and updates SessionResponse field types accordingly.
app/api/infrastructure/emis/client.py Switches EMIS client transformation/parsing logic to build Person instances and adjusts typing.
app/api/domain/forward_response_model.py Uses SerializeAsAny for demographic fields to better support subclass serialization.

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

Comment thread app/api/infrastructure/emis/client.py Outdated
Comment thread app/api/domain/forward_response_model.py
Comment thread app/api/infrastructure/emis/client.py Outdated
@ehallam ehallam closed this Apr 16, 2026
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