arnoldmad
|
Posted: December 09, 2010 07:35 by arnoldmad
|
|
Hi ! How can I switch from the default DeterministicExactMatchingService to the ProbabilisticMatchingService (which config files do I need to change ?) yours Arnold |
Howto enable ProbabilisticMatchingService
Replies: 5 - Last Post: December 22, 2010 14:05
by: Csaba Toth
by: Csaba Toth
showing 1 - 6 of 6
Csaba Toth
|
Posted: December 09, 2010 22:40 by Csaba Toth
|
|
Take a look at the following source (resource) file which defines the Spring bean hierarchy setup and configuration: applicationContext-service.xml it is in the core module: core/src/main/resources http://kenai.com/projects/openempi/sources/source-repository/content/trunk/openempi/core/src/main/resources/applicationContext-service.xml?rev=118 You need to change the Context bean configuration, it starts with this (166. line): <bean id="context" class="org.openhie.openempi.context.Context"> Change this (172.) line from: <property name="matchingService" ref="basicExactMatchingService" /> to: <property name="matchingService" ref="probabilisticMatchingService" /> As you can see not so much below the context bean, the bean with the name basicExactMatchingService has the implementation of org.openhie.openempi.matching.impl.DeterministicExactMatchingService. By plugging in the probabilisticMatchingService bean, Spring will inject this (the probablistic matching) bean into the Context when the resolution happens at start. After that you have to recompile (and redeploy if it is not done automatically). Hopefully at some later version you'll be able to do that run-time from some GUI. |
arnoldmad
|
Posted: December 15, 2010 14:06 by arnoldmad
|
|
Hi Csaba ! Thanks for your response. I did as suggested and recompiled the whole thing (based on 2.0.5 source) and get the following Exception when deploying: Caused by: java.lang.NullPointerException at org.openhie.openempi.matching.fellegisunter.ProbabilisticMatchingService.loadConfiguration(ProbabilisticMatchingService.java:257) at org.openhie.openempi.matching.fellegisunter.ProbabilisticMatchingService.init(ProbabilisticMatchingService.java:102) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1412) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1373) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1333) ... 162 more 15:04:39,921 ERROR [[/openempi-admin]] Servlet /openempi-admin threw load() exception I lookedup the source and it seams that the call to getConfiguration() is causing the NPE but I have no idea why this happens atm: matchConfiguration = Context.getConfiguration().getMatchConfiguration(); |
Csaba Toth
|
Posted: December 15, 2010 23:52 by Csaba Toth
|
|
I ran into that long time ago, but I didn't remember. So you get this when the Spring framework resolves the dependencies between the beans and initialize them and inject them. The code runs onto a null pointer, because at the time when the Spring framework initializes the probabilisticMatchingService bean the configuration bean is not initialized yet. During the probabilsiticMatchingService initialization the init method is called by Spring (this is given in the xml config file you edited), and this method tries to load the configuration from the configuration bean which applies to prob. matching. So this is a dependency issue, the probabilisticMatchingService bean depends on the configuration bean. Spring has a depends-on keyword for that, but I haven't ended up using that one, I guess I ran into some problems (circular dependency? I cannot remember), but it was many month ago, I cannot remember. So right now in my code there's a "hack", I put a null pointer check into the loadConfiguration function which crashed: private void loadConfiguration() { Configuration config = Context.getConfiguration(); if (config != null) { matchConfiguration = config.getMatchConfiguration(); } else { log.debug("Connot load configuration because the Context.Configuration is null"); } } That solution will work, because the init will be called second time also, and at that time we'll have a non-null Configuration. I don't know why there's a second setup phase though, why it is called two times, but it works eventually that way. I think this is an issue and should be entered into JIRA. Can you do that? Preferably I would try to resolve it by using Spring configuration keyword, but I don't have time for this right now. |
arnoldmad
|
Posted: December 16, 2010 09:01 by arnoldmad
|
|
Hi ! Thanks for the hint - it works with your patch and I also created a issue for it. Another problem is that it searches for that FellegiSunterConfiguration.ser file but I don't know where to get it and the MatchingService doesn't work if this file is not available: http-0.0.0.0-8080-1 - DEBUG - org.openhie.openempi.matching.fellegisunter.ProbabilisticMatchingService.loadParameters(244) fellegisunter.ProbabilisticMatchingService - Attempting to load the configuration file for the migration log from: /tmp/FellegiSunterConfiguration.ser http-0.0.0.0-8080-1 - ERROR - org.openhie.openempi.matching.fellegisunter.ProbabilisticMatchingService.loadParameters(252) fellegisunter.ProbabilisticMatchingService - Failed while loading the Fellegi-Sunter configuration file: /tmp/FellegiSunterConfiguration.ser (No such file or directory) java.io.FileNotFoundException: /tmp/FellegiSunterConfiguration.ser (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:106) at java.io.FileInputStream.<init>(FileInputStream.java:66) at org.openhie.openempi.matching.fellegisunter.ProbabilisticMatchingService.loadParameters(ProbabilisticMatchingService.java:247) Do you know how I can create that file ? |
Csaba Toth
|
Posted: December 22, 2010 14:05 by Csaba Toth
|
|
I noticed this problem also long time ago. FellegiSunterConfiguration.ser will contain serialized content of the FellegiSunterConfiguration class, which will contain the end results of the Expectation Maximalization algorithm (m and u probabilities for the matching fields). So this file will be either written or overwritten at the end of the Match procedure. Although there is an exception, it won't cause problem if you supress it. I refactored this part of my own source code, so I'm looking at the version in the trunk: http://kenai.com/projects/openempi/sources/source-repository/content/trunk/openempi/core/src/main/java/org/openhie/openempi/matching/fellegisunter/ProbabilisticMatchingService.java?rev=150 During the init procedure, loadParameters will be called. LoadParameters will throw the exception if you haven't run the Match algorithm before, but init should catch it. So the execution will continue, ant the initialized boolean variable will remain false. That would cause only problem if match() is called, which is for just individual records. But the linkRecords() will still work, it will produce the serialized file and set the variable also. I remember that I also modified the MatchView, MatchController and more importantly the PersonDataService to accomondate my needs with the Probabilistic matching. |
showing 1 - 6 of 6
Replies: 5 - Last Post: December 22, 2010 14:05
by: Csaba Toth
by: Csaba Toth







