MACRO API

 

Exporting and importing data with the MACRO API

ExportSubjects - Export MACRO v4 subject data in MACRO or CDISC format

ImportSubjects - Import MACRO v4 subject data in MACRO or CDISC format

ImportSubjectsM3 - Import MACRO v3 subject data

 

ExportStudy - Export MACRO v4 study definition in MACRO or CDISC format

ImportStudy - Import MACRO v4 study definition in MACRO or CDISC format

ImportStudyM3 - Import MACRO v3 study definition

 

ExportLaboratory - Export MACRO v4 laboratory definition

ImportLaboratory - Import MACRO v4 laboratory definition

ImportLaboratoryM3 - Import MACRO v3 laboratory definition

 

These routines cover a range of export/import tasks.

 

 

 

ExportSubjects
ExportSubjectsCDISC

 

Export MACRO v4 subject data in standard MACRO format (.prd) or  CDISC format (xml).

You can only export subject data from sites/studies to which you have access, as defined by your user role. This differs from the SM module, where you can currently export subject data from all sites/studies in the database, regardless of your study/site permissions.

 

This single method has 3 overloads to allow an export range of study, site and/or subject:

·       To export data for selected subjects at a site, use study, site and subject details

·       To export data for all subjects at a site, use only study and site details

·       To export data for all subjects in a study, use only the study details

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

study

Study name

site

Site code

subjectIdFrom

ID of first subject in the range to be exported

subjectIdTo

ID of last subject in the range to be exported

fileLocationToSaveTo

Location in which the exported data is to be saved

 

Exporting data for selected subjects at a site:

public static eExportImportResult ExportSubjects(UserProperties user, string study, string site, int subjectIdFrom, int subjectIdTo, string fileLocationToSaveTo, ref string errorMessage)

 

Exporting data for all subjects at a site:

public static eExportImportResult ExportSubjects(UserProperties user, string study, string site, string fileLocationToSaveTo, ref string errorMessage)

 

Exporting data for all subjects in a  study:

public static eExportImportResult ExportSubjects(UserProperties user, string study, string fileLocationToSaveTo, ref string errorMessage)

 

Exporting CDISC data for selected subjects at a site:

public static eExportImportResult ExportSubjectsCDISC(UserProperties user, string study, string site, int subjectIdFrom, int subjectIdTo, string fileLocationToSaveTo, ref string errorMessage)

 

Exporting CDISC data for all subjects at a site:

public static eExportImportResult ExportSubjectsCDISC(UserProperties user, string study, string site, string fileLocationToSaveTo, ref string errorMessage)

 

Exporting CDISC data for all subjects in a  study:

public static eExportImportResult ExportSubjectsCDISC(UserProperties user, string study, string fileLocationToSaveTo, ref string errorMessage)

 

Output

·       Return code indicating success or failure

·       errorMessage -  in the case of failure, additional information is detailed in a string

Return to top

 

 

ImportSubjects
ImportSubjectsCDISC

 

Import MACRO v4 subject data in standard MACRO format (.prd) or in CDISC format (xml).

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

importFilePath

Location of the subject data file to be imported. A file error will be returned if the import file does not have the correct extension.

 

Importing subject data:

public static eExportImportResult ImportSubjects(UserProperties user, string importFilePath, ref string errorMessage)

 

Importing CDISC subject data:

public static eExportImportResult ImportSubjectsCDISC(UserProperties user, string importFilePath, ref string errorMessage)

 

Output

·       Return code  indicating success or failure

·       errorMessage -  in the case of failure, additional information is detailed in a string

Return to top

 

 

ImportSubjectsM3

 

Import MACRO v3 subject data in standard MACRO format (.zip).

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

importFilePath

Location of the subject data file to be imported. A file error will be returned if the import file does not have the correct extension.

 

public static eExportImportResult ImportSubjectsM3(UserProperties user, string importFilePath, ref string errorMessage)

 

Output

·       Return code  indicating success or failure

·       errorMessage -  in the case of failure, additional information is detailed in a string

Return to top

 

 

ExportStudy
ExportStudyCDISC

 

Export MACRO v4 study definition in standard MACRO format (.sdd) or in CDISC format (xml).

You can only export a study to which you have access, as defined by your user role. This differs from the SM module, where you can currently export all studies in a database, regardless of your study/site permissions.

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

studyToExport

Study name

studyVersion

Version number of the study that has been distributed to remote sites; if you do not use RDT the version will always be 1

fileLocationToSaveTo

