Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
public class RecordSimilarityResponseTest {

private static final ObjectMapper MAPPER = ApiModelMixinModule.setupObjectMapper(new ObjectMapper());
private static final String EXPECTED_JSON = "{\"info\":[\"Field threshold not found in properties! Defaulting to 0.0\",\"Field weight not found in fields! Defaulting to 1.0 for all entries\"],\"results\":[{\"explainInfo\":{\"leftOnlyFields\":[\"addr\"],\"rightOnlyFields\":[\"bool\"],\"scoredFields\":{\"dob\":{\"calculatedWeight\":0.2857142857142857,\"finalScore\":0.74,\"rawScore\":0.8,\"weight\":0.33},\"primaryName\":{\"calculatedWeight\":0.7142857142857143,\"details\":\"any details\",\"finalScore\":0.85,\"rawScore\":0.99,\"weight\":0.33},\"str\":{\"calculatedWeight\":0.0,\"finalScore\":0.5,\"rawScore\":0.5,\"weight\":0.33}}},\"left\":{\"addr\":{\"houseNumber\":\"123\",\"road\":\"Roadlane Ave\"},\"dob\":{\"date\":\"1993-04-16\"},\"num\":2342.15,\"primaryName\":{\"entityType\":\"PERSON\",\"language\":\"eng\",\"languageOfOrigin\":\"eng\",\"script\":\"Latn\",\"text\":\"Ethan R\"},\"str\":\"some string\"},\"right\":{\"bool\":false,\"dob\":\"1993-04-16\",\"primaryName\":{\"text\":\"Seth R\"},\"str\":\"some other string\"},\"score\":0.87},{\"error\":[\"Field foo not found in field mapping\"],\"info\":[\"Some info message\",\"Some other info message\"],\"left\":{\"addr\":{\"houseNumber\":\"123\",\"road\":\"Roadlane Ave\"},\"dob\":{\"date\":\"1993-04-16\"},\"primaryName\":{\"entityType\":\"PERSON\",\"language\":\"eng\",\"languageOfOrigin\":\"eng\",\"script\":\"Latn\",\"text\":\"Ethan R\"}},\"right\":{\"dob\":\"1993-04-16\",\"primaryName\":{\"text\":\"Seth R\"}}}]}";
private static final String EXPECTED_JSON = "{\"info\":[\"Field threshold not found in properties! Defaulting to 0.0\",\"Field weight not found in fields! Defaulting to 1.0 for all entries\"],\"results\":[{\"explainInfo\":{\"finalScore\":0.0,\"leftOnlyFields\":[\"addr\"],\"rightOnlyFields\":[\"bool\"],\"scoredFields\":{\"dob\":{\"calculatedWeight\":0.2857142857142857,\"finalScore\":0.74,\"rawScore\":0.8,\"weight\":0.33},\"primaryName\":{\"calculatedWeight\":0.7142857142857143,\"details\":\"any details\",\"finalScore\":0.85,\"rawScore\":0.99,\"weight\":0.33},\"str\":{\"calculatedWeight\":0.0,\"finalScore\":0.5,\"rawScore\":0.5,\"weight\":0.33}}},\"left\":{\"addr\":{\"houseNumber\":\"123\",\"road\":\"Roadlane Ave\"},\"dob\":{\"date\":\"1993-04-16\"},\"num\":2342.15,\"primaryName\":{\"entityType\":\"PERSON\",\"language\":\"eng\",\"languageOfOrigin\":\"eng\",\"script\":\"Latn\",\"text\":\"Ethan R\"},\"str\":\"some string\"},\"right\":{\"bool\":false,\"dob\":\"1993-04-16\",\"primaryName\":{\"text\":\"Seth R\"},\"str\":\"some other string\"},\"score\":0.87},{\"error\":[\"Field foo not found in field mapping\"],\"info\":[\"Some info message\",\"Some other info message\"],\"left\":{\"addr\":{\"houseNumber\":\"123\",\"road\":\"Roadlane Ave\"},\"dob\":{\"date\":\"1993-04-16\"},\"primaryName\":{\"entityType\":\"PERSON\",\"language\":\"eng\",\"languageOfOrigin\":\"eng\",\"script\":\"Latn\",\"text\":\"Ethan R\"}},\"right\":{\"dob\":\"1993-04-16\",\"primaryName\":{\"text\":\"Seth R\"}}}]}";

private static final RecordSimilarityResponse EXPECTED_RESPONSE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ public class RecordSimilarityExplainInfo {
Map<String, RecordSimilarityFieldExplainInfo> scoredFields;
List<String> leftOnlyFields;
List<String> rightOnlyFields;
double finalScore;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RecordSimilarityFieldInfo {
@NotNull @Valid String type;
RecordSimilarityFieldScoringMethod scoringMethod;
Double weight;
/**
* the score that this field should return if the field is null in a record
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2026 Basis Technology Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.basistech.rosette.apimodel.recordsimilarity;

public enum RecordSimilarityFieldScoringMethod {
STANDARD,
ONLY_INCREASE,
ONLY_DECREASE
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RecordSimilarityProperties {
@Valid Double threshold;
@Valid Double matchingFieldsBoostBias;
@Valid Boolean includeExplainInfo;
@Valid Map<String, String> parameters;
@Valid String parameterUniverse;
Expand Down