MACRO API

 

Managing sites with the MACRO API

CreateSite - Create new site

EditSite - Edit existing site

ActivateSite - Enable/disable an existing site

AssignSiteToStudy - Associate a site with a study

RemoveSiteFromStudy - Disassociate a site from a study

GetSitesForStudy - Retrieve a list of sites associated with a study

GetStudiesForSite - Retrieve a list of studies associated with a site

GetStudies - Retrieve a list of studies in the current database

GetSites - Retrieve a list of sites in the current database

GetCountries - Retrieve a list of countries used in MACRO

 

These routines cover a range of study/site administrative tasks.

 

 

 

CreateSite

 

Create a new site. New sites are automatically activated when they are created.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

name

New site code

description

New site description

isRemote

Indicates if the new site is a remote site to be used for remote data transfer

countryId

Numeric ID of country in which new site is located See list of countries

 

public static eStudySiteAdminResult CreateSite(UserProperties user, string name, string description, bool isRemote, int countryId)

 

Output

·       Return code indicating success or failure

Return to top

 

 

EditSite

 

Edit the description or country for an existing site. The site class is as returned from GetSitesforStudy or GetSites.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

site

Site code

 

public static eStudySiteAdminResult EditSite(UserProperties user, ApiClasses.Site site)

 

Output

·       Return code  indicating success or failure

Return to top

 

 

ActivateSite

 

Enable or disable an existing site. New sites are automatically activated when they are created.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

site

Site code

isActive

'True' to activate the site, 'False' to de-activate the site

 

public static eStudySiteAdminResult ActivateSite(UserProperties user, string site, bool isActive)

 

Output

·       Return code  indicating success or failure

Return to top

 

 

AssignSiteToStudy

 

Associate a site with a study.

 

The site must be active, and the study status must not be Suspended or ClosedToFollowup. A result of Success will be returned if the site is already assigned to the study.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

site

Site code

studyName

Study name

 

public static eStudySiteAdminResult AssignSiteToStudy(UserProperties user, string site, string studyName)

 

Output

·       Return code  indicating success or failure

Return to top

 

 

RemoveSiteFromStudy

 

Remove an association between a site and a study.

 

The site must be active, and the study status must not be Suspended or ClosedToFollowup. A result of Success will be returned if the site is not currently assigned to the study.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

site

Site code

studyName

Study name

 

public static eStudySiteAdminResult RemoveSiteFromStudy(UserProperties user, string site, string studyName)

 

Output

·       Return code  indicating success or failure

Return to top

 

 

GetSitesForStudy

 

Retrieve a list of sites associated with a particular study.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

studyName

Study name

 

public static eStudySiteAdminResult GetSitesForStudy(UserProperties user, string studyName, ref List<ApiClasses.Site> sites)

 

Output

·       Return code  indicating success or failure

·       sites - list of sites associated with study as a list of ApiClasses.Site objects

Return to top

 

 

GetStudiesForSite

 

Retrieve a list of studies associated with a particular site.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

site

Site code

 

public static eStudySiteAdminResult GetStudiesForSite(UserProperties user, string site, ref List<ApiClasses.Study> studies)

 

Output

·       Return code  indicating success or failure

·       studies - list of studies associated with site as a list of ApiClasses.Study objects

Return to top

 

 

GetStudies

 

Retrieve a list of all studies in the current MACRO database.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

 

public static eStudySiteAdminResult GetStudies(UserProperties user, ref List<ApiClasses.Study> studies)

 

Output

·       Return code  indicating success or failure

·       studies - list of studies as a list of ApiClasses.Study objects

 

Return to top

 

 

GetSites

 

Retrieve a list of all sites in the current MACRO database.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

 

public static eStudySiteAdminResult GetSites(UserProperties user, ref List<ApiClasses.Site> sites)

 

Output

·       Return code  indicating success or failure

·       sites - list of sites as a list of ApiClasses.Site objects

 

Return to top

 

 

GetCountries

 

Retrieve a list of all countries used in MACRO. You can also see the list here.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

 

public static eStudySiteAdminResult GetCountries(UserProperties user, ref List<ApiClasses.Country> countries)

 

Output

·       Return code  indicating success or failure

·       countries - list of countries as a list of ApiClasses.Country objects

Return to top

 

Study/site administration return codes

These return codes are of type eStudySiteAdminResult 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

SiteExists

ยท  An existing site has been specified in "CreateSite"

4

InvalidSiteError

The specified site is null or empty or does not exist

5

InvalidStudyError

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

6

InvalidSiteName

An invalid site name has been specified in "CreateSite"

7

InvalidSiteDescription An invalid site description has been specified in "CreateSite" or "EditSite"

8

InvalidSiteCountryId

The country ID specified is not a recognised MACRO country ID See list of countries

99

Unknown

An unknown error occurred

 

Return to top

 

Related Topics

About sites

Managing sites with the Command Line module