MACRO API

 

Managing subject groups with the MACRO API

CreateSubjectGroup - Create new subject group

EditSubjectGroupDescription - Edit the description for an existing subject group

EditSubjectGroupCondition - Edit the Arezzo condition that defines a dynamic subject group

EditSubjectGroupIsDynamic - Specify whether a subject group is dynamic or static

SetSubjectGroupActive - Activate or deactivate a subject group

AssignUserRoleToSubjectGroup - Assign user access to a subject group

RemoveUserRoleFromSubjectGroup - Remove user access from a subject group

EvaluateSubjectGroupsForSubject - Evaluate the dynamic subject groups for a given subject

EvaluateSubjectForSubjectGroup - Evaluate a subject for a given group

GetSubjectGroups - Retrieve a list of subject groups

GetSubjectGroupsForStudy - Retrieve a list of subject groups for a given study

GetSubjectGroupsForSubject - Retrieve a list of subject groups in which a given subject is included

GetSubjectGroupsForUserRole - Retrieve a list of subject groups in which a given user is included with a particular user role

GetSubjectsInSubjectGroup - Retrieve a list of subjects in a given subject group

AddSubjectToSubjectGroup - Add a subject to a static subject group

RemoveSubjectFromSubjectGroup - Remove a subject from a static subject group

 

These routines cover a range of subject group administrative tasks.

 

 

 

CreateSubjectGroup

 

Create a new subject group. New groups are automatically activated when they are created.

 

You need the 'Create subject group' permission

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

groupCode

New subject group code

study

Study name

description

Description for the new subject group

arezzoCondition

Arezzo condition used to define the subject group

isDynamic

Indicates if the subject group is dynamic (true) or static (false)

 

public static eSubjectGroupResult CreateSubjectGroup(UserProperties user, string groupCode, string study, string description, string arezzoCondition, bool isDynamic)

 

Output

·       Return code indicating success or failure

Return to top

 

 

EditSubjectGroupDescription

 

Edit the description for an existing subject group.

 

You need the 'Edit subject group' permission

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

groupCode

Subject group code

description

New description for the subject group

 

public static eSubjectGroupResult EditSubjectGroupDescription(UserProperties user, string groupCode, string description)

 

Output

·       Return code indicating success or failure

Return to top

 

 

EditSubjectGroupCondition

 

Edit the Arezzo condition that defines a subject group.

 

You need the 'Edit subject group' permission

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

groupCode

Subject group code

arezzoCondition

New Arezzo condition used to define the subject group

 

public static eSubjectGroupResult EditSubjectGroupCondition(UserProperties user, string groupCode, string arezzoCondition)

 

Output

·       Return code indicating success or failure

Return to top

 

 

EditSubjectGroupIsDynamic

 

Specify whether a subject group is dynamic or static.

 

You need the 'Edit subject group' permission

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

groupCode

Subject group code

isDynamic

Indicates if the subject group is dynamic (true) or static (false)

 

public static eSubjectGroupResult EditSubjectGroupIsDynamic(UserProperties user, string groupCode, bool isDynamic)

 

Output

·       Return code indicating success or failure

Return to top

 

 

SetSubjectGroupActive

 

Activate or deactivate a subject group.

 

You need the 'Edit subject group' permission

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

groupCode

Subject group code

active

Indicates if the subject group is active (true) or inactive (false)

 

public static eSubjectGroupResult SetSubjectGroupActive(UserProperties user, string groupCode, bool active)

 

Output

·       Return code indicating success or failure

Return to top

 

 

AssignUserRoleToSubjectGroup

 

Assign a user access to a subject group with a particular role.

 

You need the 'Assign user role to subject group' permission

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

userId

The user who requires access

roleCode

Role code

groupCode

Subject group code

 

public static eSubjectGroupResult AssignUserRoleToSubjectGroup(UserProperties user, string userId, string roleCode, string groupCode)

 

Output

·       Return code indicating success or failure

Return to top

 

 

RemoveUserRoleFromSubjectGroup

 

Remove access for a user from a subject group for a particular user role.

 

You need the 'Assign user role to subject group' permission

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

userId

The user whose access is to be removed

roleCode

The user role assigned

groupCode

Subject group code

 

public static eSubjectGroupResult RemoveUserRoleFromSubjectGroup(UserProperties user, string userId, string roleCode, string groupCode)

 

Output

·       Return code indicating success or failure

Return to top

 

 

EvaluateSubjectGroupsForSubject

 

Evaluate the dynamic subject groups for a given subject.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

studyName

Study name

site

Site code

subjectId

Subject ID

 

public static eSubjectGroupResult EvaluateSubjectGroupsForSubject(UserProperties user, string studyName, string site, int subjectId)

 

Output

·       Return code indicating success or failure

Return to top

 

 

EvaluateSubjectForSubjectGroup

 

Evaluate a subject for a given group.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

studyName

Study name

site

