Getting values from medication1.Medication Object

Jul 2, 2012 at 9:50 AM


 I am getting some issues in accessing medication values in my application.

I have added some medication values and those belongs to both the medication types i.e 30cafccc-047d-4288-94ef-643571f7919d and 5c5f1223-f63c-4464-870c-3e36ba471def referring to medication.Medication and medication1.Medication respectively.

In my application user will add fields to MSHV site and those can belong to any of the types. Now how should we access them from our application.

In the account setting of my application i have checked (CheckBox) both versions of the Medication types. But when i try to access the values from java code and hold them into medication1.Medication i get only values which refers to the original 5c5f1223-f63c-4464-870c-3e36ba471def type. Accessing values from other objects that refers to 30cafccc-047d-4288-94ef-643571f7919d are blank.

//Medication refers to medication1.medication
//Type requested is 5c5f1223-f63c-4464-870c-3e36ba471def

GetThingsResponse gtResponse = (GetThingsResponse)requestTemplate.makeRequest(info,getPersonInfo());
    		List<Thing> medication = gtResponse.getGroup().get(0).getThing();

    		Iterator<Thing> iterator = medication.iterator();
    		while ( iterator.hasNext()){
    			Thing thing = (Thing);
    			Medication medicationObject = (Medication)thing.getData();
			// I am looking for start date here, how should i get that
    			}catch (Exception e) {

I need to know the mapping between medication.Medication and medication1.Medication. Is there is any data loss in this type versioning ?




Jul 4, 2012 at 12:04 AM

Hi Hasan,

Generally, an application should always use the most recent version of a type.  Is there some reason you want to use both versions?

HealthVault will auto-convert thing versions into what it thinks your application expects.  It uses your application's authorization configuration to determine if it should auto convert.  If the user's actual thing type version is in your authorization list then HealthVault doesn't convert.  Otherwise HealthVault will convert the Thing to a version that is in your list.

You can also control the acceptable versions to return in the GetThings call:

ThingFormatSpec format = new ThingFormatSpec();

During up and down conversion, HealthVault may not be able to populate all of the fields.  You can see the conversion algorithm by obtaining the "upversion" or "downversion" transform on a thing type.

GetThingTypeRequest requestInfo = new GetThingTypeRequest();