We hope you'll join us for our 4/23 webinar on using data tables to apply reference ranges and AE codes in OC4. For more information and to register, visit https://register.gotowebinar.com/register/2882170018956684555

OpenClinica to R: Subject, Event and CRF attributes

I've used the excellent XML Transformations files from Lindsey Stevens to transform these files to R.

I noticed that not all subject, event and CRF attributes are converted to the R files. I'm not familiar enough with XLS to edit the files myself. In particular, I would like Subject Sex, Event Start date and Event Subject age at event in mr R data frames.

Could someone guide me how to edit the XLS accordingly?

Thanks!

Comments

  • lindsay.stevenslindsay.stevens ✭✭✭ Posts: 404 ✭✭✭
    via Email
    Since these XSL transforms use ODM XML as input, you can only obtain
    information available in that export format.

    Best thing is to open an issue on the Github repository with the request.

    https://github.com/lindsay-stevens/openclinica_scripts
  • koenvnkoenvn Posts: 9

    Since these XSL transforms use ODM XML as input, you can only obtain
    information available in that export format.

    Best thing is to open an issue on the Github repository with the request.

    https://github.com/lindsay-stevens/openclinica_scripts

    Thanks for your response. I understand that these data points should be in the ODM XML, but I've checked, they are.

    < ClinicalData StudyOID="REDACTED" MetaDataVersionOID="v1.0.0-REDACTED">
    < SubjectData SubjectKey="SS_1001" OpenClinica:StudySubjectID="1001" OpenClinica:Sex="f">
  • koenvnkoenvn Posts: 9
    edited July 2016

    Since these XSL transforms use ODM XML as input, you can only obtain
    information available in that export format.

    Best thing is to open an issue on the Github repository with the request.

    https://github.com/lindsay-stevens/openclinica_scripts

    I've added the Sex variable, I can't figure out why the SubjectAgeAtEvent and EventStartDate don't work.

    Sex=c(
    < xsl:for-each select="/odm:ODM/odm:ClinicalData/odm:SubjectData/odm:StudyEventData/odm:FormData/odm:ItemGroupData[@ItemGroupOID=$ItemGroupOID]">;
    < xsl:if test="position()>1">,
    < /xsl:if>'< xsl:value-of select="../../../@OpenClinica:Sex"/>'< /xsl:for-each>),

    https://github.com/lindsay-stevens/openclinica_scripts/pull/4/commits/19661bbee9662acbea519630252154de53bf6e5d
  • lindsay.stevenslindsay.stevens ✭✭✭ Posts: 404 ✭✭✭
    via Email
    In case you didn't see it, I've merged the patch (with some changes) so it
    should work for your use case now.
  • koenvnkoenvn Posts: 9
    edited August 2016
    It works perfectly. Thank you so much, you're a lifesaver.

    Can you teach me what the line

    < /xsl:if>'< xsl:value-of select="/odm:ODM/odm:Study/odm:MetaDataVersion/odm:StudyEventDef[@OID=$vStudyEventOID]/@Name"/>;'),

    does and why it should be

    < /xsl:if>'< xsl:value-of select="$vSubjectAgeAtEvent"/>'< /xsl:for-each>),

    for the new values? That way I can understand why my version didn't work.

  • lindsay.stevenslindsay.stevens ✭✭✭ Posts: 404 ✭✭✭
    via Email
    The emails tend to mess up XML code a bit so I'll refer to line numbers to
    explain, starting at 87 [1].

    87: Search for item group data nodes matching the currently processed one,
    where the item group oid is the same (passed in to the template starting at
    line 58 as a parameter)

    88-90: define a variable taking the value from a node 2 levels up from the
    current node context, which would be a matched item group data node. 2
    levels up is the study event data node.

    91: output a comma if the currently processed matched node isn't the first
    matched node.

    92: in this case we already have the value we want to output (subject age
    at event), from 88-90. So we can just pass in that variable.

    In contrast, 78 is using the value of the current study event oid to look
    up the study event name from the metadata nodes.

    [1]
    https://github.com/lindsay-stevens/openclinica_scripts/blob/master/OC_XML_to_SAS_R_CSV/xml_convert_r_dataframes_with_factors.xsl#L87
Sign In or Register to comment.