question abouit minitermserv

Hi,

I wonder if I misunderstand something

In the file: mini-termserv/src/main/resources/openehr_terminology_en.xml
we find for example, this line:

In the file XMLTerminologySource.java, this line is interpreted as

private CodeSet loadCodeSet(Element element) {
CodeSet codeset = new CodeSet();
codeset.openehrId = element.getAttributeValue("openehr_id");
codeset.issuer = element.getAttributeValue("issuer");
codeset.externalId = element.getAttributeValue("external_id");
List children = element.getChildren("code");
for(Iterator it = children.iterator(); it.hasNext();) {
Element code = (Element) it.next();
codeset.addCode(code.getAttributeValue("value"));
}
return codeset;
}

This means (in my example) codeset.openehrId will become “languages”
and codeset.externalId will become “ISO_639-1”

Hi,

I wonder if I misunderstand something

In the file: mini-termserv/src/main/resources/openehr_terminology_en.xml
we find for example, this line:

In the file XMLTerminologySource.java, this line is interpreted as

private CodeSet loadCodeSet(Element element) {
CodeSet codeset = new CodeSet();
codeset.openehrId = element.getAttributeValue("openehr_id");
codeset.issuer = element.getAttributeValue("issuer");
codeset.externalId = element.getAttributeValue("external_id");
List children = element.getChildren("code");
for(Iterator it = children.iterator(); it.hasNext();) {
Element code = (Element) it.next();
codeset.addCode(code.getAttributeValue("value"));
}
return codeset;
}

This means (in my example) codeset.openehrId will become “languages”
and codeset.externalId will become “ISO_639-1”

In the file SimpleTerminologyService.java this is used, in the method private void loadCodeSets(TerminologySource source)
In this method, ther is a new SimpleCodeAccess created like this:

SimpleCodeSetAccess codeSetAccess =
new SimpleCodeSetAccess( codeset.externalId,
new HashSet<String>(codeset.codes)
);
codeSets.put(codeset.externalId, codeSetAccess);
codeSetInternalIdToExternalName.put(codeset.openehrId, codeset.externalId);

now, when we want to retrieve a codeset, we can use the function:
public CodeSetAccess codeSet(String name) {
return codeSets.get(name);
}

But this will never find the codeset known by name “languages”

Is this right?

Hi Bert,

This is right because according to the specification the function code_set(name: String) should return the code_set identified by the external identifier name, e.g. “ISO_639-1” not an internal openEHR code_set id like “languages”. To retrieve code_set by internal id, you need to use function code_set_for_id(id: String). Please look at the test cases in SimpleTerminologyServiceTest for examples.

Regards,
Rong
(yes, the colors work well in gmail)

Thanks Rong, I understand.

Bert