Site code

subjectId

Subject ID

groupCode

Subject group code

 

public static eSubjectGroupResult EvaluateSubjectForSubjectGroup(UserProperties user, string studyName, string site, int subjectId, string groupCode)

 

Output

·       Return code indicating success or failure

Return to top

 

 

GetSubjectGroups

 

Retrieve a list of subject groups.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

subjectGroups

List of subject groups to be populated

 

public static eSubjectGroupResult GetSubjectGroups(UserProperties user, ref List<ApiClasses.SubjectGroup> subjectGroups)

 

Output

·       Return code indicating success or failure

·       List of subject groups as a list of ApiClasses.SubjectGroup objects

Return to top

 

 

GetSubjectGroupsForStudy

 

Retrieve a list of subject groups for a given study.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

studyName

Study name

subjectGroups

List of subject groups to be populated

 

public static eSubjectGroupResult GetSubjectGroupsForStudy(UserProperties user, string studyName, ref List<ApiClasses.SubjectGroup> subjectGroups)

 

Output

·       Return code indicating success or failure

·       List of subject groups as a list of ApiClasses.SubjectGroup objects

Return to top

 

 

GetSubjectGroupsForSubject

 

Retrieve a list of subject groups in which a given subject is included.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

studyName

Study name

site

Site code

subjectId

Subject ID

subjectGroups

List of subject groups to be populated

 

public static eSubjectGroupResult GetSubjectGroupsForSubject(UserProperties user, string studyName, string site, int subjectId, ref List<ApiClasses.SubjectGroup> subjectGroups)

 

Output

·       Return code indicating success or failure

·       List of subject groups as a list of ApiClasses.SubjectGroup objects

Return to top

 

 

GetSubjectGroupsForUserRole

 

Retrieve a list of subject groups in which a given user is included with a particular user role.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

userId

User name

roleCode

User role

subjectGroups

List of subject groups to be populated

 

public static eSubjectGroupResult GetSubjectGroupsForUserRole(UserProperties user, string userId, string roleCode, ref List<ApiClasses.SubjectGroup> subjectGroups)  

 

Output

·       Return code indicating success or failure

·       List of subject groups as a list of ApiClasses.SubjectGroup objects

Return to top

 

 

GetSubjectsInSubjectGroup

 

Retrieve a list of subjects in a given subject group.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

groupCode

Subject group code

subjects

List of subjects to be populated

 

public static eSubjectGroupResult GetSubjectsInSubjectGroup(UserProperties user, string groupCode, ref List<ApiClasses.Subject> subjects) 

 

Output

·       Return code indicating success or failure

·       List of subject groups as a list of ApiClasses.Subject objects

Return to top

 

 

AddSubjectToSubjectGroup

 

Add a subject to a static subject group.

 

You need the 'Add subject to subject group' permission.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

studyName

Name of the study used to identify the subject

site

Code of the site used to identify the subject

subjectId

ID of subject to be added

groupCode

Code of subject group

 

public static eSubjectGroupResult AddSubjectToSubjectGroup(UserProperties user, string studyName, string site, int subjectId, string groupCode)

 

Output

·       Return code indicating success or failure

Return to top

 

 

RemoveSubjectFromSubjectGroup

 

Remove a subject from a static subject group.

 

You need the 'Add subject to subject group' permission.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

studyName

Name of the study used to identify the subject

site

Code of the site used to identify the subject

subjectId

ID of subject to be removed

groupCode

Code of subject group

 

public static eSubjectGroupResult RemoveSubjectFromSubjectGroup(UserProperties user, string studyName, string site, int subjectId, string groupCode)

 

Output

·       Return code indicating success or failure

Return to top

 

Subject group administration return codes

These return codes are of type eSubjectGroupResult with the following values:

 

Code

Value

Description

0

Success

The operation was successful

1

PermissionError

The current user does not have the relevant MACRO permissions to perform the action

2

DatabaseError

An unexpected error occurred while accessing the database

3

InvalidGroupCode

The specified code is null or empty or does not exist

4

InvalidSubjectGroupDescription

The specified description is null or empty or does not exist

5

SubjectGroupExists

An existing subject group has been specified in "CreateSubjectGroup"

6

InvalidStudyError

The specified study is null or empty, does not exist, or does not have the required status

7

InvalidSubjectGroupError The specified subject group is null or empty or does not exist

8

InvalidUserError

The specified user is null or empty or does not exist

9

InvalidRoleError

The specified user role is null or empty or does not exist

10

InvalidSiteError

The specified site is null or empty or does not exist

11

InvalidSubjectError

The specified subject is null or empty or does not exist

12

SubjectGroupMustBeStatic

The requested action can only be performed on a static subject group

13

SubjectGroupInactive

The requested action can only be performed on an active subject group

99

Unknown

An unknown error occurred

 

Return to top

 

Related Topics

About subject groups

Managing subject groups with the Command Line module