Documentation ¶
Index ¶
- Variables
- type Detector
- type Match
- type Matcher
- type Merger
- func (m *Merger) DeleteTargetResource(targetBundleURL, targetResourceID string) error
- func (m *Merger) Merge(source1, source2 string) (outcome *models.Bundle, targetURL string, err error)
- func (m *Merger) ResolveConflict(targetBundleURL, targetResourceID string, updatedResource interface{}) error
- func (m *Merger) UpdateTargetResource(targetBundleURL, targetResourceID string, updatedResource interface{}) error
- type PathMap
- type ResourceMap
Constants ¶
This section is empty.
Variables ¶
var ( // PathsUnsuitableForComparison are paths that don't offer meaningful comparison // between two resources. For example, URLs or code systems. PathsUnsuitableForComparison = []string{"url", "system", "id", "_id", "text", "reference"} // FloatTolerance identifies the minumum difference between 2 floats that still // allows them to be considered a match. FloatTolerance = 0.0001 // MatchThreshold is the total percentage of non-nil paths in a resource that must // match for the whole resource to be considered a match. MatchThreshold = 0.8 // ErrNoPatientResource occurs if a Patient resource is not found in one or both // source bundles. ErrNoPatientResource = errors.New("Patient resource not found in one or both source bundles") // ErrDuplicatePatientResource occurs if more than one Patient resource is found // in either source bundle. ErrDuplicatePatientResource = errors.New("Duplicate Patient resources found in one or both source bundles") )
Functions ¶
This section is empty.
Types ¶
type Detector ¶
type Detector struct{}
Detector provides tools for detecting all conflicts between 2 resources in a Match.
type Match ¶
type Match struct { ResourceType string Left interface{} Right interface{} }
Match pairs up to FHIR resources that "match". These resources should be of the same resource type (e.g. Patient).
type Matcher ¶
type Matcher struct{}
Matcher provides tools for identifying all resources in 2 source bundles that "match".
func (*Matcher) Match ¶
func (m *Matcher) Match(leftBundle, rightBundle *models.Bundle) (matches []Match, unmatchables []interface{}, err error)
Match iterates through all resources in the two source bundles and attempts to find resources that "match". These resources can then be compared to each other to see what conflicts may still exist between them. All matches are returned as a slice of Match pairs. Resources without a match are returned separately as a slice of "unmatchables".
type Merger ¶
type Merger struct {
// contains filtered or unexported fields
}
Merger is the top-level interface used to merge resources and resolve conflicts.
func (*Merger) DeleteTargetResource ¶
DeleteTargetResource deletes a single resource in the target bundle, by ID.
func (*Merger) Merge ¶
func (m *Merger) Merge(source1, source2 string) (outcome *models.Bundle, targetURL string, err error)
Merge attempts to merge two FHIR Bundles containing patient records. If a merge is successful a new FHIR Bundle containing the merged patient record is returned. If a merge fails, a FHIR Bundle containing one or more OperationOutcomes is returned detailing the merge conflicts.
func (*Merger) ResolveConflict ¶
func (m *Merger) ResolveConflict(targetBundleURL, targetResourceID string, updatedResource interface{}) error
ResolveConflict attempts to resolve a single merge conflict. If the conflict resolution is successful and no more conflicts exist, the merged FHIR Bundle is returned. If additional conflicts still exist or the conflict resolution was not successful, a FHIR Bundle of OperationOutcomes is returned detailing the remaining merge conflicts.
func (*Merger) UpdateTargetResource ¶
func (m *Merger) UpdateTargetResource(targetBundleURL, targetResourceID string, updatedResource interface{}) error
UpdateTargetResource updates a single resource in the target bundle, by ID.
type ResourceMap ¶
type ResourceMap map[string][]interface{}
ResourceMap is used to map a list of resources to their specific type.
func (ResourceMap) Keys ¶
func (r ResourceMap) Keys() []string