Skip to content

Suppress MPI sync AOP during patient import to prevent duplicates - #49

Merged
mherman22 merged 4 commits into
IsantePlus:mainfrom
mherman22:fix/suppress-mpi-sync-on-import
Apr 15, 2026
Merged

Suppress MPI sync AOP during patient import to prevent duplicates#49
mherman22 merged 4 commits into
IsantePlus:mainfrom
mherman22:fix/suppress-mpi-sync-on-import

Conversation

@mherman22

@mherman22 mherman22 commented Apr 9, 2026

Copy link
Copy Markdown

Summary

When importMpiPatient() saves a patient via createImportedMpiPatient(), the mpi-client PatientSynchronizationAdvice AOP fires and spawns a PatientUpdateWorker. This worker re-queries the MPI, discovers golden record seealso links, and triggers a second import — creating a duplicate local patient.

  • Wrap the savePatient() call in createImportedMpiPatient() with PatientSynchronizationAdvice.SUPPRESS to skip the AOP during import
  • The export back to MPI is already handled explicitly by exportPatient() at the end of importMpiPatient(), so the AOP-triggered export is redundant anyway
  • Bump mpiClientVersion from 1.1.0 to 1.1.5-SNAPSHOT to pick up the SUPPRESS ThreadLocal flag

Depends on IsantePlus/openmrs-module-mpi-client#60.

When importMpiPatient() saves a patient via createImportedMpiPatient(),
the mpi-client PatientSynchronizationAdvice AOP fires and spawns a
PatientUpdateWorker. This worker re-queries the MPI, discovers golden
record seealso links, and triggers a second import — creating a
duplicate local patient.

Wrap the savePatient() call with PatientSynchronizationAdvice.SUPPRESS
to skip the AOP during import. The export back to MPI is already
handled explicitly by exportPatient() at the end of importMpiPatient(),
so the AOP-triggered export is redundant anyway.

Depends on IsantePlus/openmrs-module-mpi-client#60 which adds the
SUPPRESS ThreadLocal flag.
mherman22 added a commit to mherman22/sedish that referenced this pull request Apr 10, 2026
…e patient import

- santedb-mpiclient-1.1.5-SNAPSHOT.omod: adds SUPPRESS ThreadLocal flag
  to PatientSynchronizationAdvice, dedup lock on PatientUpdateWorker,
  and proxy privileges for background threads
  (IsantePlus/openmrs-module-mpi-client#60)

- registrationcore-2.2.0.omod: sets SUPPRESS=true around savePatient()
  in createImportedMpiPatient() to prevent AOP from spawning
  PatientUpdateWorker during MPI import
  (IsantePlus/openmrs-module-registrationcore#49)

- Dockerfile: copies patched registrationcore to distribution path
  to override the base image's unpatched version
mherman22 added a commit to mherman22/sedish that referenced this pull request Apr 10, 2026
…e patient import

- santedb-mpiclient-1.1.5-SNAPSHOT.omod: adds SUPPRESS ThreadLocal flag
  to PatientSynchronizationAdvice, dedup lock on PatientUpdateWorker,
  and proxy privileges for background threads
  (IsantePlus/openmrs-module-mpi-client#60)

- registrationcore-2.2.0.omod: sets SUPPRESS=true around savePatient()
  in createImportedMpiPatient() to prevent AOP from spawning
  PatientUpdateWorker during MPI import
  (IsantePlus/openmrs-module-registrationcore#49)

- Dockerfile: copies patched registrationcore to distribution path
  to override the base image's unpatched version
mherman22 added a commit to mherman22/iSantePlus that referenced this pull request Apr 10, 2026
- mpi-client: updated to 1.1.5-SNAPSHOT from fix/duplicate-patient-on-mpi-import
  branch (IsantePlus/openmrs-module-mpi-client#60) — adds SUPPRESS
  ThreadLocal, dedup lock, proxy privileges, CI fixes

- registrationcore: updated from fix/suppress-mpi-sync-on-import branch
  (IsantePlus/openmrs-module-registrationcore#49) — sets SUPPRESS=true
  around savePatient() during MPI import, bumps mpiClientVersion to
  1.1.5-SNAPSHOT

- Fixed dead repo references and github-packages profile in
  registrationcore POM
- Aligned xdsSenderVersion to 2.5.9 in registrationcore
mherman22 added a commit to mherman22/iSantePlus that referenced this pull request Apr 10, 2026
- Add 'Adding a New Module' guide: importing from external repo,
  creating from scratch, vendoring dependencies
- Add 'Contributing' section with workflow
- Add 'Downloading OMODs from CI' section
- Expand build instructions with install command
- Update mpi-client to 1.1.5-SNAPSHOT with SUPPRESS flag, dedup lock,
  and proxy privileges (IsantePlus/openmrs-module-mpi-client#60)
- Update registrationcore with SUPPRESS during MPI import
  (IsantePlus/openmrs-module-registrationcore#49)
- Fix dead repo references in registrationcore POM
- Align registrationcore xdsSenderVersion to 2.5.9
@mherman22
mherman22 force-pushed the fix/suppress-mpi-sync-on-import branch from afe00d4 to 6f14f63 Compare April 11, 2026 16:05
Comment thread pom.xml Outdated
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<xdsSenderVersion>2.2.1</xdsSenderVersion>
<mpiClientVersion>1.1.0</mpiClientVersion>
<mpiClientVersion>1.1.5-SNAPSHOT</mpiClientVersion>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We should finalize this version number before merging

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

i have been able to get 1.1.8 released so i am changing this to that

@mherman22
mherman22 merged commit 0c80f49 into IsantePlus:main Apr 15, 2026
0 of 2 checks passed
@mherman22
mherman22 deleted the fix/suppress-mpi-sync-on-import branch April 15, 2026 07:43
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