From 745d82a608b6da4038bdbe33a7dba0fcb39ff0d8 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 9 Jul 2020 09:46:23 -0700 Subject: [PATCH 1/4] Fix EMPI rules json --- src/main/resources/empi-rules.json | 77 +++++++++++++++++------------- 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/src/main/resources/empi-rules.json b/src/main/resources/empi-rules.json index 78e77b6..ad549d8 100644 --- a/src/main/resources/empi-rules.json +++ b/src/main/resources/empi-rules.json @@ -1,35 +1,46 @@ { - "candidateSearchParams" : [ { - "resourceType" : "Patient", - "searchParam" : "birthdate" - }, { - "resourceType" : "*", - "searchParam" : "identifier" - },{ - "resourceType" : "Patient", - "searchParam" : "general-practitioner" - } ], - "candidateFilterSearchParams" : [ { - "resourceType" : "*", - "searchParam" : "active", - "fixedValue" : "true" - } ], - "matchFields" : [ { - "name" : "given-name", - "resourceType" : "*", - "resourcePath" : "name.given", - "metric" : "COSINE", - "matchThreshold" : 0.8 - }, { - "name" : "last-name", - "resourceType" : "*", - "resourcePath" : "name.family", - "metric" : "JARO_WINKLER", - "matchThreshold" : 0.8 - }], - "matchResultMap" : { - "given-name" : "POSSIBLE_MATCH", - "given-name,last-name" : "MATCH" - }, - "eidSystem": "http://company.io/fhir/NamingSystem/custom-eid-system" + "candidateSearchParams": [ + { + "resourceType": "Patient", + "searchParams": ["birthdate"] + }, + { + "resourceType": "*", + "searchParams": ["identifier"] + }, + { + "resourceType": "Patient", + "searchParams": ["general-practitioner"] + } + ], + "candidateFilterSearchParams": [ + { + "resourceType": "*", + "searchParam": "active", + "fixedValue": "true" + } + ], + "matchFields": [ + { + "name": "cosine-given-name", + "resourceType": "*", + "resourcePath": "name.given", + "metric": "COSINE", + "matchThreshold": 0.8, + "exact": true + }, + { + "name": "jaro-last-name", + "resourceType": "*", + "resourcePath": "name.family", + "metric": "JARO_WINKLER", + "matchThreshold": 0.8, + "exact": true + } + ], + "matchResultMap": { + "cosine-given-name" : "POSSIBLE_MATCH", + "cosine-given-name,jaro-last-name" : "MATCH" + }, + "eidSystem": "http://company.io/fhir/NamingSystem/custom-eid-system" } From 5d0b26bbf33a4bd7ddfc2e2aaefd8b3896e42722 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 9 Jul 2020 10:00:00 -0700 Subject: [PATCH 2/4] Have EmpiSettings actually return an EmpiSettings bean --- src/main/java/ca/uhn/fhir/jpa/starter/EmpiConfig.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/EmpiConfig.java b/src/main/java/ca/uhn/fhir/jpa/starter/EmpiConfig.java index 462aba8..3a8fe78 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/EmpiConfig.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/EmpiConfig.java @@ -1,9 +1,15 @@ package ca.uhn.fhir.jpa.starter; +import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.empi.api.IEmpiSettings; +import ca.uhn.fhir.empi.rules.config.EmpiRuleValidator; import ca.uhn.fhir.empi.rules.config.EmpiSettings; +import ca.uhn.fhir.jpa.empi.svc.EmpiSearchParamSvc; +import ca.uhn.fhir.jpa.subscription.channel.subscription.IChannelNamer; +import ca.uhn.fhir.rest.server.util.ISearchParamRetriever; import com.google.common.base.Charsets; import org.apache.commons.io.IOUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.DefaultResourceLoader; @@ -15,11 +21,11 @@ import java.io.IOException; public class EmpiConfig { @Bean - IEmpiSettings empiSettings() throws IOException { + public IEmpiSettings empiSettings(EmpiRuleValidator theEmpiRuleValidator) throws IOException { DefaultResourceLoader resourceLoader = new DefaultResourceLoader(); Resource resource = resourceLoader.getResource("empi-rules.json"); String json = IOUtils.toString(resource.getInputStream(), Charsets.UTF_8); - return null; // new EmpiSettings().setEnabled(HapiProperties.getEmpiEnabled()).setScriptText(json); + return new EmpiSettings(theEmpiRuleValidator).setEnabled(HapiProperties.getEmpiEnabled()).setScriptText(json); } } From 53315a54d02b93664820dfeee5e03622a45f7ba5 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 9 Jul 2020 10:01:09 -0700 Subject: [PATCH 3/4] Update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 035d0bf..8ebf6cd 100644 --- a/README.md +++ b/README.md @@ -160,7 +160,7 @@ The server may be configured with subscription support by enabling properties in ## Enabling EMPI -Set `empi.enabled=true` in the [hapi.properties](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/hapi.properties) file to enable EMPI on this server. The EMPI matching rules are configured in [empi-rules.json](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/empi-rules.json). The rules in this example file should be replaced with actual matching rules appropriate to your data. +Set `empi.enabled=true` in the [hapi.properties](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/hapi.properties) file to enable EMPI on this server. The EMPI matching rules are configured in [empi-rules.json](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/empi-rules.json). The rules in this example file should be replaced with actual matching rules appropriate to your data. Note that EMPI relies on subscriptions, so for EMPI to work, subscriptions must be enabled. ## Using Elasticsearch From d263b5e14c782690b636c6a03ff20839497365fd Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 9 Jul 2020 10:13:25 -0700 Subject: [PATCH 4/4] Remove dead space --- src/main/java/ca/uhn/fhir/jpa/starter/EmpiConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/EmpiConfig.java b/src/main/java/ca/uhn/fhir/jpa/starter/EmpiConfig.java index 3a8fe78..107aa97 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/EmpiConfig.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/EmpiConfig.java @@ -21,11 +21,11 @@ import java.io.IOException; public class EmpiConfig { @Bean - public IEmpiSettings empiSettings(EmpiRuleValidator theEmpiRuleValidator) throws IOException { + IEmpiSettings empiSettings(EmpiRuleValidator theEmpiRuleValidator) throws IOException { DefaultResourceLoader resourceLoader = new DefaultResourceLoader(); Resource resource = resourceLoader.getResource("empi-rules.json"); String json = IOUtils.toString(resource.getInputStream(), Charsets.UTF_8); - return new EmpiSettings(theEmpiRuleValidator).setEnabled(HapiProperties.getEmpiEnabled()).setScriptText(json); + return new EmpiSettings(theEmpiRuleValidator).setEnabled(HapiProperties.getEmpiEnabled()).setScriptText(json); } }