Custom MR Session variables set but "hidden" in XML (not in browser)

118 views
Skip to first unread message

Torsten Rohlfing

unread,
Jun 4, 2013, 6:01:36 PM6/4/13
to xnat_di...@googlegroups.com
Hi all:

I am having some trouble with access to custom variables in MR Sessions. Let's call two such variables "physioproblemoverride" and "dtimismatchoverride."

For some, but not all, of the sessions on my server, when I set these variables in the browser front end, they show up properly in the front end, and when I do "View XML" I get the following section in the displayed result:

<xnat:fields>
<xnat:field name="physioproblemoverride">true</xnat:field>
<xnat:field name="dtimismatchoverride">true</xnat:field>
</xnat:fields>

But if I access the session XML via REST, like so:

curl -k -u MyUser https://MyServer/xnat/data/experiments/ID_E00021?format=xml

then I get a file with the following section instead:

<xnat:fields>
<xnat:field name="physioproblemoverride">
<!--hidden_fields[xnat_experimentData_field_id="22",fields_field_xnat_experimentDat_id="ID_E00021"]-->true</xnat:field>
<xnat:field name="dtimismatchoverride">
<!--hidden_fields[xnat_experimentData_field_id="23",fields_field_xnat_experimentDat_id="ID_E00021"]-->true</xnat:field>
</xnat:fields>

Mind you, this is from the same session...

Interestingly, the two server requests are very different... according to my logs, the curl request is this:

IP - - [04/Jun/2013:14:50:42 -0700] "GET /xnat/data/experiments/ID_E00021?format=xml HTTP/1.1" 200 18515

whereas the browser front end requests this:

IP - - [04/Jun/2013:14:57:46 -0700] "GET /xnat/app/action/XDATActionRouter/xdataction/xml/search_element/xnat%3AmrSessionData/search_field/xnat%3AmrSessionData.id/search_value/ID_E00021/popup/false/project/incoming HTTP/1.1" 200 16010

Now what might cause this strange behaviour? Unfortunately I can't just "fake" the more complex URI, since what I'd really like to do is use pyxnat (which uses the curl-style request).

Thanks for any hints!

Torsten

Tim Olsen

unread,
Jun 4, 2013, 11:25:15 PM6/4/13
to xnat_di...@googlegroups.com

Torsten,

 

XNAT translates xml documents into relational database tables.  Often this translation requires the generation of some additional values (primary keys, foreign keys) that aren’t included in the schema. 


By default, XNAT’s web services include those fields as comments in the xml document (in some rare circumstances they are helpful).  I’m not sure that they are ending up in the best place there, but you should be able to avoid them completely.  You can hide these extra fields by adding an ironically named query string variable (concealHiddenFields).

 

/xnat/data/experiments/ID_E00021?format=xml&concealHiddenFields=true

 

That should eliminate the commented fields.

 

Tim

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.
Visit this group at http://groups.google.com/group/xnat_discussion?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Torsten Rohlfing

unread,
Jun 5, 2013, 10:50:27 PM6/5/13
to xnat_di...@googlegroups.com
Thanks Tim -

Makes sense, and I see now that the field isn't really hidden, just obscured by the additional comment tag.

Now to solve my actual problem - and this of course addressed to the pyxnat developers - is there any reason why pyxnat couldn't get xml representations with concealHiddenFields=true added to the request?

Although I also wonder - is there any reason why XNAT delivers these by default, rather than only include them when concealHiddenFields=false is given in the URI?

Thanks all!

Torsten

Torsten Rohlfing

unread,
Jun 6, 2013, 3:56:17 PM6/6/13
to xnat_di...@googlegroups.com
Tim -

To make this work with out-of-the-box pyxnat, I applied the following patch to our local XNAT installation:

--- plugin-resources/webapp/xnat/java/org/nrg/xnat/restlet/resources/SecureResource.java        (revision 1789)
+++ plugin-resources/webapp/xnat/java/org/nrg/xnat/restlet/resources/SecureResource.java        (working copy)
@@ -506,7 +506,7 @@
                                return null;
                        }
                } else {
-                       return new ItemXMLRepresentation(item, MediaType.TEXT_XML, true,!this.isQueryVariableTrue("concealHiddenFields"));
+                       return new ItemXMLRepresentation(item, MediaType.TEXT_XML, true,this.isQueryVariableFalse("concealHiddenFields"));
                }
        }

So far we haven't seen any unwanted side effect.

Maybe this could patch be considered for mainline XNAT?

Best.
  Torsten

Torsten Rohlfing

unread,
Jul 11, 2013, 2:37:19 PM7/11/13
to xnat_di...@googlegroups.com

Just to prevent others from trying this - the proposed patch breaks handling of custom variables through the web frontend:

https://groups.google.com/d/msg/xnat_discussion/TGZeVVtaVOc/gIGe6vCdcZsJ

TR
Reply all
Reply to author
Forward
0 new messages