getting the concept name

Hi,

I am trying to get the (full!) concept name for a parsed archetype.

The best I can come up with is:

String conceptName="";

List<ArchetypeTerm> terms =
myArchetype.getOntology().getTermDefinitionsList().get(0).getDefinitions
();

for (int i=0; i< terms.size(); i++) {

if (terms.get(i).getCode().equals(myArchetype.getConcept())) {

            conceptName= terms.get(i).getItem(ArchetypeTerm.TEXT);

            break;

      }

}

Note that this doesn't even take into account the language I want it in,
I just take the first language I come across (0), otherwise the code
would further blow up.

Is there a smarter way to do this...in essence something like an indexOf
for the Code only, not the full ArchetypeTerm?

Or a convenience method like String getArchetypeTermText(String code,
String language)?

Am I missing something?

Regards

Sebastian

Dr Sebastian Garde
Dr. sc. hum., Dipl.-Inform. Med, FACHI

Faculty of Business and Informatics, Central Queensland University
Austin Centre for Applied Clinical Informatics, Austin Health
Heidelberg Vic 3084, Australia

s.garde@cqu.edu.au <mailto:s.garde@cqu.edu.au>
Ph: +61 (0)3 9496 4040
Fax: +61 (0)3 9496 4224

http://healthinformatics.cqu.edu.au
http://www.acaci.org.au

Visit the new open access electronic Journal of Health Informatics
(eJHI): http://ejhi.net/&gt;

Hi Sebastian,

There is a convenient method termDefinition(String language, String code) in class ArchetypeOntology to get ArchetypeTerm so you don’t need to step through the term list by yourself.

You can do the following already:

String conceptCode = myArchetype.getConcept();
ArchetypeTerm term = myArchetype.getOntology().termDefinition(yourLanguage, conceptCode);
String conceptName = term. getItem(ArchetypeTerm.TEXT);

Still there are two things we could improve here:

  1. Add a method in Archetype to facilitate this task
    public String getConcept(String Language);

  2. Add two convenient methods in ArchetypeTerm to facilitate fetching text and description
    public String getText(); // instead of getItem(ArchetypeTerm.TEXT)
    public String getDescription(): // instead of getItem(ArchetypeTerm.DESCRIPTION )

Cheers,
Rong

Hi Sebastian,

A little better code I think:

Hi Rong and Shinji,

Thanks for the help.

I implemented it as suggested and added the methods to the Parser

Cheers

Sebastian