Hi !
I'm trying to validate some messages and I encounter a lot of
'ProfileNotFollowedException - Code yyy not found in table HL7xxxx".
In HL7 some tables have no value. In MWB (export of "Spec XML Tables
Only") they are defined like this :
<hl7table id="0300" name="Namespace ID" codesys="HL7 Defined Codes -
HL7nnn" type="USER">
<tableElement order="1" code="..." description="No suggested
values
defined" displayName="" source="User" usage="Optional" Creator="MWB
Import" Date="14/09/2008" instruction="2.A.1.33.1" />
</hl7table>
To deal with these tables I have created this class :
import java.io.IOException;
import java.net.URL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ca.uhn.hl7v2.conf.ProfileException;
import ca.uhn.hl7v2.conf.store.ProfileCodeStore;
public class SpecifiedOnlyProfileCodeStore extends ProfileCodeStore {
private static final Logger LOG =
LoggerFactory.getLogger(SpecifiedOnlyProfileCodeStore.class);
private static String NO_SUGGESTED_VALUES_CODE = "...";
public SpecifiedOnlyProfileCodeStore(final String uri) throws
ProfileException, IOException {
super(uri);
}
public SpecifiedOnlyProfileCodeStore(final URL url) throws
ProfileException, IOException {
super(url);
}
@Override
public boolean isValidCode(final String codeSystem, final String code) {
String[] validCodes = null;
try {
validCodes = getValidCodes(codeSystem);
} catch (ProfileException e) {
LOG.debug(e.getMessage());
}
if (validCodes.length == 1 &&
NO_SUGGESTED_VALUES_CODE.equals(validCodes[0])) {
return true;
}
return super.isValidCode(codeSystem, code);
}
}
you can use it, include it in hl7api, rename it ... do what you want ;-)
regards
Gabriel
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel