Merged
Conversation
…, add integration tests, add duplicate search for patient record info page
…unter, add transferring followup related stuff, improve tests, improve merged patient record experience
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds end-to-end patient merge capability across the backend (new merge-patients zambda + ops script), shared API types/client wiring, and EHR UI (duplicate detection, merge diff dialog, merged-record banner), with an integration test validating resource transfers.
Changes:
- Introduces a new
MERGE-PATIENTSzambda that transfers visits, clinical resources, patient-level records, billing resources, login phones, and deactivates the duplicate patient. - Adds EHR UI flows to detect potential duplicates, launch a merge diff dialog, and show a banner for merged/deactivated patients.
- Adds a large integration test suite covering merge validations and verifying transfer of key resource types.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/zambdas/test/integration/merge-patients.test.ts | New integration test validating merge behavior and transferred resources. |
| packages/zambdas/src/scripts/transfer-appointment-to-another-patient.ts | New ops script for manually merging patient data (with dry-run). |
| packages/zambdas/src/ehr/merge-patients/index.ts | New merge-patients http_auth zambda implementing merge + transfer logic. |
| packages/zambdas/package.json | Adds npm script entry to run the new transfer/merge script. |
| packages/utils/lib/types/api/patient-account/index.ts | Adds MergePatientsInput/Response API types. |
| config/oystehr-core/zambdas.json | Registers MERGE-PATIENTS zambda for deployment/execution. |
| apps/ehr/src/pages/PatientPage.tsx | Shows duplicate warning + merge action; hides main tabs when record is merged. |
| apps/ehr/src/pages/PatientInformationPage.tsx | Adds merged-record banner to patient info page. |
| apps/ehr/src/hooks/useGetPatient.ts | Adds duplicate patient detection + exposes duplicatePatients. |
| apps/ehr/src/features/visits/shared/hooks/useOystehrAPIClient.ts | Wires merge-patients zambda ID into the API client. |
| apps/ehr/src/features/visits/shared/api/types.ts | Adds mergePatientsZambdaID parameter. |
| apps/ehr/src/features/visits/shared/api/oystehrApi.ts | Adds mergePatients() API wrapper and zambda mapping. |
| apps/ehr/src/components/patients-merge/PatientsMergeDifference.tsx | Reworks merge diff UI to build QR from questionnaire and call backend merge. |
| apps/ehr/src/components/patients-merge/PatientsMergeButton.tsx | Simplifies merge initiation UX (prompt for second PID). |
| apps/ehr/src/components/PatientMergedBanner.tsx | New banner to redirect users to surviving patient record. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…one numbers processing after transaction
…ter transfer, add audit log for merging patients, resolve other copilot comments
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Uladzislau <35751502+VladMstv@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Uladzislau <35751502+VladMstv@users.noreply.github.com>
… PatientsMergeDifference Agent-Logs-Url: https://github.com/masslight/ottehr/sessions/320669e6-6844-4d12-81be-1b313c69e536 Co-authored-by: VladMstv <35751502+VladMstv@users.noreply.github.com>
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.
patientIdsprop type fromstring[]to[string, string]inPatientsMergeDifference.tsxto enforce the two-patient invariant at compile time