/// <summary> /// Convert match result <paramref name="matchResult"/> to a FHIR resource /// </summary> private Bundle.EntryComponent ConvertMatchResult(IRecordMatchResult matchResult, IFhirResourceMapper mapper) { var result = mapper.MapToFhir(matchResult.Record); var resultExtension = matchResult.Vectors.Select(o => new Extension() { Url = "http://santedb.org/fhir/StructureDefinition/match-attribute", Value = new FhirString($"{o.Name} = {o.Score:0.0#}") }); // Now publish search data return(new Bundle.EntryComponent() { FullUrl = $"{MessageUtil.GetBaseUri()}/{result.TypeName}/{result.Id}/_history/{result.VersionId}", Resource = result, Search = new Bundle.SearchComponent() { Mode = Bundle.SearchEntryMode.Match, Score = (decimal)matchResult.Strength, Extension = new List <Extension>(resultExtension) { new Extension() { Url = "http://hl7.org/fhir/StructureDefinition/match-grade", Value = new Code(matchResult.Classification == RecordMatchClassification.Match ? "certain" : matchResult.Classification == RecordMatchClassification.Probable ? "possible" : "certainly-not") }, new Extension() { Url = "http://santedb.org/fhir/StructureDefinition/match-method", Value = new Code(matchResult.Method.ToString()) }, new Extension() { Url = "http://santedb.org/fhir/StructureDefinition/match-score", Value = new FhirDecimal((decimal)matchResult.Score) } } } }); }
/// <summary> /// Creates a new master match /// </summary> public MasterMatch(Guid master, IRecordMatchResult match) { this.MatchResult = match; this.Master = master; }