Add support for partial code description matching.

This commit is contained in:
ianmarshall 2020-06-08 09:24:09 -04:00
parent 549993886d
commit 56cbc5149b
4 changed files with 17 additions and 15 deletions

View File

@ -412,8 +412,8 @@ public class ElasticsearchSvcImpl implements IElasticsearchSvc {
if (textOnlyList.size() > 0) { if (textOnlyList.size() > 0) {
BoolQueryBuilder myTextBoolQueryBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder myTextBoolQueryBuilder = QueryBuilders.boolQuery();
for (String textOnlyParam : textOnlyList) { for (String textOnlyParam : textOnlyList) {
myTextBoolQueryBuilder.should(QueryBuilders.matchPhraseQuery("categoryconceptcodingdisplay", textOnlyParam)); myTextBoolQueryBuilder.should(QueryBuilders.matchQuery("categoryconceptcodingdisplay", textOnlyParam));
myTextBoolQueryBuilder.should(QueryBuilders.matchPhraseQuery("categoryconcepttext", textOnlyParam)); myTextBoolQueryBuilder.should(QueryBuilders.matchQuery("categoryconcepttext", textOnlyParam));
} }
theBoolQueryBuilder.must(myTextBoolQueryBuilder); theBoolQueryBuilder.must(myTextBoolQueryBuilder);
} }
@ -510,8 +510,8 @@ public class ElasticsearchSvcImpl implements IElasticsearchSvc {
if (textOnlyList.size() > 0) { if (textOnlyList.size() > 0) {
BoolQueryBuilder myTextBoolQueryBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder myTextBoolQueryBuilder = QueryBuilders.boolQuery();
for (String textOnlyParam : textOnlyList) { for (String textOnlyParam : textOnlyList) {
myTextBoolQueryBuilder.should(QueryBuilders.matchPhraseQuery("codeconceptcodingdisplay", textOnlyParam)); myTextBoolQueryBuilder.should(QueryBuilders.matchQuery("codeconceptcodingdisplay", textOnlyParam));
myTextBoolQueryBuilder.should(QueryBuilders.matchPhraseQuery("codeconcepttext", textOnlyParam)); myTextBoolQueryBuilder.should(QueryBuilders.matchQuery("codeconcepttext", textOnlyParam));
} }
theBoolQueryBuilder.must(myTextBoolQueryBuilder); theBoolQueryBuilder.must(myTextBoolQueryBuilder);
} }

View File

@ -12,13 +12,13 @@
"type" : "keyword" "type" : "keyword"
}, },
"codingdisplay" : { "codingdisplay" : {
"type" : "keyword" "type" : "text"
}, },
"codingsystem" : { "codingsystem" : {
"type" : "keyword" "type" : "keyword"
}, },
"text" : { "text" : {
"type" : "keyword" "type" : "text"
} }
} }
} }

View File

@ -18,10 +18,10 @@
"type" : "keyword" "type" : "keyword"
}, },
"codeconceptcodingdisplay" : { "codeconceptcodingdisplay" : {
"type" : "keyword" "type" : "text"
}, },
"categoryconcepttext" : { "categoryconcepttext" : {
"type" : "keyword" "type" : "text"
}, },
"categoryconceptcodingcode" : { "categoryconceptcodingcode" : {
"type" : "keyword" "type" : "keyword"
@ -33,7 +33,7 @@
"type" : "keyword" "type" : "keyword"
}, },
"categoryconceptcodingdisplay" : { "categoryconceptcodingdisplay" : {
"type" : "keyword" "type" : "text"
}, },
"effectivedtm" : { "effectivedtm" : {
"type" : "date" "type" : "date"

View File

@ -196,9 +196,9 @@ public class LastNElasticsearchSvcMultipleObservationsIT {
SearchParameterMap searchParameterMap = new SearchParameterMap(); SearchParameterMap searchParameterMap = new SearchParameterMap();
ReferenceParam subjectParam = new ReferenceParam("Patient", "", "3"); ReferenceParam subjectParam = new ReferenceParam("Patient", "", "3");
searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam)); searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
TokenParam categoryParam = new TokenParam("test-heart-rate"); TokenParam categoryParam = new TokenParam(null, "test-heart-rate");
searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(categoryParam)); searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(categoryParam));
TokenParam codeParam = new TokenParam("test-code-1"); TokenParam codeParam = new TokenParam(null,"test-code-1");
searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(codeParam)); searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(codeParam));
searchParameterMap.setLastNMax(100); searchParameterMap.setLastNMax(100);
@ -230,10 +230,12 @@ public class LastNElasticsearchSvcMultipleObservationsIT {
SearchParameterMap searchParameterMap = new SearchParameterMap(); SearchParameterMap searchParameterMap = new SearchParameterMap();
ReferenceParam subjectParam = new ReferenceParam("Patient", "", "3"); ReferenceParam subjectParam = new ReferenceParam("Patient", "", "3");
searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam)); searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
TokenParam categoryParam = new TokenParam("test-heart-rate display"); // Check partial text
TokenParam categoryParam = new TokenParam("est-heart-ra");
categoryParam.setModifier(TokenParamModifier.TEXT); categoryParam.setModifier(TokenParamModifier.TEXT);
searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(categoryParam)); searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(categoryParam));
TokenParam codeParam = new TokenParam("test-code-1 display"); // Check partial text
TokenParam codeParam = new TokenParam("est-code-on");
codeParam.setModifier(TokenParamModifier.TEXT); codeParam.setModifier(TokenParamModifier.TEXT);
searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(codeParam)); searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(codeParam));
searchParameterMap.setLastNMax(100); searchParameterMap.setLastNMax(100);
@ -414,13 +416,13 @@ public class LastNElasticsearchSvcMultipleObservationsIT {
CodeJson codeJson1 = new CodeJson(); CodeJson codeJson1 = new CodeJson();
codeJson1.setCodeableConceptText("Test Codeable Concept Field for First Code"); codeJson1.setCodeableConceptText("Test Codeable Concept Field for First Code");
codeJson1.setCodeableConceptId(codeableConceptId1); codeJson1.setCodeableConceptId(codeableConceptId1);
codeJson1.addCoding("http://mycodes.org/fhir/observation-code", "test-code-1", "test-code-1 display"); codeJson1.addCoding("http://mycodes.org/fhir/observation-code", "test-code-1", "test-code-one display");
String codeableConceptId2 = UUID.randomUUID().toString(); String codeableConceptId2 = UUID.randomUUID().toString();
CodeJson codeJson2 = new CodeJson(); CodeJson codeJson2 = new CodeJson();
codeJson2.setCodeableConceptText("Test Codeable Concept Field for Second Code"); codeJson2.setCodeableConceptText("Test Codeable Concept Field for Second Code");
codeJson2.setCodeableConceptId(codeableConceptId1); codeJson2.setCodeableConceptId(codeableConceptId1);
codeJson2.addCoding("http://mycodes.org/fhir/observation-code", "test-code-2", "test-code-2 display"); codeJson2.addCoding("http://mycodes.org/fhir/observation-code", "test-code-2", "test-code-two display");
// Create CodeableConcepts for two categories, each with three codings. // Create CodeableConcepts for two categories, each with three codings.
// Create three codings and first category CodeableConcept // Create three codings and first category CodeableConcept