Location in which the exported data is to be saved

 

Exporting a study definition:

public static eExportImportResult ExportStudy(UserProperties user, string studyToExport, int studyVersion, string fileLocationToSaveTo, ref string errorMessage)

 

Exporting a CDISC study definition:

public static eExportImportResult ExportStudyCDISC(UserProperties user, string studyToExport, int studyVersion, string fileLocationToSaveTo, ref string errorMessage)

 

Output

·       Return code  indicating success or failure

·       errorMessage -  in the case of failure, additional information is detailed in a string

Return to top

 

 

ImportStudy

ImportStudyCDISC

 

Import MACRO v4 study definition in standard MACRO format (.sdd) or in CDISC format (.xml).

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

importFilePath

Location of the study definition file to be imported. A file error will be returned if the import file does not have the correct extension.

 

Importing a study definition:

public static eExportImportResult ImportStudy(UserProperties user, string importFilePath, ref string errorMessage)

 

Importing a CDISC study definition:

public static eExportImportResult ImportStudyCDISC(UserProperties user, string importFilePath, ref string errorMessage)

 

Output

·       Return code  indicating success or failure

·       errorMessage -  in the case of failure, additional information is detailed in a string

Return to top

 

 

ImportStudyM3

 

Import MACRO v3 study definition in standard MACRO format (.zip).

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

importFilePath

Location of the study definition file to be imported. A file error will be returned if the import file does not have the correct extension.

 

public static eExportImportResult ImportStudyM3(UserProperties user, string importFilePath, ref string errorMessage)

 

Output

·       Return code  indicating success or failure

·       errorMessage -  in the case of failure, additional information is detailed in a string

Return to top

 

 

ExportLaboratory

 

Export MACRO v4 laboratory definition in standard MACRO format (.ldd).

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

labToExport

Laboratory code

fileLocationToSaveTo

Location in which the exported data is to be saved

 

public static eExportImportResult ExportLaboratory(UserProperties user, string labToExport, string fileLocationToSaveTo, ref string errorMessage)

 

Output

·       Return code  indicating success or failure

·       errorMessage -  in the case of failure, additional information is detailed in a string

Return to top

 

 

ImportLaboratory

 

Import MACRO v4 laboratory definition in standard MACRO format (.ldd).

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

importFilePath

Location of the laboratory definition file to be imported. A file error will be returned if the import file does not have the correct extension.

 

public static eExportImportResult ImportLaboratory(UserProperties user, string importFilePath, ref string errorMessage)

 

Output

·       Return code  indicating success or failure

·       errorMessage -  in the case of failure, additional information is detailed in a string

Return to top

 

 

ImportLaboratoryM3

 

Import MACRO v3 laboratory definition in standard MACRO format (.zip).

 

Input

Parameter

Description

user

Currently logged-in user as returned from Login

importFilePath

Location of the laboratory definition file to be imported. A file error will be returned if the import file does not have the correct extension.

 

public static eExportImportResult ImportLaboratoryM3(UserProperties user, string importFilePath, ref string errorMessage)

 

Output

·       Return code  indicating success or failure

·       errorMessage -  in the case of failure, additional information is detailed in a string

Return to top

 

Import file formats

The standard file extensions for each type of file are as follows. A file error will be returned if an import file does not have the correct extension.

 

File type

File extension

MACRO v4 study definition

.sdd

MACRO v4 subject data

.prd

MACRO v4 laboratory definition

.ldd

CDISC study definition

.xml

CDISC subject data

.xml

MACRO v3 study definition

.zip 

MACRO v3 subject data

.zip

MACRO v3 laboratory definition

.zip

Return to top

 

Export/import return codes

These return codes are of type eExportImportResult

 

Code

Value

Description

0

Success

The operation was successful

1

FileError

The given file path was blank, or does not exist, or the current user does not have file access to the given path, or an incorrect file type was selected for import

2

PermissionError

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

4

InvalidStudyError

The given study name was blank, or does not exist in the MACRO database  

5

InvalidSubjectError

The given subject does not exist in the MACRO database, or no subjects exist in the MACRO database for the given range of subject IDs  

6

InvalidSiteError

The given site name was blank, or does not exist in the MACRO database  

7

InvalidLaboratoryError The given laboratory name was blank, or does not exist in the MACRO database  

99

Unknown

An unknown error occurred

 

Return to top

 

Related Topics

Importing and exporting a study definition

Importing and exporting a laboratory definition

Importing and exporting subject data

Exporting and importing data with the Command Line module