Skip to content

Conversation

@jmarchionatto
Copy link
Collaborator

Introduces a builder pattern for constructing MergeOperationInputParameters, enabling programmatic invocation of Patient $merge operations outside of REST contexts (e.g., Camel, batch jobs, message queues).

Changes:

  • Add MergeOperationInputParametersBuilder with two methods:
    • fromOperationParams() - Converts REST operation parameters
    • fromParameters() - Converts FHIR Parameters resource
  • Refactor PatientMergeProvider to use builder, eliminating duplicate logic
  • Add comprehensive unit tests (9 test cases covering all parameter types)

… invocation

This commit introduces a builder pattern for constructing MergeOperationInputParameters,
enabling programmatic invocation of Patient $merge operations outside of REST contexts
(e.g., Camel, batch jobs, message queues).

Changes:
- Add MergeOperationInputParametersBuilder with two methods:
  * fromOperationParams() - Converts REST operation parameters
  * fromParameters() - Converts FHIR Parameters resource
- Refactor PatientMergeProvider to use builder, eliminating duplicate logic
- Add comprehensive unit tests (9 test cases covering all parameter types)

Benefits:
- Single source of truth for parameter conversion
- Reusable across REST, Camel, and batch processing contexts
- Maintains backward compatibility with existing REST endpoints
- Follows FHIR spec for Parameter resource structure

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@robogary
Copy link
Contributor

Formatting check succeeded!

Extracted the logic for building FHIR Parameters output from Patient $merge
operation into a reusable utility class. This enables consistent merge output
formatting across different contexts.

Changes:
- Created MergeOperationParametersUtil with two overloaded methods:
  - buildMergeOperationOutputParameters(FhirContext, MergeOperationOutcome, IBaseResource)
    For callers that have a MergeOperationOutcome object
  - buildMergeOperationOutputParameters(FhirContext, IBaseResource, IBaseResource, IBaseResource, IBaseResource)
    For callers that have individual components (outcome, updatedTarget, task, input)

- Refactored PatientMergeProvider to delegate to the utility instead of
  using private buildMergeOperationOutputParameters method

- Added comprehensive test coverage (5 test cases):
  - All components present (both methods)
  - Optional components null (both methods)
  - Equivalence test verifying both methods produce same output
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.

3 participants