wiki:SeventhQuery

Version 1 (modified by detwiler, 11 years ago) (diff)

--

return to XbrainEvaluation

import module namespace dxq = "http://sig.biostr.washington.edu/dxq/" at "dxq_private.xq";

let $patients_morph :=
dxq:csm("
let $morph_codes := ('7')
return
<results>
{
for $p in $root/patient
return
    let $trials := $p/surgery/csmstudy/trial[trialcode/term[type='CSM error code']/abbrev/text()=$morph_codes]
    return
    if(exists($trials))
    then
        <patient>
        {$p/pnum}
        {
            for $trial in $trials
            return

                <trial>
                    {$trial/trial_num}
                    {$trial/item}
                    {$trial/patient_response}
                </trial>

         }
         </patient>
     else()
}
</results>
")

return 
<patients>
    {$patients_morph/results/patient}
</patients>