How to get the path of an element in java implementation

Hello everybody,

While trying to do a java main for uploading a COMPOSITION, I have had some problems. I want to give a value to a DV_CODED_TEXT, but for doing that first I need to obtain the path of the element. Is there any function or command that is used that returns that value?

Thanks,

Omar.

1 Like

Hi Omar, could you share a bit more about your project? Is the Java app your talking about a client app, or are you building/extending a CDR like ehrbase?
Are you using Archie library and/or ehrbase sdk?
And do you need the path for a specific template? Then the .adl vscode plug-in may be easy. Or do you need to be able to generate any path for any template?

Another option is to use the Export-> Web template from Archetype Designer, which lists all of the AQL paths for each node. You can also get this format via the Ehrscape API that both Better and EhrBase support.

Also in Archetype Designer, look at the Resolved path field.

or indeed the VsCode plug-in

Hi Joost,

Is a Java app with the purpose to be a client app. I am using the ehrbase sdk. And i need a path to a specific cluster inside a template. Hereafter i paste some pictures of the code and the part of the archetype structure. Can you help me to obtain the path?

Hi Ian,

Yes, I know that i can get the path from the Archetype Designer. In fact, I have mapped that path in a .txt file and afterwards read it in a Java function. The problem is that if I want to automize the process of uploading a COMPOSITION from the SDK, I need to obtain the path that I have indicated above. Do you have any idea in order to obtain it?

Sorry Omar,

Which data point are you trying to populate?

It might be helpful if you can share your .opt and explain which data point you are trying to populate? The IdentificationCluster structure is a branch node so there must be some leaf elements inside it.

This is helpful info. I assume ehrbase Sdk may have some feature for that. I’m not familiar with that. So I can’t help. Maybe @birger.haarbrandt. But if archetype designer is not helpful than I can’t help you in another way. Probably others can if you share the .opt code and screenshots. Good luck!

Hi Ian and Joost,

I have solved the problem. I needed to import the next package: import org.ehrbase.client.annotations.Path;

Now, once I call the function to obtain the path, I am able to obtain it.

Thanks a lot for your help!!

2 Likes

Thanks a lot for reporting back. This will help other people in the future!