NPA-6546: Update post authorise responses#120
Merged
Conversation
…and patient properties
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the /authenticate 201 response contract and internal transformation models to replace proxy with user and enrich returned demographic/permission data across EMIS and TPP integrations.
Changes:
- Updated domain
ForwardResponse/Demographicsmodels to includeodsCode,user,dateOfBirth, andpermissions. - Updated EMIS/TPP client transformers and infrastructure models to populate
uservspatients, plus identifiers and (TPP)onlineUserId. - Updated OpenAPI spec and automated tests to reflect the new response shape (plus Makefile pytest arg passthrough).
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/end_to_end/authenticate/POST/test_201.py | Updates E2E expected 201 payloads for EMIS/TPP. |
| specification/im1-pfs-auth-api.yaml | Updates OpenAPI schemas for new user-centric response payload and added fields. |
| Makefile | Allows passing additional pytest args via PYTEST_ARGS. |
| app/api/infrastructure/tpp/tests/test_client.py | Updates TPP client unit test expectations for new response structure. |
| app/api/infrastructure/tpp/models.py | Extends TPP response models to include user, identifiers, permissions, and onlineUserId. |
| app/api/infrastructure/tpp/data/mocked_response.xml | Adds mocked effective service access data for TPP user. |
| app/api/infrastructure/tpp/client.py | Populates new fields and adds parsing for identifiers/permissions in TPP responses. |
| app/api/infrastructure/emis/tests/test_client.py | Updates EMIS client unit test expectations and error parametrization. |
| app/api/infrastructure/emis/models.py | Updates EMIS models for user + identifiers + permissions. |
| app/api/infrastructure/emis/client.py | Updates EMIS response transformation to construct user and filtered patients. |
| app/api/domain/tests/test_forward_response_model.py | Updates domain model test to new required fields. |
| app/api/domain/forward_response_model.py | Introduces Permissions, enriches Demographics, and replaces proxy with odsCode + user. |
Comments suppressed due to low confidence (1)
tests/end_to_end/authenticate/POST/test_201.py:100
- The expected EMIS 201 response body is out of sync with the new response models/spec: the API now returns
odsCodeat the top level, anduseris anEMISPatientModel(so it should includedateOfBirth,userPatientLinkToken,patientIdentifiers, andpermissionswithinuser, not as a separate top-levelpermissions). Update this expected payload to match the actual response contract.
"patients": [
{
"firstName": "Jane",
"surname": "Doe",
"title": "Mrs",
"permissions": {
"appointmentsEnabled": False,
"demographicsUpdateEnabled": True,
"epsEnabled": False,
"medicalRecordEnabled": True,
"onlineTriageEnabled": True,
"practicePatientCommunicationEnabled": True,
"prescribingEnabled": True,
"recordSharingEnabled": False,
"recordViewAuditEnabled": True,
"medicalRecord": {
"recordAccessScheme": "CoreSummaryCareRecord",
"allergiesEnabled": True,
"consultationsEnabled": True,
"immunisationsEnabled": True,
"documentsEnabled": True,
"medicationEnabled": True,
"problemsEnabled": True,
"testResultsEnabled": True,
},
},
},
{
"firstName": "Ella",
"surname": "Taylor",
"title": "Ms",
"permissions": {
"appointmentsEnabled": True,
"demographicsUpdateEnabled": True,
"epsEnabled": False,
"medicalRecordEnabled": True,
"onlineTriageEnabled": False,
"practicePatientCommunicationEnabled": True,
"prescribingEnabled": False,
"recordSharingEnabled": False,
"recordViewAuditEnabled": True,
"medicalRecord": {
"recordAccessScheme": "DetailedCodedCareRecord",
"allergiesEnabled": True,
"consultationsEnabled": True,
"immunisationsEnabled": True,
"documentsEnabled": True,
"medicationEnabled": True,
"problemsEnabled": True,
"testResultsEnabled": True,
},
},
},
],
"user": {"firstName": "Alex", "surname": "Taylor", "title": "Mr"},
"permissions": {
"appointmentsEnabled": True,
"demographicsUpdateEnabled": True,
"epsEnabled": True,
"medicalRecordEnabled": True,
"onlineTriageEnabled": False,
"practicePatientCommunicationEnabled": False,
"prescribingEnabled": True,
"recordSharingEnabled": False,
"recordViewAuditEnabled": True,
"medicalRecord": {
"recordAccessScheme": "DetailedCodedCareRecord",
"allergiesEnabled": True,
"consultationsEnabled": True,
"immunisationsEnabled": True,
"documentsEnabled": True,
"medicationEnabled": True,
"problemsEnabled": True,
"testResultsEnabled": True,
},
},
"sessionId": "SID_2qZ9yJpVxHq4N3b",
"endUserSessionId": "SESS_mDq6nE2b8R7KQ0v",
"supplier": "EMIS",
},
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bd92a28 to
b5688a9
Compare
b5688a9 to
8ec8016
Compare
ehallam
reviewed
Apr 13, 2026
ehallam
left a comment
There was a problem hiding this comment.
just a few comments on naming but other than that looks great!
obviously happy for you to push back
828312b to
d4fc225
Compare
d4fc225 to
6f645cc
Compare
ehallam
approved these changes
Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
🧾 Ticket Link
https://nhsd-jira.digital.nhs.uk/browse/NPA-6546
📄 Description/Summary of Changes
🧪 Developer Testing Carried Out
📋 PR Principles
🏷️ Naming Conventions Reminder
Please ensure the following naming conventions are followed:
NPA-XXXX: <short-description><type>/NPA-XXXX/<short-description>NPA-XXXX: <short-description>