GetSubjectData GetCDISCSubjectData |
These routines enable you to request data by sending an XML string containing details of the data required. For both routines, MACRO will return the data as an XML string. Each request for data from MACRO must include a MACRO user object, representing the currently logged in user, as returned from the login procedure.
Input
Parameter |
Description |
user |
Currently logged-in user as returned from Login |
dataRequestXml |
XML string specifying the MACRO subject details and the names of the data items required |
Requesting data in MACRO format:
public static DataRequestResult GetSubjectData(UserProperties user, string dataRequestXml, ref string returnedDataXml) |
Requesting data in CDISC format:
public static DataRequestResult GetCDISCSubjectData(UserProperties user, string dataRequestXml, ref string returnedDataXml) |
Output
· Return code indicating success or nature of failure
· returnedDataXml - if the request succeeds, an XML string containing requested data values is returned. When using GetCDISCSubjectData this will be a CDISC-compliant string
The following XML request string returns data for the subject with label "N3001" at site "london" for study "Demostudy40". The data requested is the specified questions from the Cover and Demography eForms in the Screening visit; all the data from the Treatment visit; and all the data from the ECG1 form in the Followup visit.
<?xml version="1.0"?> <MACROSubject Study="Demostudy40" Site="london" Label="N3001"> <Visit Code="screening"> <Eform Code="cover"> <Question Code="subject"/> <Question Code="initials"/> <Question Code="dobirth"/> <Question Code="sex"/> </Eform> <Eform Code="demography"> <Question Code="race"/> <Question Code="raceother"/> <Question Code="smoke"/> <Question Code="gender"/> <Question Code="type"/> </Eform> </Visit> <Visit Code="treatment"/> <Visit Code="followup"> <Eform Code="ECG1"/> </Visit> </MACROSubject > |
The following XML requests data for subject with ID 3 at site "london" for study "Demostudy40".
<?xml version="1.0"?> <MACROSubject Study="Demostudy40" Site="london" Id="3"> <Visit Code="screening"> <Eform Code="cover"/> </Visit> <Visit Code="treatment"/> <Visit Code="followup"> <Eform Code="ECG1"/> </Visit> </MACROSubject > |
Note that:
· If no eForms are specified in a visit, all responses on all eForms in that visit will be returned
· If no questions are specified for an eForm, all responses on the eForm will be returned
· If no visits are specified, the entire set of data for the subject will be returned
· If no cycle is specified, cycle = 1 is assumed
· Cycle=0 means all cycles
For the first of the above XML request strings, XML output such as the following will be returned.
<?xml version="1.0"?> <MACROSubject Study="Demostudy40" Site="london" Id="3"> <Visit Code="screening" Cycle="1"> <Eform Code="cover" Cycle="1"> <Question Code="subject" Cycle="1" Value="123"/> <Question Code="initials" Cycle="1" Value="PAS"/> <Question Code="dobirth" Cycle="1" "02/04/1966" StandardValue="24199"/> <Question Code="sex" Cycle="1" Value="Male"/> </Eform> <Eform Code="demography" Cycle="1"> <Question Code="race" Cycle="1" Value="other"/> <Question Code="raceother" Cycle="1" Value="Inuit"/> <Question Code="smoke" Cycle="1" Value="No"/> <Question Code="gender" Cycle="1" Value="male"/> <Question Code="type" Cycle="1" Value="Healthy volunteer"/> </Eform> </Visit> <!— All data from treatment visit and eForm ECG1 in the followup visit follow similarly… --> </MACROSubject > |
For date questions, a "Standard Value" attribute is also returned – this is the date represented in standard Microsoft format, as a decimal number where the integer part is the number of days since 31 Dec 1899, and the decimal part is the fraction of the day. This value is independent of the MACRO date format specified for the question. If the value is copied and pasted into an Excel spreadsheet with format date/time, the formatted date value can be seen.
You can also use the API to retrieve the various status details for given subjects/visits/eForms/questions. To do this, add the following optional Scope attributes to the MACROSubject node in the input XML string, specifying which status and which object statuses are required, i.e. Subject, Visit, eForm or Question:
· StatusScope – Data Status
· LFScope – Lock / Freeze Status
· DCRScope – DCR Status
· SDVScope – SDV Status
· NoteScope – Note Status
The value of the attribute may be one of the following:
· Subject – The appropriate status will be output for Subject level only
· Visit – The appropriate status will be output for Subject and Visit levels only
· Eform – The appropriate status will be output for Subject, Visit and Eform levels.
· Question – The appropriate status will be output for all scope levels, i.e. Subject, Visit, Eform and Question.
StatusOnly. If this optional attribute is set to true, and a status scope has been specified, then data values will be suppressed from the output, and status values will only be retrieved down to the level specified.
For example, to request the DCR status of all questions on the Cover sheet in the Screening visit for a Demostudy40 subject, use the following XML request string:
<MACROSubject Study="Demostudy40" Site="london" Id="23" DCRScope="Question" StatusOnly="true"> <Visit Code="screening" > <Eform Code="cover" /> </Visit> </MACROSubject> |
In the XML output string, the requested status will be shown as the following attribute names:
· Status - if StatusScope specified
· LFStatus – if LFScope specified
· DCRStatus – if DCRScope specified
· SDVStatus – if SDVScope specified
· NoteStatus – if NoteScope specified
This XML input string requests the subject status for subject Demostudy40/london/23:
<MACROSubject Study="Demostudy40" Site="london" Id="23" StatusScope="Subject" StatusOnly="true"/> |
and gives the following output, including the Status attribute(s) in the relevant nodes:
<MACROSubject Study="Demostudy40" Site="london" Label="BDF 357X" Id="23" Status="30"/> |
This XML input string requests the lock status and DCR status for the subject and visits for subject Demostudy40/ruthin/OFN 158X:
<MACROSubject Study="Demostudy40" Site="ruthin" Label="OFN 158X" LFScope="Visit" DCRScope="Visit" StatusOnly="true"/> |
and gives the following output:
<MACROSubject Study="Demostudy40" Site="ruthin" Label="OFN 158X" Id="5" LFStatus="0" DCRStatus="30"> <Visit Code="screening" Cycle="1" LFStatus="0" DCRStatus="30" /> <Visit Code="treatment" Cycle="1" LFStatus="5" DCRStatus="0" /> <Visit Code="Treatment1" Cycle="1" LFStatus="0" DCRStatus="0" /> <Visit Code="Treatment2" Cycle="1" LFStatus="6" DCRStatus="30" /> <Visit Code="Treatment3" Cycle="1" LFStatus="0" DCRStatus="0" /> <Visit Code="Treatment4" Cycle="1" LFStatus="0" DCRStatus="0" /> <Visit Code="followup" Cycle="1" LFStatus="0" DCRStatus="0" /> <Visit Code="completion" Cycle="1" LFStatus="0" DCRStatus="0" /> </MACROSubject> |
The Subject data request routines return an integer code as type DataRequestResult indicating the result, as listed in the table below.
Code |
Value |
Description |
0 |
Success |
Retrieval was successful |
1 |
InvalidXML |
Input XML could not be read |
2 |
SubjectNotExist |
Specified subject was not found |
3 |
SubjectNotOpened |
Specified subject could not be opened |
4 |
InvalidUserCredentials |
User does not have permission to access this study/site |