MACRMACRO API

 

Managing DCRs and SDVs with the MACRO API

CreateDcr - Create a new Raised DCR

EditDcr - Edit the status or text of an existing DCR

CreateSdv - Create a new/change an existing SDV

 

These routines enable you to create and edit DCRs and SDVs.

 

You can only raise DCRs on a question (and not an eForm, visit or subject). A single question can have any number of DCRs attached to it.

You can create or edit an SDV on a subject, visit, eForm or question, but each MACRO object can only have one SDV attached. The CreateSdv() call creates a new SDV for the specified object if no SDV already exists, or changes the SDV status if an SDV already exists.

You cannot raise a DCR or create/edit an SDV on a locked object (but you can do so on a frozen object).

You cannot raise a DCR or create/edit an SDV in a study with status Suspended.

 

 

 

CreateDcr

 

Create a new DCR with status Raised on the specified response, and optionally return the unique DCR ID.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

study

Study name

site

Site code

subjectid

Subject ID (use 0 if specifying subject label)

label

Subject label (use empty string if specifying subject ID)

visit

Visit code

vcycle

Visit cycle

eform

eForm code

fcycle

eForm cycle

question

Question code

qcycle

Question cycle

dcrText

DCR text

priority

DCR priority (1 to 10 with 1 the highest priority)

 

Creating a DCR without returning the DCR ID

public static MIMsgResult CreateDcr(UserProperties user, string study, string site, int subjectid, string label,

            string visit, int vcycle, string eform, int fcycle, string question, int qcycle, string dcrText, short priority)

 

Creating a DCR and returning the DCR ID

public static MIMsgResult CreateDcr(UserProperties user, string study, string site, int subjectid, string label,

            string visit, int vcycle, string eform, int fcycle, string question, int qcycle, string dcrText, short priority, out string dcrId)

 

Output

·       Return code indicating success or nature of failure

·       Unique DCR ID for newly created DCR, as displayed in the DCR browser in the Web DE/DR module

Return to top

 

 

EditDcr

 

This routine enables you to change the status of an existing DCR to Responded, Closed or Raised, and to edit the DCR text.

 

Only Raised DCRs can be set to Responded.

Raised and Responded DCRs can be set to Closed.

Only Responded DCRs can be re-raised.

 

Each change to DCR status and/or text is saved in the DCR audit trail, visible from the DCR browser.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

dcrAction

DCR action required (see below)

dcrId

Unique DCR ID,  as returned from CreateDcr, or viewed in the DCR browser in Web DE/DR

dcrText

The new DCR text

err

This may contain additional error message information if the call fails

 

DCR Action

This parameter is of type ApiDcrAction with the following values:

 

public static MIMsgResult EditDcr(UserProperties user, ApiDcrAction dcrAction, string dcrId, string dcrText, ref string err)

 

Output

·       Return code indicating success or nature of failure

·       If an error occurs, the string may contain additional information

Return to top

 

 

CreateSdv

 

Create an SDV or change the status of an existing SDV. This single method has 4 overloads to allow for creating an SDV on a subject, visit instance, eForm instance or question response:

·       For a Subject SDV, omit the visit, eForm and question details

·       For a visit SDV, omit the eForm and question details

·       For an eForm SDV, omit the question details

·       A new SDV cannot be created with the status Cancelled

 

In each case:

·       If there is no SDV associated with the specified object, a new SDV will be created with the specified status.

·       If there is already an SDV associated with the specified object, and its status is different from the specified status, the SDV status will be changed.

·       If there is already an SDV associated with the specified object, with the same status as specified, an "SDV Exists" error will be returned.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

study

Study name

site

Site code

subjectid

Subject ID (use 0 if specifying subject label)

label

Subject label (use empty string if specifying subject ID)

visit

Visit code (omit if target is subject)

vcycle

Visit cycle (omit if target is subject)

eform

eForm code (omit if target is subject or visit)

fcycle

eForm cycle (omit if target is subject or visit)

question

Question code (omit if target is subject, visit or eForm)

qcycle

Question cycle (omit if target is subject, visit or eForm)

sdvText

SDV text

sdvStatus

SDV status

 

Creating a subject SDV:

public static MIMsgResult CreateSdv(UserProperties user, string study,

string site, int subjectid, string label,

string sdvText, Enums.SDVMIMStatus sdvstatus)

 

Creating a visit SDV:

public static MIMsgResult CreateSdv(UserProperties user, string study,

string site, int subjectid, string label,

string visit, int vcycle,

string sdvText, Enums.SDVMIMStatus sdvstatus)

 

Creating a eForm SDV:

public static MIMsgResult CreateSdv(UserProperties user, string study,

string site, int subjectid, string label,

string visit, int vcycle, string eform, int fcycle,

string sdvText, Enums.SDVMIMStatus sdvstatus)

 

Creating a question SDV:

public static MIMsgResult CreateSdv(UserProperties user, string study,

string site, int subjectid, string label,

string visit, int vcycle, string eform, int fcycle,

string question, int qcycle,

string sdvText, Enums.SDVMIMStatus sdvstatus)

 

Output

·       Return code indicating success or nature of failure

Return to top

 

MIMessage return codes

The MIMessage routines return an integer code as type MIMsgResult indicating the result, as listed in the table below:

 

Code

Value

Description

0

Success

The operation was successful

1

NoPermission

User does not have permission to carry out this operation

2

SubjectNotFound

Specified subject was not found

3

VisitNotFound

Specified visit was not found

4

EFormNotFound

Specified eForm was not found

5

QuestionNotFound

Specified question was not found

6

ResponseNotFound

No response data found for this visit, visit cycle, eForm, eform cycle, question and question cycle

7

NoLockForSave

Subject is open for editing in DE

8

SDVExists

An SDV of this status already exists for this object

9

InvalidPriority

Specified DCR priority is not valid (priority must be an integer from 1 to 10)

10

InvalidStatus

Specified status is not valid (eg a new SDV cannot have the status Cancelled)

11

ObjectLocked

Specified object has a status of Locked so any associated DCRs or SDVs cannot be edited

12

StudySuspended

The study has a status of Suspended

13

DcrNotFound

The DCR ID is not recognised

14

InvalidOperation

The operation is not permitted on this DCR, e.g. trying to edit the text of a DCR owned by another user

99

Unknown

An unknown error occurred

 

Return to top

 

Related Topics