Skip to Navigation | Skip to Content

openEHR-Technical mailing list archives

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: a-path and values


Hi Pariya,
For some reason, I am getting mails from the group with a delay. Anyway, regarding your question; the code you have given is doing what it is supposed to do. It is returning a
QuantityInfo object, containing the quantity magnitude and unit. When this method is called, there is a datavalue object in the wrapper, and this method returns information about the dvquantity, that is all. There is not reason to set any value where you have commented.
I've created a modified version of the ArchetypeSaveLoadExample.java class, along with a modified version of one of the observation archetypes used by Opereffa. Both the java and adl files are attached. You should place the archetype file under the archetype repository dir, and the java file should simply work in Eclipse environment (it is a class which already exists in the Opereffa source tree). I assume you are already using this class, looking at the snippet you have given.
Using this adl file, I've saved and loaded the newly added quantity field, maybe using this would help.
Please let me know if there are any other problems.

Kind regards
Seref


On Sat, Mar 27, 2010 at 7:13 AM, Pariya Kashfi <hajar.kashfi@chalmers.se> wrote:
Hi again,
I've traced the problem to this point:
__________________________________________________
(class QuantityWrapper)

public Object getValue() {
// TODO: should be context dependent-> return default val or actual etc..
QuantityInfo info = new QuantityInfo();
if(!wrappedObject.isAnyAllowed()){
//a cdv quantity has a list which contains cdvquantityitems
List<CDvQuantityItem> qitems = ((CDvQuantity)wrappedObject).getList();
String currentUnit = null;
if(!(qitems == null || qitems.size() < 1)){
String[] items = getUnitsForWrappedQuantity();
for(String s : items){
info.units.add(s);
}
//TODO for the moment, I can't see how I can get the current unit? so I'm using 
//the first one...
info.setCurrentUnit(info.units.get(0));
}  
}
if (dataValue != null){
String magnitude = String.valueOf(((DvQuantity)dataValue).getMagnitude());

//***********

HERE WE SHOULD SET THE CURRENT VALUE BUT WE DONOT....

*//////////////

info.setMagnitude(magnitude);
}
else
info.setMagnitude("");
return info;
}
_______________________________________________________
So the problem is that for any row I retreive from DB (any quantity item) the currentUnit is null which prevents getGUITestString() of sending the proper String which is magnitude + unit
I do not actually understand the logic of this piece of code...

-Pariya

On Mar 26, 2010, at 3:02 PM, Pariya Kashfi wrote:

Hi there,
I'm trying to save and load archetype data for a sample observation which includes boolean and quantity as well.
.............
String cellDifferentiation = "/data[at0001]/events[at0002]/data[at0003]/items[at0006]/items[at0069]/value";
String ana = "/data[at0001]/events[at0002]/data[at0003]/items[at0006]/items[at0063]/value/value";
String ra = "/data[at0001]/events[at0002]/data[at0003]/items[at0006]/items[at0064]/value/value";
.........

pArchetypeWrapper.getElementAtNode(cellDifferentiation).setMagnitudeOfQuantity("100");
pArchetypeWrapper.getElementAtNode(cellDifferentiation).setUnitOfQuantity("ml");
pArchetypeWrapper.getElementAtNode(ana).setBooleanValue("False"); 
pArchetypeWrapper.getElementAtNode(ra).setBooleanValue("True"); 

I'm actually able to save data in DB but when I run the sample opereffa code to load and print data into console, 
..........
wrapperToLoadData.loadFromPOJO(archetypeDatas);
System.out.println(wrapperToLoadData.getRootWrapper().getGUITestString());

 But I can just retrieve boolean values. it sounds somewhere I loose value (numbers) for quantity elements...
Any idea about the reason?


Regards
Pariya

MSc; PhD Candidate
Department of Computing  Science and Engineering 
Chalmers University of Technology






<ATT00001..txt>

Regards
Pariya

MSc; PhD Candidate
Department of Computing  Science and Engineering 
Chalmers University of Technology







_______________________________________________
openEHR-technical mailing list
openEHR-technical@openehr.org
http://lists.chime.ucl.ac.uk/mailman/listinfo/openehr-technical


Attachment: openEHR-EHR-OBSERVATION.soap_clerking8QandB.v8.adl
Description: Binary data

Attachment: ArchetypeSaveLoadExample.java
Description: Binary data

_______________________________________________
openEHR-technical mailing list
openEHR-technical@openehr.org
http://lists.chime.ucl.ac.uk/mailman/listinfo/openehr-technical