There is only one ADSL per study
ADSL
No ADSL dataset was found
else
let $count := $adlsitemgroupdef/def:leaf/@xlink:href
where count($count) != 1
return The number of ADSL files must be exactly 1. {data($count)} ADSL files were found
]]>
Variable must have the same label in ADaM as in SDTM - Any ADaM variable whose name is the same as an SDTM variable must be a copy of the SDTM variable and its label and values must not be modified
ALL
ADaM variable {data($name)} has a different label '{data($label)}' than its corresponding SDTM variable for which the label '{data($sdtmlabel)}' was found
]]>
Variable must have the same format in ADaM as in SDTM - Any ADaM variable whose name is the same as an SDTM variable must be a copy of the SDTM variable and its label and values must not be modified
ALL
ADaM variable {data($name)} has a different format DataType='{data($datatype)}', Length='{data($length)}', SignificantDigits='{data($signdigits)}' compared to its corresponding SDTM variable for which the Datatype='{data($sdtmdatatype)}', Length='{data($sdtmlength)}' and SignificantDigits='{data($sdtmsigndigits)}' was found :)
return ADaM variable {data($name)} has a different format/datatype, DataType='{data($datatype)}' compared to its corresponding SDTM variable for which the Datatype='{data($sdtmdatatype)}' was found
]]>
Variable must have the same length in ADaM as in SDTM - Any ADaM variable whose name is the same as an SDTM variable must be a copy of the SDTM variable, and its label and values must not be modified
ALL
ADaM variable {data($name)} has a different length, Length='{data($length)}' compared to its corresponding SDTM variable for which Length='{data($sdtmlength)}' was found
]]>
A variable with a suffix of FL has a value that is not Y, N or null
ALL
{data($flvaroids)} :)
(: now iterate over the datasets for which there are FL variables :)
for $record in $datasetdoc[count($flvaroids)>0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: and get the data points for which the end name ends with FL :)
for $flvariable in $flvaroids
let $datapoint := $record/odm:ItemData[@ItemOID=$flvariable]
let $value := $datapoint/@Value
let $varname := $definedoc//odm:ItemDef[@OID=$flvariable]/@Name
(: get those that are present and for which the value is not Y or N - we do not need to check for NULL
as these should not be present in Dataset-XML anyway :)
where $datapoint and not($value='Y' or $value='N')
return Variable with suffix FL '{data($varname)}' in dataset {data($datasetname)} does not have a value that is 'Y', 'N' or NULL - value '{data($value)}' was found
]]>
A variable with a suffix of FL has a value that is not Y, N or null
ALL
{data($flvaroids)} :)
(: now iterate over the datasets for which there are FL variables :)
for $record in $datasetdoc[count($flvaroids)>0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: and get the data points for which the end name ends with FL :)
for $flvariable in $flvaroids
let $datapoint := $record/odm:ItemData[@ItemOID=$flvariable]
let $value := $datapoint/@Value
let $varname := $definedoc//odm:ItemDef[@OID=$flvariable]/@Name
(: get those that are present and for which the value is not Y or N - we do not need to check for NULL
as these should not be present in Dataset-XML anyway :)
where $datapoint and not($value='Y' or $value='N')
return Variable with suffix FL '{data($varname)}' in dataset {data($datasetname)} does not have a value that is 'Y', 'N' or NULL - value '{data($value)}' was found
]]>
A variable with a suffix of FN has a value that is not 0, 1 or null
ALL
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: and get the data points for which the end name ends with FN :)
for $fnvariable in $fnvaroids
let $datapoint := $record/odm:ItemData[@ItemOID=$fnvariable]
let $value := $datapoint/@Value
let $varname := $definedoc//odm:ItemDef[@OID=$fnvariable]/@Name
(: get those that are present and for which the value is not 0 or 1 - we do not need to check for NULL
as these should not be present in Dataset-XML anyway :)
where $datapoint and not($value='0' or $value='1')
return Variable with suffix FN '{data($varname)}' in dataset {data($datasetname)} does not have a value that is '0', '1' or NULL - value '{data($value)}' was found
]]>
A variable with a suffix of FN has a value that is not 0, 1 or null
ALL
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: and get the data points for which the end name ends with FN :)
for $fnvariable in $fnvaroids
let $datapoint := $record/odm:ItemData[@ItemOID=$fnvariable]
let $value := $datapoint/@Value
let $varname := $definedoc//odm:ItemDef[@OID=$fnvariable]/@Name
(: get those that are present and for which the value is not 0 or 1 - we do not need to check for NULL
as these should not be present in Dataset-XML anyway :)
where $datapoint and not($value='0' or $value='1')
return Variable with suffix FN '{data($varname)}' in dataset {data($datasetname)} does not have a value that is '0', '1' or NULL - value '{data($value)}' was found
]]>
If the numeric flag (*FN) is used, the character version (*FL) is required
ALL
A variable with a suffix of FN '{data($fnvarname)}' is present but a variable with the same root and a suffix of FL '{data($flvarname)}' is not present
]]>
When a variable with a suffix of FL has the value 'Y', the corresponding variable with the same root and a suffix must have the value '1'
ALL
A variable with a suffix of FN '{data($fnvarname)}' is equal to 'Y' but the corresponding variable with the same root and a suffix of FL '{data($flvarname)}' is not equal to '1'. A value of '{data($fnvalue)}' was found
]]>
When a variable with a suffix of FL has the value 'N', the corresponding variable with the same root and a suffix must have the value '0'
ALL
A variable with a suffix of FL '{data($flvarname)}' is equal to 'N' but the corresponding variable with the same root and a suffix of FN '{data($fnvarname)}' is not equal to '0'. A value of '{data($fnvalue)}' was found
]]>
When a variable with a suffix of FL is equal to null, the corresponding variable with the same root and a suffix of FN must also be equal to null
ALL
A variable with a suffix of FL '{data($flvarname)}' is NULL but the corresponding variable with the same root and a suffix of FN '{data($fnvarname)}' is not NULL. A value of '{data($fnvalue)}' was found
]]>
ADaM variable names must be no more than 8 characters in length
ALL
8
return The length of a variable name '{data($varname)}' exceeds 8 characters
]]>
A variable must start with an English letter (A-Z, a-z)
ALL
The variable name '{data($varname)}' does not start with an English
]]>
A variable name may not contain characters other than English letters (A-Z, a-z), underscores (_), or numerals (0-9)
ALL
The variable name '{data($varname)}' contains a character other than English letters (A-Z, a-z), underscores (_), or numerals (0-9)
]]>
The length of a variable label may not be greater than 40 characters
ALL
40
return The variable '{data($varname)}' has a label with more than 40 characters: '{data($label)}' was found
]]>
The length of a variable value may not be greater than 200 characters
ALL
200
return Variable '{data($varname)}' in dataset {data($datasetname)} has a value with more than 200 characters. Value '{data($value)}' was found
]]>
The length of a variable value may not be greater than 200 characters, single dataset
ALL
200
return Variable '{data($varname)}' in dataset {data($datasetname)} has a value with more than 200 characters. Value '{data($value)}' was found
]]>
COMPLFL may only a value that is Y or N
ADSL
Variable COMPLFL is present and has a value that is not Y or N. Value '{data($complflvalue)}' was found
]]>
FASFL may only a value that is Y or N
ADSL
Variable FASFL is present and has a value that is not Y or N. Value '{data($fasflvalue)}' was found
]]>
ITTFL may only have a value that is Y or N
ADSL
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: get the value :)
let $ittflvalue := $record/odm:ItemData[@ItemOID=$ittfloid]/@Value
(: give an error when the value is not 'Y' and not 'N' or is absent :)
where not($ittflvalue) or ($ittflvalue != 'Y' and $ittflvalue != 'N')
return Variable ITTFL is present and has a value that is not Y or N. Value '{data($ittflvalue)}' was found
]]>
PPROTFL may only have a value that is Y or N
ADSL
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: get the value :)
let $pprotflvalue := $record/odm:ItemData[@ItemOID=$pprotfloid]/@Value
(: give an error when the value is not 'Y' and not 'N' :)
where not($pprotflvalue) or ($pprotflvalue != 'Y' and $pprotflvalue != 'N')
return Variable PPROTFL is present and has a value that is not Y or N. Value '{data($pprotflvalue)}' was found
]]>
SAFFL may only have a value that is Y or N
ADSL
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: get the value :)
let $safflvalue := $record/odm:ItemData[@ItemOID=$saffloid]/@Value
(: give an error when the value is not 'Y' and not 'N' :)
where not($safflvalue) or ($safflvalue != 'Y' and $safflvalue != 'N')
return Variable SAFFL is present and has a value that is not Y or N. Value '{data($safflvalue)}' was found
]]>
RANDFL may only have a value that is Y or N
ADSL
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: get the value :)
let $randflvalue := $record/odm:ItemData[@ItemOID=$randfloid]/@Value
(: give an error when the value is not 'Y' and not 'N' :)
where not($randflvalue) or ($randflvalue != 'Y' and $randflvalue != 'N')
return Variable RANDFL is present and has a value that is not Y or N. Value '{data($randflvalue)}' was found
]]>
ENRLFL may only have a value that is Y or N
ADSL
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: get the value :)
let $enrlflvalue := $record/odm:ItemData[@ItemOID=$enrlfloid]/@Value
(: give an error when the value is not 'Y' and not 'N' :)
where not($enrlflvalue) or ($enrlflvalue != 'Y' and $enrlflvalue != 'N')
return Variable ENRLFL is present and has a value that is not Y or N. Value '{data($enrlflvalue)}' was found
]]>
COMPLFN may only have a value that is 1 or 0
ADSL
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: get the value :)
let $complfnvalue := $record/odm:ItemData[@ItemOID=$complfnoid]/@Value
(: give an error when the value is not '1' and not '0' :)
where not($complfnvalue) or ($complfnvalue != '1' and $complfnvalue != '0')
return Variable COMPLFN is present and has a value that is not 1 or 0. Value '{data($complfnvalue)}' was found
]]>
FASFN may only have a value that is 1 or 0
ADSL
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: get the value :)
let $fasfnvalue := $record/odm:ItemData[@ItemOID=$fasfnoid]/@Value
(: give an error when the value is not '1' and not '0' :)
where not($fasfnvalue) or ($fasfnvalue != '1' and $fasfnvalue != '0')
return Variable FASFN is present and has a value that is not 1 or 0. Value '{data($fasfnvalue)}' was found
]]>
ITTFN may only have a value that is 1 or 0
ADSL
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: get the value :)
let $ittfnvalue := $record/odm:ItemData[@ItemOID=$ittfnoid]/@Value
(: give an error when the value is not '1' and not '0' :)
where not($ittfnvalue) or ($ittfnvalue != '1' and $ittfnvalue != '0')
return Variable ITTFN is present and has a value that is not 1 or 0. Value '{data($ittfnvalue)}' was found
]]>
PPROTFN may only have a value that is 1 or 0
ADSL
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: get the value :)
let $pprotfnvalue := $record/odm:ItemData[@ItemOID=$pprotfnoid]/@Value
(: give an error when the value is not '1' and not '0' :)
where not($pprotfnvalue) or ($pprotfnvalue != '1' and $pprotfnvalue != '0')
return Variable PPROTFN is present and has a value that is not 1 or 0. Value '{data($pprotfnvalue)}' was found
]]>
PPROTFN may only have a value that is 1 or 0
ADSL
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: get the value :)
let $saffnvalue := $record/odm:ItemData[@ItemOID=$saffnoid]/@Value
(: give an error when the value is not '1' and not '0' :)
where not($saffnvalue) or ($saffnvalue != '1' and $saffnvalue != '0')
return Variable SAFFN is present and has a value that is not 1 or 0. Value '{data($saffnvalue)}' was found
]]>
RANDFN may only have a value that is 1 or 0
ADSL
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: get the value :)
let $randfnvalue := $record/odm:ItemData[@ItemOID=$randfnoid]/@Value
(: give an error when the value is not '1' and not '0' :)
where not($randfnvalue) or ($randfnvalue != '1' and $randfnvalue != '0')
return Variable RANDFN is present and has a value that is not 1 or 0. Value '{data($randfnvalue)}' was found
]]>
ENRLFN may only have a value that is 1 or 0
ADSL
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: get the value :)
let $enrlfnvalue := $record/odm:ItemData[@ItemOID=$enrlfnoid]/@Value
(: give an error when the value is not '1' and not '0' :)
where not($enrlfnvalue) or ($enrlfnvalue != '1' and $enrlfnvalue != '0')
return Variable ENRLFN is present and has a value that is not 1 or 0. Value '{data($enrlfnvalue)}' was found
]]>
A variable with a suffix of RFL may only have a value that is Y or null
BDS
{data($flvaroids)} :)
(: now iterate over the datasets for which there are RFL variables :)
for $record in $datasetdoc[count($rflvaroids)>0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: and get the data points for which the end name ends with RFL :)
for $rflvariable in $rflvaroids
let $datapoint := $record/odm:ItemData[@ItemOID=$rflvariable]
let $value := $datapoint/@Value
let $varname := $definedoc//odm:ItemDef[@OID=$rflvariable]/@Name
(: get those that are present and for which the value is not Y - we do not need to check for NULL
as these should not be present in Dataset-XML anyway :)
where $datapoint and not($value='Y')
return Variable with suffix RFL '{data($varname)}' in dataset {data($datasetname)} does not have a value that is 'Y',or NULL - value '{data($value)}' was found
]]>
A variable with a suffix of PFL may only have a value that is Y or null
BDS
{data($flvaroids)} :)
(: now iterate over the datasets for which there are PFL variables :)
for $record in $datasetdoc[count($pflvaroids)>0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: and get the data points for which the end name ends with PFL :)
for $pflvaroid in $pflvaroids
let $datapoint := $record/odm:ItemData[@ItemOID=$pflvaroid]
let $value := $datapoint/@Value
let $varname := $definedoc//odm:ItemDef[@OID=$pflvaroid]/@Name
(: get those that are present and for which the value is not Y - we do not need to check for NULL
as these should not be present in Dataset-XML anyway :)
where $datapoint and not($value='Y')
return Variable with suffix PFL '{data($varname)}' in dataset {data($datasetname)} does not have a value that is 'Y',or NULL - value '{data($value)}' was found
]]>
A variable with a suffix of RFN may only have a value that is 1 or null
BDS
{data($flvaroids)} :)
(: now iterate over the datasets for which there are RFN variables :)
for $record in $datasetdoc[count($rfnvaroids)>0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: and get the data points for which the end name ends with RFN :)
for $rfnvaroid in $rfnvaroids
let $datapoint := $record/odm:ItemData[@ItemOID=$rfnvaroid]
let $value := $datapoint/@Value
let $varname := $definedoc//odm:ItemDef[@OID=$rfnvaroid]/@Name
(: get those that are present and for which the value is not 1 - we do not need to check for NULL
as these should not be present in Dataset-XML anyway :)
where $datapoint and not($value='1')
return Variable with suffix RFN '{data($varname)}' in dataset {data($datasetname)} does not have a value that is '1',or NULL - value '{data($value)}' was found
]]>
A variable with a suffix of PFN may only have a value that is 1 or null
BDS
{data($flvaroids)} :)
(: now iterate over the datasets for which there are PFN variables :)
for $record in $datasetdoc[count($pfnvaroids)>0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: and get the data points for which the end name ends with PFN :)
for $pfnvaroid in $pfnvaroids
let $datapoint := $record/odm:ItemData[@ItemOID=$pfnvaroid]
let $value := $datapoint/@Value
let $varname := $definedoc//odm:ItemDef[@OID=$pfnvaroid]/@Name
(: get those that are present and for which the value is not 1 - we do not need to check for NULL
as these should not be present in Dataset-XML anyway :)
where $datapoint and not($value='1')
return Variable with suffix PFN '{data($varname)}' in dataset {data($datasetname)} does not have a value that is '1',or NULL - value '{data($value)}' was found
]]>
There may only be one value of a variable which has a suffix of GRyN for a given value of a variable with the same root name and suffix of GRy.
BDS
0 and number(substring(@Name,string-length(@Name)-1,1)) < 10]/@OID
where $a = $adsl/odm:ItemRef/@ItemOID
return $a
)
(: get the location of the ADSL dataset :)
let $adsldatasetname := $adsl/def:leaf/@xlink:href
let $adsldatadoc := doc(concat($base,$adsldatasetname))
(: Iterate over all records in the ADSL dataset that have *GRy :)
for $record in $adsldatadoc//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: iterate over the *GRyN variables within this record :)
for $datapoint in $record/odm:ItemData[functx:is-value-in-sequence(@ItemOID,$grynvars)]
(: as OIDs are in principle completely arbitraty, get the name of the variable :)
let $grynoid := $datapoint/@ItemOID
let $gryndatapointname := $definedoc//odm:ItemDef[@OID=$grynoid]/@Name
let $gryndatapointvalue := $datapoint/@Value
(: now get the OID of the corresponding *GRy variable :)
let $gryname := substring($gryndatapointname,1,string-length($gryndatapointname)-1)
let $gryoid := (
for $a in $definedoc//odm:ItemDef[@Name=$gryname]/@OID
where $a = $adsl/odm:ItemRef/@ItemOID
return $a
)
(: and the value of the *GRy variable (if any) :)
let $gryvalue := $record/odm:ItemData[@ItemOID=$gryoid]/@Value
(: we must take care of the case that there is no *GRy variable :)
(: iterate over all next records that have the same *GRy value :)
for $record2 in $adsldatadoc//odm:ItemGroupData[@data:ItemGroupDataSeq > $recnum and odm:ItemData[@ItemOID=$gryoid and @Value=$gryvalue]]
let $recnum2 := $record2/@data:ItemGroupDataSeq
(: get the *GRyN value (if any) :)
let $grynvalue2 := $record2/odm:ItemData[@ItemOID=$grynoid]/@Value
(: when there is a value for both *GRyN and they are not equal, give an error :)
where $gryndatapointvalue and $grynvalue2 and not($gryndatapointvalue=$grynvalue2)
return The combination of the values {data($gryndatapointname)} and {data($gryname)} must be consistent (1:1 relationship) in the ADSL dataset. Record {data($recnum)} has {data($gryname)}={data($gryvalue)} and {data($gryndatapointname)}={data($gryndatapointvalue)} whereas record {data($recnum2)} has {data($gryname)}={$grynvalue2} and {data($gryndatapointname)}={data($gryndatapointvalue)}
]]>
There may only be one value of a variable which has a suffix of GRy for a given value of a variable with the same root name and suffix of GRyN - The *GRy and associated *GRyN variable must have a one-to-one relationship
ADSL
0 and number(substring(@Name,string-length(@Name)-1,1)) < 10]/@OID
where $a = $adsl/odm:ItemRef/@ItemOID
return $a
)
(: get the location of the ADSL dataset :)
let $adsldatasetname := $adsl/def:leaf/@xlink:href
let $adsldatadoc := doc(concat($base,$adsldatasetname))
(: Iterate over all records in the ADSL dataset that have *GRy :)
for $record in $adsldatadoc//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: iterate over the *GRyN variables within this record :)
for $datapoint in $record/odm:ItemData[functx:is-value-in-sequence(@ItemOID,$grynvars)]
(: as OIDs are in principle completely arbitraty, get the name of the variable :)
let $grynoid := $datapoint/@ItemOID
let $gryndatapointname := $definedoc//odm:ItemDef[@OID=$grynoid]/@Name
let $gryndatapointvalue := $datapoint/@Value
(: now get the OID of the corresponding *GRy variable :)
let $gryname := substring($gryndatapointname,1,string-length($gryndatapointname)-1)
let $gryoid := (
for $a in $definedoc//odm:ItemDef[@Name=$gryname]/@OID
where $a = $adsl/odm:ItemRef/@ItemOID
return $a
)
(: and the value of the *GRy variable (if any) :)
let $gryvalue := $record/odm:ItemData[@ItemOID=$gryoid]/@Value
(: we must take care of the case that there is no *GRy variable :)
(: iterate over all next records that have the same *GRyN value :)
for $record2 in $adsldatadoc//odm:ItemGroupData[@data:ItemGroupDataSeq > $recnum and odm:ItemData[@ItemOID=$grynoid and @Value=$gryndatapointvalue]]
let $recnum2 := $record2/@data:ItemGroupDataSeq
(: get the *GRy value (if any) :)
let $gryvalue2 := $record2/odm:ItemData[@ItemOID=$gryoid]/@Value
(: when there is a value for both *GRy and they are not equal, give an error :)
where $gryvalue and $gryvalue2 and not($gryvalue=$gryvalue2)
return The combination of the values {data($gryndatapointname)} and {data($gryname)} must be consistent (1:1 relationship) in the ADSL dataset. Record {data($recnum)} has {data($gryndatapointname)}={data($gryndatapointvalue)} and {data($gryname)}={data($gryvalue)} whereas record {data($recnum2)} has {data($gryndatapointname)}={data($gryndatapointvalue)} and {data($gryname)}={data($gryvalue2)}
]]>
Variable with a suffix of DTF must have a value that is within Controlled Terminology for DATEFL ('Y','M','D'), single dataset
ALL
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: and within this record, iterate over all data points that have a name ending with DTF :)
for $datapoint in $record/odm:ItemData[functx:is-value-in-sequence(@ItemOID,$dtfoids)]
(: get the value :)
let $value := $datapoint/@Value
(: get the full name of the variable :)
let $oid := $datapoint/@ItemOID
let $name := $definedoc//odm:ItemDef[@OID=$oid]/@Name
(: the value may not be 'D', 'M' or 'Y' :)
where not($value='D') and not($value='M') and not($value='Y')
return The --DTF variable {data($name)} in dataset {data($datasetname)} has a value '{data($value)}' that is not 'D', 'M' or 'Y'. The value '{data($value)}' was found.
]]>
A variable with a suffix of DY may not have a value of zero
BDS
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: iterate over all the DY variables within the current record that are --DY variables
and that do have a value of '0':)
for $datapoint in $record/odm:ItemData[functx:is-value-in-sequence(@ItemOID,$dyoids)][@Value='0']
(: get the name of the variable :)
let $oid := $datapoint/@ItemOID
let $name := $definedoc//odm:ItemDef[@OID=$oid]/@Name
return The variable {data($name)} in dataset {data($bdsname)} is not allowed to have the value '0'
]]>
A variable with a suffix of DY may not have a value of zero, single dataset
BDS
0]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: iterate over all the DY variables within the current record that are --DY variables
and that do have a value of '0':)
for $datapoint in $record/odm:ItemData[functx:is-value-in-sequence(@ItemOID,$dyoids)][@Value='0']
(: get the name of the variable :)
let $oid := $datapoint/@ItemOID
let $name := $definedoc//odm:ItemDef[@OID=$oid]/@Name
return The variable {data($name)} in dataset {data($datasetname)} is not allowed to have the value '0'
]]>
TRTP must be equal to at least one variable with a prefix of TRT, a suffix of P and containing a two digit number
BDS
0 and number(substring(@Name,4,2))<100]/@OID
where $a = $definedoc//odm:ItemGroupDef[@Name='ADSL']/odm:ItemRef/@ItemOID
return $a
)
(: get the USUBJID OID for ADSL :)
let $usubjidoidadsl := (
for $a in $definedoc//odm:ItemDef[@Name='USUBJID']/@OID
where $a = $definedoc//odm:ItemGroupDef[@Name='ADSL']/odm:ItemRef/@ItemOID
return $a
)
(: get the location of the ADSL document :)
let $adsldatasetname := $definedoc//odm:ItemGroupDef[@Name='ADSL']/def:leaf/@xlink:href
let $adsldoc := doc(concat($base,$adsldatasetname))
(: iterate over all the BSD datasets :)
for $itemgroupdef in $definedoc//odm:ItemGroupDef[@def:Class='BDS']
let $name := $itemgroupdef/@Name
(: get the TRTP variable OID in the BSD :)
let $trtpoid := (
for $a in $definedoc//odm:ItemDef[@Name='TRTP']/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: get the OID of USUBJID in this dataset - it can be different from the one in ADSL :)
let $usubjidoidbsd := (
for $a in $definedoc//odm:ItemDef[@Name='USUBJID']/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: get the datasetlocation :)
let $datasetname := $itemgroupdef/def:leaf/@xlink:href
let $datasetdoc := doc(concat($base,$datasetname))
(: iterate over all records in the dataset where there is a TRTP AND there is at least one TRTxxP:)
for $record in $datasetdoc[$trtpoid and $usubjidoidbsd]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: get the value of TRTP and the value of the USUBJID :)
let $trtpvalue := $record/odm:ItemData[@ItemOID=$trtpoid]/@Value
let $usubjidvalue := $record/odm:ItemData[@ItemOID=$usubjidoidbsd]/@Value
(: get all TRTxxP values for this subject in ADSL :)
let $trtxxpvalues := $adsldoc//odm:ItemGroupData[odm:ItemData[@ItemOID=$usubjidoidadsl and @Value=$usubjidvalue]]/odm:ItemData[functx:is-value-in-sequence(@ItemOID,$trtxxpoids)]/@Value
(: TRTP value must be one of the TRTxxP values :)
where $trtpvalue and count($trtxxpvalues)>0 and not(functx:is-value-in-sequence($trtpvalue,$trtxxpvalues))
return The value for TRTP '{data($trtpvalue)}' in dataset {data($name)} did not match any of the TRTxxP values '{data($trtxxpvalues)}' in the ADSL dataset for USUBJID={data($usubjidvalue)}
]]>
TRTP must be equal to at least one variable with a prefix of TRT, a suffix of P and containing a two digit number, single dataset
BDS
0 and number(substring(@Name,4,2))<100]/@OID
where $a = $definedoc//odm:ItemGroupDef[@Name='ADSL']/odm:ItemRef/@ItemOID
return $a
)
(: get the USUBJID OID for ADSL :)
let $usubjidoidadsl := (
for $a in $definedoc//odm:ItemDef[@Name='USUBJID']/@OID
where $a = $definedoc//odm:ItemGroupDef[@Name='ADSL']/odm:ItemRef/@ItemOID
return $a
)
(: get the location of the ADSL document :)
let $adsldatasetname := $definedoc//odm:ItemGroupDef[@Name='ADSL']/def:leaf/@xlink:href
let $adsldoc := doc(concat($base,$adsldatasetname))
(: iterate over all the BSD datasets :)
for $itemgroupdef in $definedoc//odm:ItemGroupDef[@def:Class='BDS' and @Name=$datasetname]
(: get the TRTP variable OID in the BSD :)
let $trtpoid := (
for $a in $definedoc//odm:ItemDef[@Name='TRTP']/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: get the OID of USUBJID in this dataset - it can be different from the one in ADSL :)
let $usubjidoidbsd := (
for $a in $definedoc//odm:ItemDef[@Name='USUBJID']/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: get the datasetlocation :)
let $datasetname := $itemgroupdef/def:leaf/@xlink:href
let $datasetdoc := doc(concat($base,$datasetname))
(: iterate over all records in the dataset where there is a TRTP AND there is at least one TRTxxP:)
for $record in $datasetdoc[$trtpoid and $usubjidoidbsd]//odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
(: get the value of TRTP and the value of the USUBJID :)
let $trtpvalue := $record/odm:ItemData[@ItemOID=$trtpoid]/@Value
let $usubjidvalue := $record/odm:ItemData[@ItemOID=$usubjidoidbsd]/@Value
(: get all TRTxxP values for this subject in ADSL :)
let $trtxxpvalues := $adsldoc//odm:ItemGroupData[odm:ItemData[@ItemOID=$usubjidoidadsl and @Value=$usubjidvalue]]/odm:ItemData[functx:is-value-in-sequence(@ItemOID,$trtxxpoids)]/@Value
(: TRTP value must be one of the TRTxxP values :)
where $trtpvalue and count($trtxxpvalues)>0 and not(functx:is-value-in-sequence($trtpvalue,$trtxxpvalues))
return The value for TRTP '{data($trtpvalue)}' in dataset {data($datasetname)} did not match any of the TRTxxP values '{data($trtxxpvalues)}' in the ADSL dataset for USUBJID={data($usubjidvalue)}
]]>
There may only be one value of TRTPN for a given value of TRTP
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
(: Get the TRTPN value :)
let $trtpnvalue := $record/odm:ItemData[@ItemOID=$trtpnoid]/@Value
(: take the previous record in the same group, and take its TRTPN value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $trtpnvalue2 := $precrecord/odm:ItemData[@ItemOID=$trtpnoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: report an error when the 2 records have different values for TRTPN :)
where not($trtpnvalue=$trtpnvalue2)
return There is more than one value of TRTPN for a given value of TRTP='{data($trtpvalue)}': In record {data($recnum)} a value of TRTPN='{data($trtpnvalue)}' is found whereas for record {data($recnum2)} a value TRTPN='{data($trtpnvalue2)}' is found
]]>
There may only be one value of TRTPN for a given value of TRTP, single dataset
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
(: Get the TRTPN value :)
let $trtpnvalue := $record/odm:ItemData[@ItemOID=$trtpnoid]/@Value
(: take the previous record in the same group, and take its TRTPN value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $trtpnvalue2 := $precrecord/odm:ItemData[@ItemOID=$trtpnoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: report an error when the 2 records have different values for TRTPN :)
where not($trtpnvalue=$trtpnvalue2)
return There is more than one value of TRTPN for a given value of TRTP='{data($trtpvalue)}': In record {data($recnum)} a value of TRTPN='{data($trtpnvalue)}' is found whereas for record {data($recnum2)} a value TRTPN='{data($trtpnvalue2)}' is found
]]>
There may only be one value of TRTP for a given value of TRTPN
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
(: Get the TRTP value :)
let $trtpvalue := $record/odm:ItemData[@ItemOID=$trtpoid]/@Value
(: take the previous record in the same group, and take its TRTP value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $trtpvalue2 := $precrecord/odm:ItemData[@ItemOID=$trtpoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: report an error when the 2 records have different values for TRTP :)
where not($trtpvalue=$trtpvalue2)
return There is more than one value of TRTP for a given value of TRTPN='{data($trtpnvalue)}': In record {data($recnum)} a value of TRTP='{data($trtpvalue)}' is found whereas for record {data($recnum2)} a value TRTP='{data($trtpvalue2)}' is found
]]>
There may only be one value of TRTP for a given value of TRTPN, single dataset
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
(: Get the TRTP value :)
let $trtpvalue := $record/odm:ItemData[@ItemOID=$trtpoid]/@Value
(: take the previous record in the same group, and take its TRTP value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $trtpvalue2 := $precrecord/odm:ItemData[@ItemOID=$trtpoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: report an error when the 2 records have different values for TRTP :)
where not($trtpvalue=$trtpvalue2)
return There is more than one value of TRTP for a given value of TRTPN='{data($trtpnvalue)}': In record {data($recnum)} a value of TRTP='{data($trtpvalue)}' is found whereas for record {data($recnum2)} a value TRTP='{data($trtpvalue2)}' is found
]]>
There may only be one value of TRTAN for a given value of TRTA
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
let $trtanvalue := $record/odm:ItemData[@ItemOID=$trtanoid]/@Value
(: take the previous record in the same group, and take its TRTAN value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $trtanvalue2 := $precrecord/odm:ItemData[@ItemOID=$trtanoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: when the value of TRTAN in both records is different, report an error :)
where not($trtanvalue = $trtanvalue2)
return There is more than one value of TRTAN for a given value of TRTA='{data($trtavalue)}' in dataset {data($datasetname)}: In record {data($recnum)} a value of TRTAN='{data($trtanvalue)}' is found whereas for record {data($recnum2)} a value TRTAN='{data($trtanvalue2)}' is found
]]>
There may only be one value of TRTAN for a given value of TRTA, single dataset
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
let $trtanvalue := $record/odm:ItemData[@ItemOID=$trtanoid]/@Value
(: take the previous record in the same group, and take its TRTAN value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $trtanvalue2 := $precrecord/odm:ItemData[@ItemOID=$trtanoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: when the value of TRTAN in both records is different, report an error :)
where not($trtanvalue = $trtanvalue2)
return There is more than one value of TRTAN for a given value of TRTA='{data($trtavalue)}' in dataset {data($datasetname)}: In record {data($recnum)} a value of TRTAN='{data($trtanvalue)}' is found whereas for record {data($recnum2)} a value TRTAN='{data($trtanvalue2)}' is found
]]>
There may only be one value of TRTA for a given value of TRTAN
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
let $trtavalue := $record/odm:ItemData[@ItemOID=$trtaoid]/@Value
(: take the previous record in the same group, and take its APERIODC value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $trtavalue2 := $precrecord/odm:ItemData[@ItemOID=$trtaoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: when the value of TRTA in both records is different, report an error :)
where not($trtavalue = $trtavalue2)
return There is more than one value of TRTAN for a given value of TRTA in dataset {data($datasetname)}: In record {data($recnum)} a value of TRTAN='{data($trtanvalue)}' and TRTPA='{data($trtavalue)}' is found whereas for record {data($recnum2)} a value TRTA='{data($trtavalue2)}' is found
]]>
There may only be one value of TRTA for a given value of TRTAN, single dataset
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
let $trtavalue := $record/odm:ItemData[@ItemOID=$trtaoid]/@Value
(: take the previous record in the same group, and take its APERIODC value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $trtavalue2 := $precrecord/odm:ItemData[@ItemOID=$trtaoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: when the value of TRTA in both records is different, report an error :)
where not($trtavalue = $trtavalue2)
return There is more than one value of TRTAN for a given value of TRTA in dataset {data($datasetname)}: In record {data($recnum)} a value of TRTAN='{data($trtanvalue)}' and TRTPA='{data($trtavalue)}' is found whereas for record {data($recnum2)} a value TRTA='{data($trtavalue2)}' is found
]]>
A variable with a suffix of STDY has a value greater than a value of a variable with the same root and a suffix of ENDY
BDS
The variable with a suffix of STDY '{data($stdyname)}' in dataset {data($datasetname)} has a value '{data($stdyvalue)}' greater than the value '{data($endyvalue)}' of a variable with the same root and a suffix of ENDY '{data($endyname)}'
]]>
A variable with a suffix of STDY has a value greater than a value of a variable with the same root and a suffix of ENDY
BDS
The variable with a suffix of STDY '{data($stdyname)}' in dataset {data($datasetname)} has a value '{data($stdyvalue)}' greater than the value '{data($endyvalue)}' of a variable with the same root and a suffix of ENDY '{data($endyname)}'
]]>
Within a given value of PARAMCD, there may only be one value of AVISITN for a given value of AVISIT
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
let $avisitnvalue := $record/odm:ItemData[@ItemOID=$avisitnoid]/@Value
(: take the previous record in the same group, and take its AVISITN value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $avisitnvalue2 := $precrecord/odm:ItemData[@ItemOID=$avisitnoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: when the value of AVISITN in both records is different, report an error :)
where not($avisitnvalue = $avisitnvalue2)
return Within the given value of PARAMCD={data($paramcdvalue)}, there is more than one value of AVISITN for the given value of AVISIT={data($avisitvalue)} in dataset {data($datasetname)}. Record number {data($recnum)} has value AVISITN='{data($avisitnvalue)}' whereas record number {data($recnum2)} has value AVISITN='{data($avisitnvalue2)}'
]]>
Within a given value of PARAMCD, there may only be one value of AVISITN for a given value of AVISIT, single dataset
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
let $avisitnvalue := $record/odm:ItemData[@ItemOID=$avisitnoid]/@Value
(: take the previous record in the same group, and take its AVISITN value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $avisitnvalue2 := $precrecord/odm:ItemData[@ItemOID=$avisitnoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: when the value of AVISITN in both records is different, report an error :)
where not($avisitnvalue = $avisitnvalue2)
return Within the given value of PARAMCD={data($paramcdvalue)}, there is more than one value of AVISITN for the given value of AVISIT={data($avisitvalue)} in dataset {data($datasetname)}. Record number {data($recnum)} has value AVISITN='{data($avisitnvalue)}' whereas record number {data($recnum2)} has value AVISITN='{data($avisitnvalue2)}'
]]>
Within a given value of PARAMCD, there may only be one value of AVISIT for a given value of AVISITN
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
let $avisitvalue := $record/odm:ItemData[@ItemOID=$avisitoid]/@Value
(: take the previous record in the same group, and take its AVISIT value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $avisitvalue2 := $precrecord/odm:ItemData[@ItemOID=$avisitoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: when the value of AVISIT in both records is different, report an error :)
where not($avisitvalue = $avisitvalue2)
return Within the given value of PARAMCD={data($paramcdvalue)}, there is more than one value of AVISIT for the given value of AVISITN={data($avisitnvalue)} in dataset {data($datasetname)}. Record number {data($recnum)} has value AVISIT='{data($avisitvalue)}' whereas record number {data($recnum2)} has value AVISIT='{data($avisitvalue2)}'
]]>
Within a given value of PARAMCD, there may only be one value of AVISITN for a given value of AVISIT
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
let $avisitvalue := $record/odm:ItemData[@ItemOID=$avisitoid]/@Value
(: take the previous record in the same group, and take its AVISIT value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $avisitvalue2 := $precrecord/odm:ItemData[@ItemOID=$avisitoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: when the value of AVISIT in both records is different, report an error :)
where not($avisitvalue = $avisitvalue2)
return Within the given value of PARAMCD={data($paramcdvalue)}, there is more than one value of AVISIT for the given value of AVISITN={data($avisitnvalue)} in dataset {data($datasetname)}. Record number {data($recnum)} has value AVISIT='{data($avisitvalue)}' whereas record number {data($recnum2)} has value AVISIT='{data($avisitvalue2)}'
]]>
There may only be one value of PARCATy for a given value of PARAMCD
BDS
0 and number(substring(@Name,7,1)) < 10]/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: iterate over the PARCATy variables :)
for $parcatyoid in $parcatyoids
(: get the name :)
let $parcatyname := $definedoc//odm:ItemDef[@OID=$parcatyoid]/@Name
(: group the records by the value of PARAMCD and PARCATy :)
(: Group the records (ItemGroupData) by PARAMCD :)
let $orderedrecords := (
for $record in $datasetdoc//odm:ItemGroupData[odm:ItemData[@ItemOID=$paramcdoid]]
group by $b:=$record/odm:ItemData[@ItemOID=$paramcdoid]/@Value
return element group {
$record
}
)
(: Within the group there may only be one value for PARCATy :)
for $group in $orderedrecords
(: The value of PARAMCD is fixed withing the group - take it from the first record :)
let $paramcdvalue := $group/odm:ItemGroupData[1]/odm:ItemData[@ItemOID=$paramcdoid]/@Value
(: iterate over all records in the group starting from the second record :)
for $record in $group/odm:ItemGroupData[position>1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
let $parcatyvalue := $record/odm:ItemData[@ItemOID=$parcatyoid]/@Value
(: take the previous record in the same group, and take its BASE value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $parcatyvalue2 := $precrecord/odm:ItemData[@ItemOID=$parcatyoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: report an error when the 2 records have different values for PARCATy :)
where not($parcatyvalue=$parcatyvalue2)
return There is more than one value of {data($parcatyname)} for a given value of PARAMCD={data($paramcdvalue)}. Record {data($recnum)} has {data($parcatyname)}={data($parcatyvalue)} whereas record {data($recnum2)} has {data($parcatyname)}={data($parcatyvalue2)}
]]>
There may only be one value of PARCATy for a given value of PARAMCD, single dataset
BDS
0 and number(substring(@Name,7,1)) < 10]/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: iterate over the PARCATy variables :)
for $parcatyoid in $parcatyoids
(: get the name :)
let $parcatyname := $definedoc//odm:ItemDef[@OID=$parcatyoid]/@Name
(: group the records by the value of PARAMCD and PARCATy :)
(: Group the records (ItemGroupData) by PARAMCD :)
let $orderedrecords := (
for $record in $datasetdoc//odm:ItemGroupData[odm:ItemData[@ItemOID=$paramcdoid]]
group by $b:=$record/odm:ItemData[@ItemOID=$paramcdoid]/@Value
return element group {
$record
}
)
(: Within the group there may only be one value for PARCATy :)
for $group in $orderedrecords
(: The value of PARAMCD is fixed withing the group - take it from the first record :)
let $paramcdvalue := $group/odm:ItemGroupData[1]/odm:ItemData[@ItemOID=$paramcdoid]/@Value
(: iterate over all records in the group starting from the second record :)
for $record in $group/odm:ItemGroupData[position>1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
let $parcatyvalue := $record/odm:ItemData[@ItemOID=$parcatyoid]/@Value
(: take the previous record in the same group, and take its BASE value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $parcatyvalue2 := $precrecord/odm:ItemData[@ItemOID=$parcatyoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: report an error when the 2 records have different values for PARCATy :)
where not($parcatyvalue=$parcatyvalue2)
return There is more than one value of {data($parcatyname)} for a given value of PARAMCD={data($paramcdvalue)}. Record {data($recnum)} has {data($parcatyname)}={data($parcatyvalue)} whereas record {data($recnum2)} has {data($parcatyname)}={data($parcatyvalue2)}
]]>
If BASE is populated then there must be a corresponding AVALC value with ABLFL=Y
BDS
Within the given value of PARAMCD={data($paramcdvalue)} for subject '{data($usubjidvalue)}', BASE is populated and there is not at least one record with ABLFL equal to 'Y'
]]>
If BASE is populated then there must be a corresponding AVALC value with ABLFL=Y, single dataset
BDS
Within the given value of PARAMCD={data($paramcdvalue)} for subject '{data($usubjidvalue)}', BASE is populated and there is not at least one record with ABLFL equal to 'Y'
]]>
If BASEC is populated then there must be a corresponding AVALC value with ABLFL=Y
BDS
Within the given value of PARAMCD={data($paramcdvalue)} for subject '{data($usubjidvalue)}', BASEC is populated and there is not at least one record with ABLFL equal to 'Y'
]]>
If BASEC is populated then there must be a corresponding AVALC value with ABLFL=Y, single dataset
BDS
Within the given value of PARAMCD={data($paramcdvalue)} for subject '{data($usubjidvalue)}', BASEC is populated and there is not at least one record with ABLFL equal to 'Y'
]]>
Within a given value of PARAMCD for a subject, there may only be one value of BASE for a given value of BASEC
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
let $basevalue := $record/odm:ItemData[@ItemOID=$baseoid]
(: take the previous record in the same group, and take its BASE value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $basevalue2 := $precrecord/odm:ItemData[@ItemOID=$baseoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: when there is a value of BASEC in the previous record, and it is different from the value of BASEC in the current record, report an error :)
where $basevalue and $basevalue2 and not($basevalue=$basevalue2)
return Within a given value of USUBJID='{data($usubjidvalue)}' and of PARAMCD='{data($paramcdvalue)}', there is
more than one value of BASE for the given value of BASEC={data($basecvalue)} in dataset. Record number {data($recnum)} has BASE='{data($basevalue)}' whereas record {data($recnum2)} has BASE='{data($basevalue2)}' in dataset {data($datasetname)}
]]>
Within a given value of PARAMCD for a subject, there may only be one value of BASE for a given value of BASEC, single dataset
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
let $basevalue := $record/odm:ItemData[@ItemOID=$baseoid]
(: take the previous record in the same group, and take its BASE value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $basevalue2 := $precrecord/odm:ItemData[@ItemOID=$baseoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: when there is a value of BASEC in the previous record, and it is different from the value of BASEC in the current record, report an error :)
where $basevalue and $basevalue2 and not($basevalue=$basevalue2)
return Within a given value of USUBJID='{data($usubjidvalue)}' and of PARAMCD='{data($paramcdvalue)}', there is
more than one value of BASE for the given value of BASEC={data($basecvalue)} in dataset. Record number {data($recnum)} has BASE='{data($basevalue)}' whereas record {data($recnum2)} has BASE='{data($basevalue2)}' in dataset {data($datasetname)}
]]>
Within a given value of PARAMCD for a subject, there may only be one value of BASEC for a given value of BASE
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
let $basecvalue := $record/odm:ItemData[@ItemOID=$basecoid]
(: take the previous record in the same group, and take its BASEC value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $basecvalue2 := $precrecord/odm:ItemData[@ItemOID=$basecoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: when there is a value of BASEC in the previous record, and it is different from the value of BASEC in the current record, report an error :)
where $basecvalue and $basecvalue2 and not($basecvalue=$basecvalue2)
return Within a given value of USUBJID='{data($usubjidvalue)}' and of PARAMCD='{data($paramcdvalue)}', there is
more than one value of BASEC for the given value of BASE={data($basevalue)} in dataset. Record number {data($recnum)} has BASEC='{data($basecvalue)}' whereas record {data($recnum2)} has BASEC='{data($basecvalue2)}' in dataset {data($datasetname)}
]]>
Within a given value of PARAMCD for a subject, there may only be one value of BASEC for a given value of BASE, single dataset
BDS
1] (: start from the second one :)
let $recnum := $record/@data:ItemGroupDataSeq
let $basecvalue := $record/odm:ItemData[@ItemOID=$basecoid]
(: take the previous record in the same group, and take its BASEC value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $basecvalue2 := $precrecord/odm:ItemData[@ItemOID=$basecoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: when there is a value of BASEC in the previous record, and it is different from the value of BASEC in the current record, report an error :)
where $basecvalue and $basecvalue2 and not($basecvalue=$basecvalue2)
return Within a given value of USUBJID='{data($usubjidvalue)}' and of PARAMCD='{data($paramcdvalue)}', there is
more than one value of BASEC for the given value of BASE={data($basevalue)} in dataset. Record number {data($recnum)} has BASEC='{data($basecvalue)}' whereas record {data($recnum2)} has BASEC='{data($basecvalue2)}' in dataset {data($datasetname)}
]]>
If BASETYPE is populated for at least one record within a parameter then it must be populated for all records within that parameter
BDS
Within the given value of PARAMCD={data($paramcdvalue)}, BASETYPE is populated for at least one record, but not for all records. Number of records expected is {data($recordcount)}, number of records found is {data($basetypecount)} in dataset {data($datasetname)}
]]>
If BASETYPE is populated for at least one record within a parameter then it must be populated for all records within that parameter, single dataset
BDS
Within the given value of PARAMCD={data($paramcdvalue)}, BASETYPE is populated for at least one record, but not for all records. Number of records expected is {data($recordcount)}, number of records found is {data($basetypecount)} in dataset {data($datasetname)}
]]>
R2BASE must equal AVAL/BASE
BDS
R2BASE value {data($r2basevalue)} is not equal to AVAL value {data($avalvalue)} divided by BASE value {data($basevalue)}
]]>
R2BASE must equal AVAL/BASE, single dataset
BDS
R2BASE value {data($r2basevalue)} is not equal to AVAL value {data($avalvalue)} divided by BASE value {data($basevalue)}
]]>
R2AyLO must equal AVAL/AyLO
BDS
0 and number(substring(@Name,2,1))<10 and ends-with(@Name,'LO')]/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
let $avaloid := (
for $a in $definedoc//odm:ItemDef[@Name='AVAL']/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: iterate over the ALyO variables within this dataset :)
for $ayloid in $aylooids
(: get the name of the R2AyLO :)
let $ayloname := $definedoc//odm:ItemDef[@OID=$ayloid]/@Name
(:construct the name of the corresponding ALy:)
let $r2ayloname := concat('R2A',substring($ayloname,2,1),'LO')
(: and get the OID :)
let $r2aylooid := (
for $a in $definedoc//odm:ItemDef[@Name=$r2ayloname]/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: iterate over all records in the dataset that have all 3 variables -
skip the dataset if not all 3 variables are defined for it :)
for $record in $datasetdoc[$avaloid and $ayloid and $r2aylooid]//odm:ItemGroupData[odm:ItemData[@ItemOID=$r2aylooid] and odm:ItemData[@ItemOID=$ayloid] and odm:ItemData[@ItemOID=$avaloid]]
let $recnum := $record/@data:ItemGroupDataSeq
(: get the values - if any :)
let $avalvalue := $record/odm:ItemData[@ItemOID=$avaloid]/@Value
let $aylovalue := $record/odm:ItemData[@ItemOID=$ayloid]/@Value
let $r2aylovalue := $record/odm:ItemData[@ItemOID=$r2aylooid]/@Value
where not($r2aylovalue = $avalvalue div $aylovalue)
return {data($r2ayloname)} value {data($r2aylovalue)} is not equal to AVAL value {data($avalvalue)} divided by {data($ayloname)} value {data($aylovalue)} in dataset {data($datasetname)}
]]>
R2AyLO must equal AVAL/AyLO, single dataset
BDS
0 and number(substring(@Name,2,1))<10 and ends-with(@Name,'LO')]/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
let $avaloid := (
for $a in $definedoc//odm:ItemDef[@Name='AVAL']/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: iterate over the ALyO variables within this dataset :)
for $ayloid in $aylooids
(: get the name of the R2AyLO :)
let $ayloname := $definedoc//odm:ItemDef[@OID=$ayloid]/@Name
(:construct the name of the corresponding ALy:)
let $r2ayloname := concat('R2A',substring($ayloname,2,1),'LO')
(: and get the OID :)
let $r2aylooid := (
for $a in $definedoc//odm:ItemDef[@Name=$r2ayloname]/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: iterate over all records in the dataset that have all 3 variables -
skip the dataset if not all 3 variables are defined for it :)
for $record in $datasetdoc[$avaloid and $ayloid and $r2aylooid]//odm:ItemGroupData[odm:ItemData[@ItemOID=$r2aylooid] and odm:ItemData[@ItemOID=$ayloid] and odm:ItemData[@ItemOID=$avaloid]]
let $recnum := $record/@data:ItemGroupDataSeq
(: get the values - if any :)
let $avalvalue := $record/odm:ItemData[@ItemOID=$avaloid]/@Value
let $aylovalue := $record/odm:ItemData[@ItemOID=$ayloid]/@Value
let $r2aylovalue := $record/odm:ItemData[@ItemOID=$r2aylooid]/@Value
where not($r2aylovalue = $avalvalue div $aylovalue)
return {data($r2ayloname)} value {data($r2aylovalue)} is not equal to AVAL value {data($avalvalue)} divided by {data($ayloname)} value {data($aylovalue)} in dataset {data($datasetname)}
]]>
R2AyHI must equal AVAL/AyHI
BDS
0 and number(substring(@Name,2,1))<10 and ends-with(@Name,'HI')]/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
let $avaloid := (
for $a in $definedoc//odm:ItemDef[@Name='AVAL']/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: iterate over the ALyO variables within this dataset :)
for $ayhioid in $ayhioids
(: get the name of the R2AyHI :)
let $ayhiname := $definedoc//odm:ItemDef[@OID=$ayhioid]/@Name
(:construct the name of the corresponding ALy:)
let $r2ayhiname := concat('R2A',substring($ayhiname,2,1),'HI')
(: and get the OID :)
let $r2ayhioid := (
for $a in $definedoc//odm:ItemDef[@Name=$r2ayhiname]/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: iterate over all records in the dataset that have all 3 variables -
skip the dataset if not all 3 variables are defined for it :)
for $record in $datasetdoc[$avaloid and $ayhioid and $r2ayhioid]//odm:ItemGroupData[odm:ItemData[@ItemOID=$r2ayhioid] and odm:ItemData[@ItemOID=$ayhioid] and odm:ItemData[@ItemOID=$avaloid]]
let $recnum := $record/@data:ItemGroupDataSeq
(: get the values - if any :)
let $avalvalue := $record/odm:ItemData[@ItemOID=$avaloid]/@Value
let $ayhivalue := $record/odm:ItemData[@ItemOID=$ayhioid]/@Value
let $r2ayhivalue := $record/odm:ItemData[@ItemOID=$r2ayhioid]/@Value
where not($r2ayhivalue = $avalvalue div $ayhivalue)
return {data($r2ayhiname)} value {data($r2ayhivalue)} is not equal to AVAL value {data($avalvalue)} divided by {data($ayhiname)} value {data($ayhivalue)} in dataset {data($datasetname)}
]]>
R2AyHI must equal AVAL/AyHI, single dataset
BDS
0 and number(substring(@Name,2,1))<10 and ends-with(@Name,'HI')]/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
let $avaloid := (
for $a in $definedoc//odm:ItemDef[@Name='AVAL']/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: iterate over the ALyO variables within this dataset :)
for $ayhioid in $ayhioids
(: get the name of the R2AyHI :)
let $ayhiname := $definedoc//odm:ItemDef[@OID=$ayhioid]/@Name
(:construct the name of the corresponding ALy:)
let $r2ayhiname := concat('R2A',substring($ayhiname,2,1),'HI')
(: and get the OID :)
let $r2ayhioid := (
for $a in $definedoc//odm:ItemDef[@Name=$r2ayhiname]/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: iterate over all records in the dataset that have all 3 variables -
skip the dataset if not all 3 variables are defined for it :)
for $record in $datasetdoc[$avaloid and $ayhioid and $r2ayhioid]//odm:ItemGroupData[odm:ItemData[@ItemOID=$r2ayhioid] and odm:ItemData[@ItemOID=$ayhioid] and odm:ItemData[@ItemOID=$avaloid]]
let $recnum := $record/@data:ItemGroupDataSeq
(: get the values - if any :)
let $avalvalue := $record/odm:ItemData[@ItemOID=$avaloid]/@Value
let $ayhivalue := $record/odm:ItemData[@ItemOID=$ayhioid]/@Value
let $r2ayhivalue := $record/odm:ItemData[@ItemOID=$r2ayhioid]/@Value
where not($r2ayhivalue = $avalvalue div $ayhivalue)
return {data($r2ayhiname)} value {data($r2ayhivalue)} is not equal to AVAL value {data($avalvalue)} divided by {data($ayhiname)} value {data($ayhivalue)} in dataset {data($datasetname)}
]]>
Within a given value of PARAMCD, there may only be one value of SHIFTy for a given value of SHIFTyN
BDS
0 and number(substring(@Name,6,1))<10]/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: we also need the OID for the PARAMCD variable :)
let $paramcdoid := (
for $a in $definedoc//odm:ItemDef[@Name='PARAMCD']/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: iterate over the SHIFTyN variables :)
for $shiftynoid in $shiftynoids
(: construct the name of the corresponding SHIFTy variable :)
let $shiftynname := $definedoc//odm:ItemDef[@OID=$shiftynoid]/@Name
let $shiftyname := concat('SHIFT',substring($shiftynname,6,1))
(: and the OID of SHIFTY :)
let $shiftyoid := (
for $a in $definedoc//odm:ItemDef[@Name=$shiftyname]/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: order the records by PARAMCD and SHIFTyN - IMPORTANT: only take the ones that actually DO have PARAMCD and SHIFyN AND SHIFTy :)
let $orderedrecords := (
for $record in $datasetdoc//odm:ItemGroupData[odm:ItemData[@ItemOID=$paramcdoid] and odm:ItemData[@ItemOID=$shiftynoid] and odm:ItemData[@ItemOID=$shiftyoid]]
group by $a:=$record/odm:ItemData[@ItemOID=$paramcdoid]/@Value,
$b:= $record/odm:ItemData[@ItemOID=$shiftynoid]/@Value
return element group { (: create a new "group" element, one per group of similar ItemGroupData elements - TODO: only keep the 3 ItemData elements, PARAMCD, SHIFTy and SHIFTyN :)
$record
}
)
(: iterate over all grouped records, but only those that have at least 2 elements :)
for $group in $orderedrecords[count(./*)>1]
(: all ItemData elements for SHIFTy must have the same value.
This could easily be done using distinct-values,
but we also want to report on the record numbers for which there is a violation :)
for $record in $group/odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
let $shiftynvalue := $record/odm:ItemData[@ItemOID=$shiftynoid]/@Value
let $shiftyvalue := $record/odm:ItemData[@ItemOID=$shiftyoid]/@Value
let $paramcdvalue := $record/odm:ItemData[@ItemOID=$paramcdoid]/@Value
(: take the previous record in the same group, and take its SHIFTy value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $shiftyvalue2 := $precrecord/odm:ItemData[@ItemOID=$shiftyoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: when there is a value of SHIFTy in the previous record, and it is different from the value of SHIFTy in the current record :)
where $shiftyvalue2 and not($shiftyvalue2=$shiftyvalue)
return Within a given value of PARAMCD '{data($paramcdvalue)}', there is
more than one value of {data($shiftynname)} for the given value of {data($shiftynname)}={data($shiftynvalue)} in dataset. Record number {data($recnum)} has {data($shiftyname)}='{data($shiftyvalue)}' whereas
record {data($recnum2)} has {data($shiftyname)}='{data($shiftyvalue2)}' in dataset {data($datasetname)}
]]>
Within a given value of PARAMCD, there may only be one value of SHIFTy for a given value of SHIFTyN, single dataset
BDS
0 and number(substring(@Name,6,1))<10]/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: we also need the OID for the PARAMCD variable :)
let $paramcdoid := (
for $a in $definedoc//odm:ItemDef[@Name='PARAMCD']/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: iterate over the SHIFTyN variables :)
for $shiftynoid in $shiftynoids
(: construct the name of the corresponding SHIFTy variable :)
let $shiftynname := $definedoc//odm:ItemDef[@OID=$shiftynoid]/@Name
let $shiftyname := concat('SHIFT',substring($shiftynname,6,1))
(: and the OID of SHIFTY :)
let $shiftyoid := (
for $a in $definedoc//odm:ItemDef[@Name=$shiftyname]/@OID
where $a = $itemgroupdef/odm:ItemRef/@ItemOID
return $a
)
(: order the records by PARAMCD and SHIFTyN - IMPORTANT: only take the ones that actually DO have PARAMCD and SHIFyN AND SHIFTy :)
let $orderedrecords := (
for $record in $datasetdoc//odm:ItemGroupData[odm:ItemData[@ItemOID=$paramcdoid] and odm:ItemData[@ItemOID=$shiftynoid] and odm:ItemData[@ItemOID=$shiftyoid]]
group by $a:=$record/odm:ItemData[@ItemOID=$paramcdoid]/@Value,
$b:= $record/odm:ItemData[@ItemOID=$shiftynoid]/@Value
return element group { (: create a new "group" element, one per group of similar ItemGroupData elements - TODO: only keep the 3 ItemData elements, PARAMCD, SHIFTy and SHIFTyN :)
$record
}
)
(: iterate over all grouped records, but only those that have at least 2 elements :)
for $group in $orderedrecords[count(./*)>1]
(: all ItemData elements for SHIFTy must have the same value.
This could easily be done using distinct-values,
but we also want to report on the record numbers for which there is a violation :)
for $record in $group/odm:ItemGroupData
let $recnum := $record/@data:ItemGroupDataSeq
let $shiftynvalue := $record/odm:ItemData[@ItemOID=$shiftynoid]/@Value
let $shiftyvalue := $record/odm:ItemData[@ItemOID=$shiftyoid]/@Value
let $paramcdvalue := $record/odm:ItemData[@ItemOID=$paramcdoid]/@Value
(: take the previous record in the same group, and take its SHIFTy value :)
let $precrecord := $record/preceding-sibling::odm:ItemGroupData[1] (: as they come in descending order :)
let $shiftyvalue2 := $precrecord/odm:ItemData[@ItemOID=$shiftyoid]/@Value
let $recnum2 := $precrecord/@data:ItemGroupDataSeq
(: when there is a value of SHIFTy in the previous record, and it is different from the value of SHIFTy in the current record :)
where $shiftyvalue2 and not($shiftyvalue2=$shiftyvalue)
return Within a given value of PARAMCD '{data($paramcdvalue)}', there is
more than one value of {data($shiftynname)} for the given value of {data($shiftynname)}={data($shiftynvalue)} in dataset. Record number {data($recnum)} has {data($shiftyname)}='{data($shiftyvalue)}' whereas
record {data($recnum2)} has {data($shiftyname)}='{data($shiftyvalue2)}' in dataset {data($datasetname)}
]]>