Rwslib
Rwslib
Release 1.2.9
Ian Sparks
1 Getting started 3
1.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Creating a connection to RWS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Making an RWS request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Overriding default domain name and virtual directory . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.6 Timeouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.7 Retries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.8 Getting more information from last_result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.9 Getting the elapsed time of the request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.10 Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.11 Multi-byte encodings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2 rws_requests 9
2.1 VersionRequest() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 BuildVersionRequest() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 CodeNameRequest() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.4 DiagnosticsRequest() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5 TwoHundredRequest() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.6 CacheFlushRequest() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.7 ConfigurableDatasetRequest() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
i
5.4 StudyVersionRequest(projectname, oid) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.5 PostMetadataRequest(projectname, data) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
8 Using Builders 37
8.1 Metadata Builders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
11 rwscmd 63
11.1 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
11.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
12 Class Reference 65
12.1 rwslib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
12.2 Rave Web Services Request Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
12.3 Rave Web Services Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
12.4 Biostats Gateway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
12.5 ODM Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Index 115
ii
rwslib Documentation, Release 1.2.9
rwslib is a python library that provides a simple interface to Rave Web Services (RWS)
Contents:
Contents 1
rwslib Documentation, Release 1.2.9
2 Contents
CHAPTER 1
Getting started
Note that for any API calls that require authentication (anything useful) you will need access to a Rave environment.
Medidata runs a program for integration access to this system, Developer Central. Apply for access
1.1 Installation
This will also install all required dependencies. Note that on Windows, lxml requires a binary installation.
Before you can do any work with rwslib you must create a connection to a Rave instance. This is done through the
RWSConnection object:
Note that the first parameter to the RWSConnection is the name of the url you wish to connect to. A url that does
not start with “http” is assumed to be the sub-domain of mdsol.com. In the example above “innovate” is treated as
https://innovate.mdsol.com.
If you wish to override this behaviour, supply a base URL that includes http or https at the start of the url:
3
rwslib Documentation, Release 1.2.9
It is important to understand that an RWSConnection is not a persistent connection to Rave, it is simply a convenience
class for making calls to RWS endpoints.
Once you have an RWSConnection, you can use it to send messages to Rave and receive results back.
rwslib provides a set of request classes. To make a request, create an instance of that request type and pass it to the
RWSConnection send_request method:
The result you get back from send_request will depend on the request type since Request objects have the chance to
process the text values returned from Rave. VersionRequest() returns a string value but other request types may
return objects or collections (python lists) of objects.
All Request classes are descendants of the RWSRequest class. The API is designed this way so that new or custom
requests can be easily added to the library. This also allows for easier versioning of requests and also subclassing of
existing request types. For instance, VersionRequest() could be subclassed to return major, minor and patch-
level values as a tuple of integers rather than as a string. This allows you to make specialized request classes for your
integration.
rwslib provides several sets of syamdard request types arranged into python units:
• rws_requests.py contains the RWSRequest class and standard requests like VersionRequest()
• rws_cv_requests.py contains requests related to Rave Clinical Views and BioStat Gateway data extracts
for Comments and Protocol Violations
• odm_adapter_requests.py contains requests related to the ODM Adapter datasets added in Rave
2013.3.0
For convenience rwslib defaults the domain name to end with ‘mdsol.com’ and the virtual directory to be ‘RaveWeb-
Services’:
The default values will work for most Rave URLs but you can override them if necessary:
1.5 Authentication
Most requests require authentication. Requests can be authenticated through Basic Authentication by providing a Rave
(not iMedidata) username and password:
Alternatively you can make a request using MAuth credentials. MAuth is Medidata’s API authentication mecha-
nism. MAuth credentials consist of an App UUID representing the application making the request and a Private Key,
representing it’s proof that it is who it says it is. These two are used with MAuth to sign requests.
Medidata provides the requests_mauth library which provides MAuth signing capabilities for accessing Medidata
API’s via MAuth:
A set of MAuth credentials are associated with a user in Rave just as with Basic Authentication, requests are performed
in the context of this users rights and permissions. However, a user account associated with MAuth App ID does not
have password expiry so MAuth is a better approach to long-term integrations with Rave URLs.
Note that an MAuth AppID can be associated with multiple Rave URLs but only one user per URL.
1.6 Timeouts
By default rwslib will not timeout. A timeout limit, in seconds, can be set on send_request, after which a Timeout
exception will be thrown:
In practice the timeout should be set to a value greater than any expected valid response time, which will vary depend-
ing upon the request types and volumes of data sent or received.
This timeout setting only applies to rwslib and does not alter timeouts in RWS itself or any other component in the
network such as load balancers, etc.
1.5. Authentication 5
rwslib Documentation, Release 1.2.9
1.7 Retries
By default rwslib will make a request only once. You can adjust the number of retries by setting the retries parameter
to send_request:
Note that you should be very careful with retries when a request makes changes to data (e.g. POST requests) since in
some situations errors can be returned by Rave and the request may still succeed.
Each time RWSConnection sends a request and receives results it keeps the result of the RWS call in it’s
last_result attribute. This is very useful for debugging RWS calls since it allows you to find out what head-
ers were sent, what URL was called etc.
last_result is a Requests object. Please see that library for more information on all the properties that can be
returned there.
Having access to last_result means that rwslib never hides it’s workings from you. rwslib is intended to be a
helper library to get your own integrations up and running, it tries not to hide implementation details from you.
Each time RWSConnection sends a request and receives results it keeps the elapsed time, in seconds, of the RWS
call in it’s request_time attribute.
RWS returns a variety of error results depending on the type of request. rwslib packages these error types into
rwsobjects.RWSException exceptions which have an rws_error property. The rws_error property is popu-
lated with a different object type depending on the error type.
Where RWS returns an XML error response, rwslib will parse the error and return it in an rwsobjects.RWSError
or rwsobjects.RWSErrorResponse object.
RWSError instances have an errordescription attribute while RWSErrorResponse have an
errordescription and a reasoncode.
RWSError is used to parse ODM-formatted return messages like:
<Response
ReferenceNumber="0b47fe86-542f-4070-9e7d-16396a5ef08a"
InboundODMFileOID="Not Supplied"
IsTransactionSuccessful="0"
ReasonCode="RWS00092"
ErrorClientResponseMessage="CRF version not found">
</Response>
RWSException also has a standard message attribute which the error description content from the RWS error
is copied into. The purpose of this scheme is to make rwslib raise a standard exception type that surfaces the error
message from the source RWS response but which also provides full access to the content of the original RWS error
message.
In some cases the underlying requests library does not detect the correct encoding for the response; this is partly down
to how Rave reports the Content-Type for different requests. To be able to safely encode the response for character sets
beyond ‘UTF-8’, it is recommended the user subclasses the underlying rwslib Request object and force the encoding
on the response object
As an example:
class UTF8StudyDatasetRequest(StudyDatasetRequest):
def result(self, response):
"""
Process a result to create a custom output
:param requests.models.Response response: returned response
:return:
"""
# By default return text
response.encoding = "utf-8-sig"
return response.text
rws_requests
The rws_requests module contains the core RWSRequest class and a set of Request classes that are standard in all
versions of Rave Web Services for Rave.
Also part of this module:
• Working with Architect Metadata
• Working with Global Library Metadata
• Working with Clinical Data
• Posting Clinical Data
rws_requests also provides additional requests in sub-modules for additional features:
• Biostats Gateway Requests
• ODM Adapter Requests
2.1 VersionRequest()
Example:
9
rwslib Documentation, Release 1.2.9
2.2 BuildVersionRequest()
2.3 CodeNameRequest()
Returns a 200 response code and the internal code name of the RWS version.
Example:
2.4 DiagnosticsRequest()
Returns a 200 response code and the text OK if RWS self-checks pass.
Example:
2.5 TwoHundredRequest()
10 Chapter 2. rws_requests
rwslib Documentation, Release 1.2.9
Returns a 200 response code and a html document that contains information about the MAuth configuration of Rave
Web Services on this url.
Example:
2.6 CacheFlushRequest()
Warning: Calling CacheFlush unnecessarily causes RWS to re-load objects, causing additional resource utiliza-
tion that could have a detrimental affect on Rave performance.
Flushes the RWS cache. Generally Rave and RWS manage their own caching. You should not need to use this method
in normal operation. Returns a rwsobjects.RWSResponse object with a istransactionsuccessful attribute:
Example:
2.7 ConfigurableDatasetRequest()
Sends a Configurable Dataset request to RWS. The dataset_format argument is optional and is only required if the
corresponding configurable dataset requires it. The primary use case of this is as an abstract class that the user can
subclass for their particular Configurable Dataset; the implemented class could such as validation of the requested
dataset_format against the list of formats accepted by the configurable dataset or by overloading the result method to
parse the raw response content (e.g. return a pre-parsed JSON response or a csv.reader). Returns a rwsobjects.
RWSResponse object:
Example:
2.6. CacheFlushRequest() 11
rwslib Documentation, Release 1.2.9
>>> response.text
DataPageID,DataPointID,LastUpdated
1234,4321,2012-12-01T12:33:00
4334,1234,2012-12-02T12:33:00
...
12 Chapter 2. rws_requests
CHAPTER 3
The rws_requests module provides a number of standard requests which provide lists of clinical studies, extract clinical
data (from Rave Clinical Views) and post clinical data to Rave.
rwslib uses some standard definitions for studyname, protocol names and environments. It defines them as:
• Projectname - The name of the study without environment e.g. the Mediflex in Mediflex (Dev)
• Environment - The environment within the study e.g. the Dev in Mediflex (Dev)
• StudyName - The combination of projectname and environment Mediflex (Dev)
3.2 ClinicalStudiesRequest()
Example:
13
rwslib Documentation, Release 1.2.9
Option Description
status={True|False} If True, extracts status information at the subject level. Default = False
links={True|False} If True, includes “deep link”(s) (URL) to the subject page in Rave.Default = False
in- Include inactive subjects, deleted subjects or both? By default these subjects are
clude={inactive|deleted|inactiveAndDeleted}
omitted.
sub- Request that the Subject Name is in the SubjectKey field (_SubjectName_) or in the
ject_key_type={SubjectName|SubjectUUID}
mdsol:SubjectName field (with the Subject UUID in the SubjectKey field).
Calls:
https://{ host }/RaveWebServices/studies/{ projectname } ({ environment_name})/
˓→subjects?{options}
Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests import StudySubjectsRequest
>>> r = RWSConnection('https://innovate.mdsol.com', 'username', 'password')
˓→#Authorization required
˓→FileOID="1af945c7-8334-4eb8-b7a9-735fb5c7db03" CreationDateTime="2013-09-
˓→10T09:28:21.145-00:00" ODMVersion="1.3">
>>> str(subject_list)
<ODM xmlns:mdsol="http://www.mdsol.com/ns/odm/metadata" xmlns:xlink="http://www.w3.
˓→org/1999/xlink" xmlns="http://www.cdisc.org/ns/odm/v1.3" FileType="Snapshot"
˓→FileOID="1af945c7-8334-4eb8-b7a9-735fb5c7db03" CreationDateTime="2013-09-
˓→10T09:28:21.145-00:00" ODMVersion="1.3">
<SiteRef LocationOID="TESTSITE"/>
</SubjectData>
</ClinicalData>
<ClinicalData StudyOID="SIMPLESTUDY(TEST)" MetaDataVersionOID="1128">
<SubjectData SubjectKey="91F686CE-37A0-4A9D-BC3B-CFFC3C609ECC"
˓→mdsol:SubjectKeyType="SubjectUUID" mdsol:SubjectName="10">
<SiteRef LocationOID="TESTSITE"/>
</SubjectData>
(continues on next page)
RWS allows extraction of clinical data from Rave’s Clinical Views by 3 strata:
1. By Study
2. By Individual Subject
3. By MetaData Version
All 3 variants take the same options:
Option Description
dataset_type={regular|raw}
Limit extracts to regular or raw data. Default is regular.
start={ISO Request changes to this dataset since the start date. Note that CV’s must be set to Include Inactive
8601 date} for this option to work.
rawsuf- e.g. .RAW means raw field definitions are suffixes with .RAW ex. AE_STDT.RAW
fix={suffix}
for- Only extracts dataset information for the named form. If missing extracts for all forms.
moid={form
oid}
version- Add MetaDataVersionOID=”<<datetime>>” and additional itemlevel version ItemData element per
item={version_suffix}
ItemGroup to identify last CV update date and CRF Version each itemgroup was entered under e.g.
<ItemData ItemOID=”AE.VERSION” Value=”16” />
codelistsuf- Add name of codelist as an item for each field with data dictionary. e.g. codelistsuffix=”CL” results
fix={cl_suffix}in <ItemData ItemDataOID=”DM.SEX.CL” Value=”GENDERS”/>
decodesuf- Add user value of codelist entry as an item for each field with data dictionary.
fix={decode_suffix}
e.g.decodesuffix=”DECODE” results in <ItemData ItemDataOID=”DM.SEX.DECODE”
Value=”Male”/>
stdsuf- Adds standard and unit data values to a full or incremental dataset, and identifies these values with
fix={decode_suffix}
{std-suffix}.
17
rwslib Documentation, Release 1.2.9
Warning: If not filtered by form this is a potentially very large download for an existing study.
Calls:
https://{ host }/RaveWebServices/studies/{ projectname } ({ environment_name})/
˓→datasets/{ regular|raw }?{options}
or (form filtered)
Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests import StudyDatasetRequest
>>> r = RWSConnection('innovate', 'username', 'password')
>>> r.send_request(StudyDatasetRequest('Mediflex', 'DEV'))
<?xml version="1.0" encoding="utf-8"?>
<ODM FileType="Snapshot" FileOID="6b967555-8e05-4890-afb2-c2d2f1496031"
CreationDateTime="2013-06-07T13:13:52.883-00:00"
ODMVersion="1.3" xmlns:mdsol="http://www.mdsol.com/ns/odm/metadata"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.cdisc.org/
....
<ClinicalData StudyOID="Mediflex(Dev)" MetaDataVersionOID="16">
<SubjectData SubjectKey="123 ABC">
<SiteRef LocationOID="MDSOL" />
<StudyEventData StudyEventOID="SUBJECT">
<FormData FormOID="AE" FormRepeatKey="1">
<ItemGroupData ItemGroupOID="AE_LOG_LINE" ItemGroupRepeatKey=
˓→"1">
Form Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests import StudyDatasetRequest
>>> r = RWSConnection('innovate', 'username', 'password')
>>> r.send_request(StudyDatasetRequest('SimpleStudy', 'TEST', formoid='VITAL'))
<?xml version="1.0" encoding="utf-8"?>
<ODM xmlns="http://www.cdisc.org/ns/odm/v1.3" xmlns:mdsol="http://www.mdsol.com/ns/
˓→odm/metadata" xmlns:xlink="http://www.w3.org/1999/xlink" FileType="Snapshot"
(continues on next page)
˓→FileOID="f323dba3-b31b-4e61-8894-104353fac743" CreationDateTime="2013-09-
˓→10T08:33:25.811-00:00" ODMVersion="1.3">
Note: Note that the XML string returned by this method includes the Byte Order Mark (BOM) as sent by RWS and
does not include line breaks as shown in the above example. Depending on how you intend to parse the XML returned
you may need to strip the BOM.
or (form filtered)
Example:
>>> from rwslib import RWSConnection
>>> r = RWSConnection('innovate', 'username', 'password')
>>> from rwslib.rws_requests import SubjectDatasetRequest
>>> r.send_request(SubjectDatasetRequest('SIMPLESTUDY','TEST','1', formoid='ENROL'))
<?xml version="1.0" encoding="UTF-8"?>
<ODM xmlns="http://www.cdisc.org/ns/odm/v1.3" xmlns:mdsol="http://www.mdsol.com/ns/
˓→odm/metadata" xmlns:xlink="http://www.w3.org/1999/xlink" FileType="Snapshot"
˓→FileOID="c850bb82-f08f-4f43-9c8c-fce2b5e80e79" CreationDateTime="2013-09-
(continues on next page)
˓→10T15:23:22.395-00:00" ODMVersion="1.3">
or (form filtered)
Example:
˓→FileOID="00d28b0e-df45-43a4-93dc-7e4dd3cf36e7" CreationDateTime="2013-09-
˓→10T15:45:54.179-00:00" ODMVersion="1.3">
4.4 X-MWS-CV-Last-Updated
The Clinical View datasets return a header, X-MWS-CV-Last-Updated, which tells you the last time a Clinical View
was updated.
This is especially important with Incremental calls using the start option to know whether the dataset has actually
been updated since your last call.
You can get the value of X-MWS-CV-Last-Updated via the last_result.headers property:
4.4. X-MWS-CV-Last-Updated 21
rwslib Documentation, Release 1.2.9
Access to Architect study designs relies on the credentials you supply having access to Rave Architect. See Working
with Global Library Metadata for details on how to access study Metadata in Global Libraries.
5.1 MetadataStudiesRequest()
Example:
23
rwslib Documentation, Release 1.2.9
Studies returned in the list from metadata_studies() have an empty environment attribute since they represent study
designs, they do not have associated environments.
5.2 StudyDraftsRequest(project_name)
Example:
>>> drafts.study.studyname
Mediflex
5.3 StudyVersionsRequest(projectname)
Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests import StudyVersionsRequest
>>> r = RWSConnection('https://innovate.mdsol.com', 'username', 'password')
>>> projectname = 'Mediflex'
>>> versions = r.send_request(StudyVersionsRequest(projectname))
>>> versions.fileoid
66567494-c76a-4b94-afbb-64f5c1b21cbb
>>> versions.study.studyname
Mediflex
>>> for version in versions:
... print(version.name, version.oid)
v19 1015
v18 1007
v17 999
v16 481
Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests import StudyVersionRequest
>>> r = RWSConnection('innovate', 'username', 'password')
FileOID="012d24dd-d7d8-44fe-997b-b287ae4faf7e" ODMVersion="1.3"
xmlns:mdsol="http://www.mdsol.com/ns/odm/metadata" xmlns="http://www.cdisc.org/
˓→ns/odm/v1.3">
<Study OID="Mediflex">
<GlobalVariables>
(continues on next page)
5.3. StudyVersionsRequest(projectname) 25
rwslib Documentation, Release 1.2.9
rwslib does not automatically parse this xml for you (you may want to control this yourself) but rwslib does include
some XML helper methods that make working with XML that is generated from web-services easier.
Note: At this time RWS does not provide a way retrieve the ODM for a Draft, only for a Version.
Options:
Option Description
headers={‘Content- Set custom headers. May need to provide a Content-type if your RWS version is set to
type’: “text/xml”} accept different standard content-type than default.
Example:
... <Protocol>
... <StudyEventRef StudyEventOID="SCREEN" OrderNumber="1" Mandatory="No" />
... </Protocol>
(continues on next page)
... <Question>
... <TranslatedText xml:lang="en">Subject ID</TranslatedText>
... </Question>
... </ItemDef>
... <ItemDef OID="BIRTHDT" Name="BIRTHDT" DataType="date" mdsol:DateTimeFormat=
˓→"yyyy MMM dd" mdsol:ControlType="DateTime">
... <Question>
... <TranslatedText xml:lang="en">Date of Birth</TranslatedText>
... </Question>
... </ItemDef>
... <ItemDef OID="WEIGHT_KG" Name="WEIGHT_KG" DataType="float" Length="4"
˓→SignificantDigits="1" mdsol:ControlType="Text">
... <Question>
... <TranslatedText xml:lang="en">Weight</TranslatedText>
... </Question>
... </ItemDef>
... <ItemDef OID="HEIGHT_CM" Name="HEIGHT_CM" DataType="float" Length="4"
˓→SignificantDigits="1" mdsol:ControlType="Text">
... <Question>
... <TranslatedText xml:lang="en">Height</TranslatedText>
... </Question>
... </ItemDef>
... </MetaDataVersion>
... </Study>
... </ODM>
rwslib provides access to metadata stored in Rave Global Library Volumes. You must provide credentials that have
access to Global Library Volumes to read this metadata. See Working with Architect Metadata for information on
working with Architect Study Designs.
6.1 GlobalLibrariesRequest()
Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests import GlobalLibrariesRequest
>>> r = RWSConnection('https://innovate.mdsol.com', 'username', 'password')
>>> gl_studies = r.send_request(GlobalLibrariesRequest())
>>> print("There are %d global libaries" % len(gl_studies))
>>> for study in gl_studies:
... print(study.studyname)
There are 1 global libaries
Mediflex
6.2 GlobalLibraryDraftsRequest(projectname)
29
rwslib Documentation, Release 1.2.9
Returns a rwsobjects.RWSStudyMetadataVersions object which inherits from RWSStudy. This has ODM
document attributes, study attributes and a list of rwsobjects.RWSStudyListItem objects representing Rave
Architect Global Library Drafts
Calls:
Example:
6.3 GlobalLibraryVersionsRequest(projectname)
Example:
Example:
˓→xmlns:mdsol="http://www.mdsol.com/ns/odm/metadata" xmlns="http://www.cdisc.org/ns/
˓→odm/v1.3">
<Protocol>
...
Note: At this time RWS does not provide a way retrieve the ODM for a Draft, only for a Version.
Creating or updating subject data in Rave is managed via the post_data method to RWS.
7.1 PostDataRequest(odm_data)
Options:
Option Description
headers={‘Content- Set custom headers. May need to provide a Content-type if your RWS version is set to
type’: “text/xml”} accept different standard content-type than default.
Note that the content-type header that RWS will accept can be varied by configuration. The standard, default setting
is text/xml. You should not need to specify content_type in the normal case.
Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests import PostDataRequest
>>> r = RWSConnection('https://innovate.mdsol.com', 'username', 'password')
˓→#Authorization required
33
rwslib Documentation, Release 1.2.9
NewRecords=""
SubjectNumberInStudy="1103"
SubjectNumberInStudySite="55"/>
Creating ODM strings can be error prone, especially when dealing with XML entities such as > < & etc.
rwslib provides the builders module to help build ODM documents using python syntax.
The ODM from the example above could be generated using the builder vocabulary:
See Using Builders for examples of using rwslib builder objects to create ODM messages.
Using Builders
Creating ODM messages by hand can be difficult. The builders package provides a simple API for generating these
ODM documents.
Here is an example of an ODM message to create a subject and update two values in the Enrollment default form for
this study.
FileType="Transactional" ODMVersion="1.3"
Originator="test system"
xmlns="http://www.cdisc.org/ns/odm/v1.3" xmlns:mdsol="http://www.mdsol.com/ns/
˓→odm/metadata">
This ODM file can be created using builders with this python code:
37
rwslib Documentation, Release 1.2.9
Builders also allow you to create the elements in stages and “pipeline” them together to create the document. The
following example creates the same document as above:
The builder creates a number of ODM properties including CreationDateTime, FileOID (a random identifier), FileType
and all namespace declarations.
study_name = 'MyStudy'
draft_name = 'Draft 1'
# Add some measurement units to the basic definitions. This time using the call ()
˓→syntax:
bd(
MeasurementUnit("KG", "Kilograms")(
Symbol()(TranslatedText("Kilograms"))
),
MeasurementUnit("CM", "Centimeters")(
Symbol()(TranslatedText("Centimeters"))
)
)
# Now metadata which will contain all our form and field defs eventually
meta = MetaDataVersion('META1', draft_name)
study << meta
dm_form = FormDef("DM","Demography")
dm_form << MdsolHelpText("en","Some help text for Demography form")
dm_form << MdsolViewRestriction('Data Manager')
dm_form << MdsolEntryRestriction('Batch Upload')
(continues on next page)
# Add to metadata
meta << dm_form
)(
Question()(TranslatedText("Gender at Birth")),
CodeListRef("CL_SEX")
)
meta << ItemDef("RACE", "Race", DATATYPE_TEXT, 2,
control_type=ItemDef.CONTROLTYPE_RADIOBUTTON_VERTICAL
)(
Question()(TranslatedText("Race")),
CodeListRef("CL_RACE")
)
meta << ItemDef("RACE_OTH", "RaceOther", DATATYPE_TEXT, 20) \
<< Question() << TranslatedText("If Race Other, please specify")
)(
Question()(TranslatedText("Age in Years")),
RangeCheck(RangeCheck.GREATER_THAN_EQUAL_TO, RangeCheck.SOFT) (
CheckValue("18")
),
RangeCheck(RangeCheck.LESS_THAN_EQUAL_TO, RangeCheck.SOFT) (
CheckValue("65")
)
)
# Add a Label
meta.add(MdsolLabelDef("LBL1", "Label1")(TranslatedText("Please answer all questions.
˓→")))
# Get an lxml document from the ODM object for further manipulation
root = odm.getroot()
Options:
43
rwslib Documentation, Release 1.2.9
Option Description
rawsuf- e.g. .RAW means raw field definitions are suffixes with .RAW ex. AE_STDT.RAW
fix={suffix}
version- Add MetaDataVersionOID=”<<datetime>>” and additional itemlevel version ItemData element per
item={version_suffix}
ItemGroup to identify last CV update date and CRF Version each itemgroup was entered under e.g.
<ItemData ItemOID=”AE.VERSION” Value=”16” />
codelistsuf- Add name of codelist as an item for each field with data dictionary. e.g. codelistsuffix=”CL” results
fix={cl_suffix}in <ItemData ItemDataOID=”DM.SEX.CL” Value=”GENDERS”/>
decodesuf- Add user value of codelist entry as an item for each field with data dictionary.
fix={decode_suffix}
e.g.decodesuffix=”DECODE” results in <ItemData ItemDataOID=”DM.SEX.DECODE”
Value=”Male”/>
Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests.biostats_gateway import *
>>> r = RWSConnection('https://innovate.mdsol.com', 'username', 'password')
˓→#Authorization required
>>> print(cv_metadata_odm)
<?xml version="1.0" encoding="utf-8"?><ODM FileType="Snapshot" Granularity="Metadata"
CreationDateTime="2013-10-07T13:39:33.334-00:00"
FileOID="0299d82e-8b76-4363-bd3e-2e6985999ce4" ODMVersion="1.3"
xmlns="http://www.cdisc.org/ns/odm/v1.3">
<Study OID="SIMPLESTUDY (TEST)">
<GlobalVariables>
<StudyName>SIMPLESTUDY (TEST)</StudyName>
<StudyDescription></StudyDescription>
<ProtocolName>SIMPLESTUDY</ProtocolName>
</GlobalVariables>
<MetaDataVersion OID="2013-06-24T09:47:04.000-00:00" Name="2013-06-
˓→24T09:47:04.000-00:00">
</MetaDataVersion>
</Study>
</ODM>
Note that dataset_type can be ‘regular’ or ‘raw’. When called with a dataset type of “csv” a .csv is appended to the
end of the form oid in the calling URL. When left off, XML will be returned.
Options:
Option Description
start={ISO 8601 Request changes to this dataset since the start date. Note that CV’s must be set to Include
date} Inactive for this option to work.
dataset_format={csv Determine the format returned by the request object. CSV is the default, but can also return
| xml} XML in a simple format.
Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests.biostats_gateway import FormDataRequest
>>> r = RWSConnection('https://innovate.mdsol.com', 'username', 'password')
˓→#Authorization required
>>> print(vital_csv_data)
userid,projectid,project,studyid,environmentName,subjectId,StudySiteId,Subject,siteid,
˓→Site,SiteNumber,SiteGroup,instanceId,InstanceName,InstanceRepeatNumber,folderid,
(continues on next page)
˓→Folder,FolderName,FolderSeq,TargetDays,DataPageId,DataPageName,PageRepeatNumber,
˓→RecordDate,RecordId,recordposition,RecordActive,SaveTs,MinCreated,MaxUpdated,VDAT,
˓→"Vitals","0","","1346659","0","1","2013-06-24T09:52:52","2013-06-24T09:52:10","2013-
˓→","1","132.0","132","174.5","174.5"
"457","85","SIMPLESTUDY","95","TEST","32113","143","2","120","TESTSITE","TESTSITE",
˓→"World","192311","Screening","0","5791","SCREEN","Screening","1.0","","662504",
˓→"Vitals","0","","1346661","0","1","2013-06-24T09:52:52","2013-06-24T09:52:11","2013-
˓→","9","82.5","82.5","173.0","173"
"457","85","SIMPLESTUDY","95","TEST","32114","143","3","120","TESTSITE","TESTSITE",
˓→"World","192312","Screening","0","5791","SCREEN","Screening","1.0","","662506",
˓→"Vitals","0","","1346663","0","1","2013-06-24T09:52:52","2013-06-24T09:52:12","2013-
˓→","14","95.2","95.2","152.0","152"
"457","85","SIMPLESTUDY","95","TEST","32115","143","4","120","TESTSITE","TESTSITE",
˓→"World","192313","Screening","0","5791","SCREEN","Screening","1.0","","662508",
˓→"Vitals","0","","1346665","0","1","2013-06-24T09:52:52","2013-06-24T09:52:13","2013-
˓→","16","67.7","67.7","178.0","178"
"457","85","SIMPLESTUDY","95","TEST","32116","143","5","120","TESTSITE","TESTSITE",
˓→"World","192314","Screening","0","5791","SCREEN","Screening","1.0","","662510",
˓→"Vitals","0","","1346667","0","1","2013-06-24T09:52:52","2013-06-24T09:52:15","2013-
˓→","19","81.5","81.5","158.0","158"
"457","85","SIMPLESTUDY","95","TEST","32117","143","6","120","TESTSITE","TESTSITE",
˓→"World","192315","Screening","0","5791","SCREEN","Screening","1.0","","662512",
˓→"Vitals","0","","1346669","0","1","2013-06-24T09:52:52","2013-06-24T09:52:16","2013-
˓→","24","73.9","73.9","180.5","180.5"
"457","85","SIMPLESTUDY","95","TEST","32118","143","7","120","TESTSITE","TESTSITE",
˓→"World","192316","Screening","0","5791","SCREEN","Screening","1.0","","662514",
˓→"Vitals","0","","1346671","0","1","2013-06-24T09:52:52","2013-06-24T09:52:17","2013-
˓→","6","","","175.0","175"
"457","85","SIMPLESTUDY","95","TEST","32119","143","8","120","TESTSITE","TESTSITE",
˓→"World","192317","Screening","0","5791","SCREEN","Screening","1.0","","662516",
˓→"Vitals","0","","1346673","0","1","2013-06-24T09:52:52","2013-06-24T09:52:18","2013-
˓→","11","114.8","114.8","190.0","190"
"457","85","SIMPLESTUDY","95","TEST","32120","143","9","120","TESTSITE","TESTSITE",
˓→"World","192318","Screening","0","5791","SCREEN","Screening","1.0","","662518",
˓→"Vitals","0","","1346675","0","1","2013-06-24T09:52:52","2013-06-24T09:52:19","2013-
˓→","16","68.8","68.8","184.0","184"
"457","85","SIMPLESTUDY","95","TEST","32121","143","10","120","TESTSITE","TESTSITE",
˓→"World","192319","Screening","0","5791","SCREEN","Screening","1.0","","662520",
˓→"Vitals","0","","1346677","0","1","2013-06-24T09:52:52","2013-06-24T09:52:20","2013-
˓→","26","92.7","92.7","175.0","175"
EOF
9.3 MetaDataRequest()
Returns metadata for all Clinical Views that you have access to in XML or CSV format.
Warning: This could be a large download if you have access to several studies or to a large study. It may be better
to request data only for a single study using ProjectMetaDataRequest
Options:
Option Description
dataset_format={csv Determine the format returned by the request object. CSV is the default, but can also return
| xml} XML in a simple format.
Calls:
https://{{ host }}/RaveWebServices/datasets/ClinicalViewMetadata[.csv]
Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests.biostats_gateway import MetaDataRequest
>>> r = RWSConnection('https://innovate.mdsol.com', 'username', 'password')
˓→#Authorization required
˓→" />
˓→" />
˓→"Environment" />
˓→" />
(continues on next page)
9.3. MetaDataRequest() 47
rwslib Documentation, Release 1.2.9
˓→"SiteNumber" />
˓→"SiteGroup" />
˓→"InstanceRepeatNumber" />
˓→" />
˓→"BIRTHDT" />
˓→"BIRTHDT(Character)" />
˓→"BIRTHDTInterpolated" />
˓→"BIRTHDTYear" />
˓→"BIRTHDTMonth" />
˓→" />
˓→"projectid" />
˓→"project" />
˓→varlabel="Environment" />
....
</dataset>
</datasets>
9.4 ProjectMetaDataRequest(project_name)
Option Description
dataset_format={csv Determine the format returned by the request object. CSV is the default, but can also return
| xml} XML in a simple format.
Calls:
9.4. ProjectMetaDataRequest(project_name) 49
rwslib Documentation, Release 1.2.9
Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests.biostats_gateway import MetaDataRequest
>>> r = RWSConnection('https://innovate.mdsol.com', 'username', 'password')
˓→#Authorization required
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","2","projectid","num","8","10.","projectid"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","3","project","char","255","$255.","project"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","4","studyid","num","8","10.","Internal id for
˓→the study"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","5","environmentName","char","20","$20.",
˓→"Environment"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","6","subjectId","num","8","10.","Internal id for
˓→the subject"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","7","StudySiteId","num","8","10.","Internal id
˓→for study site"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","8","Subject","char","50","$50.","Subject name or
˓→identifier"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","10","Site","char","255","$255.","Site name"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","11","SiteNumber","char","50","$50.","SiteNumber"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","12","SiteGroup","char","40","$40.","SiteGroup"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","13","instanceId","num","8","10.","Internal id
˓→for the instance"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","14","InstanceName","char","255","$255.","Folder
˓→instance name"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","15","InstanceRepeatNumber","num","8","10.",
˓→"InstanceRepeatNumber"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","16","folderid","num","8","10.","Internal id for
˓→the folder"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","17","Folder","char","50","$50.","Folder OID"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","18","FolderName","char","255","$255.","Folder
˓→name"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","19","FolderSeq","num","8","12.1","Folder
˓→sequence number"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","20","TargetDays","num","8","10.","Target days
˓→from study start"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","21","DataPageId","num","8","10.","Internal id
˓→for data page"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","22","DataPageName","char","255","$255.","eCRF
˓→page name"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","23","PageRepeatNumber","num","8","10.","Sequence
˓→number of eCRF page in folder"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","24","RecordDate","num","8","datetime22.3",
˓→"Clinical date of record (ex: visit date)"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","25","RecordId","num","8","10.","Internal id for
˓→the record"
"SIMPLESTUDY","V_SIMPLESTUDY_ENROL","26","recordposition","num","8","10.","Record
˓→number"
(continues on next page)
9.5 ViewMetaDataRequest(view_name)
for production-only views if these are set to be created by the Rave Clinical View Settings.
Options:
Option Description
dataset_format={csv Determine the format returned by the request object. CSV is the default, but can also return
| xml} XML in a simple format.
Calls:
https://{{ host }}/RaveWebServices/datasets/ClinicalViewMetadata[.csv]?ViewName={view_
˓→name}
Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests.biostats_gateway import MetaDataRequest
>>> r = RWSConnection('https://innovate.mdsol.com', 'username', 'password')
˓→#Authorization required
>>> print(ss_vital_meta)
<?xml version="1.0" encoding="UTF-8"?>
<datasets>
<dataset>
<record projectname="SIMPLESTUDY" viewname="V_SIMPLESTUDY_VITAL" ordinal="1"
˓→varname="userid" vartype="num" varlength="8" varformat="10." varlabel="Internal id
˓→" />
˓→" />
9.5. ViewMetaDataRequest(view_name) 51
rwslib Documentation, Release 1.2.9
˓→"Environment" />
˓→" />
˓→"SiteNumber" />
˓→"SiteGroup" />
˓→"InstanceRepeatNumber" />
˓→" />
˓→/>
˓→"VDAT(Character)" />
˓→"VDATInterpolated" />
˓→>
˓→" />
˓→"WEIGHT_KG(Character)" />
˓→" />
˓→"HEIGHT_CM(Character)" />
</dataset>
</datasets>
Options:
Option Description
dataset_format={csv Determine the format returned by the request object. CSV is the default, but can also return
| xml} XML in a simple format.
Calls:
https://{{ host }}/RaveWebServices/datasets/SDTMComments[.csv]?studyid={project_name}(
˓→{environment_name})
Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests.biostats_gateway import CommentDataRequest
>>> r = RWSConnection('https://innovate.mdsol.com', 'username', 'password')
˓→#Authorization required
˓→RecordID,RecordPosition,FieldOID,Text,Updated,DataActive,RecordActive
"SIMPLESTUDY","TEST","TESTSITE","3","32114","","","","Enrol","662507","0","2289018",
˓→"ENROL","1346664","0","BIRTHDT","This subject was late","10/7/2013 3:50:18 PM","True
˓→","True"
"SIMPLESTUDY","TEST","TESTSITE","8","32119","Screening","192317","0","Vitals","662516
˓→","0","2289046","VITAL","1346673","0","HEIGHT_CM","This weight was not taken during
EOF
Option Description
dataset_format={csv Determine the format returned by the request object. CSV is the default, but can also return
| xml} XML in a simple format.
Calls:
https://{{ host }}/RaveWebServices/datasets/SDTMProtocolDeviations[.csv]?studyid=
˓→{project_name}({environment_name})
Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests.biostats_gateway import ProtocolDeviationsRequest
>>> r = RWSConnection('https://innovate.mdsol.com', 'username', 'password')
˓→#Authorization required
˓→RecordID,RecordPosition,FieldOID,Text,Updated,PDClass,PDCode,DataActive,RecordActive
˓→","True","True"
"SIMPLESTUDY","TEST","TESTSITE","8","32119","Screening","192317","0","Vitals","662516
˓→","0","2289046","VITAL","1346673","0","HEIGHT_CM","Height/Weight outside range!",
EOF
Option Description
dataset_format={csv Determine the format returned by the request object. CSV is the default, but can also return
| xml} XML in a simple format.
Calls:
Example:
....
</dataset>
</datasets>
The ODM Adapter module provides Request implementations for the Rave Web Service ODM Adapter URLs. These
include:
• Clinical Audit Records Dataset
• Version Folders Dataset
• Sites Dataset
• Users Dataset
• Signature Definitions Dataset
Read more about ODM Adapter in the Rave Web Services documentation
Options:
Option Description
startid=1 The audit ID to start on. Defaults to 1. The first Audit ID
per_page=100 How many audits to return per request. Default is 100.
57
rwslib Documentation, Release 1.2.9
Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests.odm_adapter import *
>>> r = RWSConnection('https://innovate.mdsol.com', 'username', 'password')
>>> audits = r.send_request(AuditRecordsRequest('MEDIFLEX','DEV'))
>>> r.last_request.headers
{.....'Link': '<https://innovate.mdsol.com/RaveWebServices/datasets/
˓→ClinicalAuditRecords.odm?studyoid=MEDIFLEX%28DEV%29&startid=3842&per_page=1000>;
Note that the audit_event example in the extras package of rwslib provides a parser for the content of audit records and
a class to simplify the consumption of this web service. See the README for that project in the extras/audit_event
package.
Example:
>>> from rwslib import RWSConnection
>>> from rwslib.rws_requests.odm_adapter import *
>>> r = RWSConnection('https://innovate.mdsol.com', 'username', 'password')
>>> r.send_request(VersionFoldersRequest('MEDIFLEX','DEV'))
<?xml version="1.0" encoding="UTF-8"?>
<ODM xmlns="http://www.cdisc.org/ns/odm/v1.3" xmlns:mdsol="http://www.mdsol.com/ns/
˓→odm/metadata" ODMVersion="1.3" Granularity="Metadata" FileType="Snapshot" FileOID=
˓→"2f4f7fdf-f5db-4150-bf41-79060d4b5ffb" CreationDateTime="2016-04-13T13:53:04.000-
˓→00:00">
<Study OID="Mediflex(Dev)">
<GlobalVariables>
<StudyName>Mediflex(Dev)</StudyName>
<StudyDescription />
<ProtocolName>Mediflex</ProtocolName>
</GlobalVariables>
<MetaDataVersion OID="16" Name="1" mdsol:PrimaryFormOID="EN">
<Protocol>
<StudyEventRef StudyEventOID="YEAR1" OrderNumber="7" Mandatory="No"
˓→mdsol:StudyEventDefName="Year 01" mdsol:StudyEventDefType="Common"
˓→mdsol:StudyEventDefRepeating="No" />
</Protocol>
</MetaDataVersion>
<MetaDataVersion OID="16" Name="1" mdsol:MatrixOID="ADDCYCLE"
˓→mdsol:PrimaryFormOID="EN">
<Protocol>
<StudyEventRef StudyEventOID="ADDCYCLE" OrderNumber="11" Mandatory="No"
˓→mdsol:StudyEventDefName="Additional Cycle" mdsol:StudyEventDefType="Common"
(continues on next page)
˓→mdsol:StudyEventDefRepeating="No" />
<Protocol>
<StudyEventRef StudyEventOID="SCREEN" OrderNumber="1" Mandatory="No"
˓→mdsol:StudyEventDefName="Screening" mdsol:StudyEventDefType="Common"
˓→mdsol:StudyEventDefRepeating="No" />
˓→mdsol:StudyEventDefRepeating="No" />
˓→mdsol:StudyEventDefRepeating="No" />
˓→mdsol:StudyEventDefRepeating="No" />
˓→mdsol:StudyEventDefRepeating="No" />
˓→mdsol:StudyEventDefRepeating="No" />
˓→mdsol:StudyEventDefRepeating="No" />
</Protocol>
</MetaDataVersion>
<MetaDataVersion OID="16" Name="1" mdsol:MatrixOID="EXTCYCLE"
˓→mdsol:PrimaryFormOID="EN">
<Protocol>
<StudyEventRef StudyEventOID="EXTCYCLE" OrderNumber="10" Mandatory="No"
˓→mdsol:StudyEventDefName="Extended Cycle" mdsol:StudyEventDefType="Common"
˓→mdsol:StudyEventDefRepeating="No" />
</Protocol>
</MetaDataVersion>
<MetaDataVersion OID="16" Name="1" mdsol:MatrixOID="UNSCHEDULED"
˓→mdsol:PrimaryFormOID="EN">
<Protocol>
<StudyEventRef StudyEventOID="UNSCHEDULED" OrderNumber="6" Mandatory="No"
˓→mdsol:StudyEventDefName="Visit" mdsol:StudyEventDefType="Common"
˓→mdsol:StudyEventDefRepeating="No" />
</Protocol>
</MetaDataVersion>
<MetaDataVersion OID="16" Name="1" mdsol:MatrixOID="VISITS"
˓→mdsol:PrimaryFormOID="EN">
<Protocol>
<StudyEventRef StudyEventOID="VISIT01" OrderNumber="2" Mandatory="No"
˓→mdsol:StudyEventDefName="Visit 01" mdsol:StudyEventDefType="Common"
˓→mdsol:StudyEventDefRepeating="No" />
mdsol:MatrixOID="VISITS"
<StudyEventRef StudyEventOID="VISIT02" OrderNumber="3" Mandatory="No"
˓→mdsol:StudyEventDefName="Visit 02" mdsol:StudyEventDefType="Common"
˓→mdsol:StudyEventDefRepeating="No" />
mdsol:MatrixOID="VISITS"
<StudyEventRef StudyEventOID="VISIT03" OrderNumber="4" Mandatory="No"
˓→mdsol:StudyEventDefName="Visit 03" mdsol:StudyEventDefType="Common"
˓→mdsol:StudyEventDefRepeating="No" />
</Protocol>
</MetaDataVersion>
<MetaDataVersion OID="23" Name="2" mdsol:MatrixOID="ADDCYCLE"
˓→mdsol:PrimaryFormOID="EN">
<Protocol>
<StudyEventRef StudyEventOID="ADDCYCLE" OrderNumber="11" Mandatory="No"
˓→mdsol:StudyEventDefName="Additional Cycle" mdsol:StudyEventDefType="Common"
˓→mdsol:StudyEventDefRepeating="No" />
</Protocol>
</MetaDataVersion>
....
</Study>
</ODM>
10.3 SitesMetadataRequest()
Options:
Option Description
project_name={projectname} Project to filter the result set to (recommended)
environment_name={environment} Environment to filter the result set to
If used, the project_name and environmen_namet must both be supplied or an error will result.
Example:
˓→9b9dfe5d740b" CreationDateTime="2016-04-13T13:59:25">
</Location>
<Location OID="MEDI0001" Name="Medidata" LocationType="Site" mdsol:Active="Yes">
<MetaDataVersionRef StudyOID="Mediflex(Dev)" MetaDataVersionOID="1015"
˓→EffectiveDate="2013-05-02" mdsol:StudySiteNumber="" />
</Location>
</AdminData>
</ODM>
Options:
Option Description
locationoid A site number from Rave that uniquely identifies a site
Example:
˓→c3ae220ed2bd" CreationDateTime="2016-04-13T14:20:01">
<AdminData>
<User OID="isparks_other_account" UserType="Other" mdsol:Active="Yes"
˓→mdsol:UserGroup="Test" mdsol:SiteGroup="World" mdsol:UserRole="Batch Upload">
<LoginName>isparks_other_account</LoginName>
<DisplayName>Ian Sparks</DisplayName>
<FullName>Ian Sparks</FullName>
<FirstName>Ian</FirstName>
<LastName>Sparks</LastName>
<Address />
<Email>[email protected]</Email>
<Fax />
<Phone />
(continues on next page)
10.5 SignatureDefinitionsRequest(project_name)
Example:
FileType="Snapshot" FileOID="1d885ac2-ffc7-4b10-a2ab-bfc056a1d57e"
˓→CreationDateTime="2016-04-13T16:08:44">
<AdminData>
<SignatureDef Methodology="Electronic" OID="2866" mdsol:Study="SIMPLESTUDY">
<Meaning>Approval</Meaning>
<LegalReason>I hereby confirm that all data is accurate to the best of my
˓→knowledge.</LegalReason>
</SignatureDef>
<SignatureDef Methodology="Electronic" OID="2867" mdsol:Study="SIMPLESTUDY">
<Meaning>Approval</Meaning>
<LegalReason>I hereby confirm that all data is accurate to the best of my
˓→knowledge.</LegalReason>
</SignatureDef>
<SignatureDef Methodology="Electronic" OID="2919" mdsol:Study="SIMPLESTUDY">
<Meaning>Approval</Meaning>
<LegalReason>I hereby confirm that all data is accurate to the best of my
˓→knowledge.</LegalReason>
</SignatureDef>
<SignatureDef Methodology="Electronic" OID="2976" mdsol:Study="SIMPLESTUDY">
<Meaning>Approval</Meaning>
<LegalReason>I hereby confirm that all data is accurate to the best of my
˓→knowledge.</LegalReason>
</SignatureDef>
</AdminData>
</ODM>
rwscmd
rwscmd is a command-line tool providing convenient access to Rave WebServices, via rwslib.
11.1 Usage
Commands:
autofill Request enterable data for a subject,...
data List EDC data for [STUDY] [ENV] [SUBJECT]
direct Make direct call to RWS, bypassing rwslib
metadata List metadata for [PROJECT] [VERSION]
post Post ODM clinical data
version Display RWS version
11.2 Examples
63
rwslib Documentation, Release 1.2.9
$ export RWSCMD_USERNAME=anewbigging
$ export RWSCMD_PASSWORD=*********
Class Reference
12.1 rwslib
exception rwslib.AuthorizationException
Raised if a request requires authorization but no authorization header is provided
class rwslib.RWSConnection(domain, username=None, password=None, auth=None, vir-
tual_dir=’RaveWebServices’)
A connection to RWS
Create a connection to Rave
Parameters
• domain (str) – Rave URL Name
• username (str) – Rave User Login
• password (str) – Rave User password
• auth (str) – Authentication tuple (usually something like (username, password)
• virtual_dir (str) – Name of the Rave Web Services prefix (usually RaveWebServices,
but can be customised)
Note: If the domain does not start with http then it is assumed to be the name of the Medidata url and https://
will be added as a prefix and .mdsol.com will be added as a postfix.
• innovate => https://innovate.mdsol.com
• http://mytest => http:/mytest
65
rwslib Documentation, Release 1.2.9
be generated from the text response from RWS. A timeout, in seconds, can be optionally passed into
send_request.
Core request classes that implement calls available in all versions of RWS.
RWSRequest subclasses represent URL endpoints. They can be passed to a RWSConnection get or post method as
appropriate.
TODO: Note that might want to make the Request objects responsible for deciding whether they are get, post, patch
etc.
class rwslib.rws_requests.BuildVersionRequest
Return the RWS build version number
class rwslib.rws_requests.CacheFlushRequest
Calls RWS cache-flush
result(response)
Return RWSResponse object for success :param requests.models.Response response: request respnse
class rwslib.rws_requests.ClinicalStudiesRequest
Return the list of clinical studies as a RWSStudies object. Clinical studies are the studies that you have access
to as an EDC user.
result(response)
Return RWSResponse object for success :param requests.models.Response response: request respnse
class rwslib.rws_requests.CodeNameRequest
Return the RWS version codename
class rwslib.rws_requests.ConfigurableDatasetRequest(dataset_name,
dataset_format=”,
params={})
Create a new Configurable Dataset Request :param dataset_name: Name for the dataset :type dataset_name: str
:param dataset_format: Format for the dataset :type dataset_format: str :param params: set of parameters to
pass to URL :type params: dict
dataset
Qualify the dataset_name with the dataset_format if supplied :return: dataset name :rtype: str
class rwslib.rws_requests.DiagnosticsRequest
Return the RWS build version number
class rwslib.rws_requests.GlobalLibrariesRequest
Return the list of global libraries as a RWSStudies object. metadata_libraries are the list of libraries that you
have access to as an Architect Global Library Volume user
result(response)
Return RWSResponse object for success :param requests.models.Response response: request respnse
class rwslib.rws_requests.GlobalLibraryDraftsRequest(project_name)
Return the list of global library drafts
Parameters project_name (str) – Project Name
result(response)
Return RWSResponse object for success :param requests.models.Response response: request respnse
class rwslib.rws_requests.RWSRequest
Base class for all RWS Requests
args()
Return additional args here as dict
result(response)
Process a result to create a custom output :param requests.models.Response response: returned response
:return:
class rwslib.rws_requests.StudyDatasetRequest(project_name, environment_name,
dataset_type=’regular’, start=None,
rawsuffix=None, formoid=None, ver-
sionitem=None, codelistsuffix=None,
decodesuffix=None, stdsuffix=None)
Return the text of the full datasets listing as an ODM string.
Parameters
• project_name (str) – Name of the Rave Study
• environment_name (str) – Name of the Rave Study Environment
• dataset_type (str) – Dataset type, one of ‘regular’ or ‘raw’
• start (str) – Start date for the Report (iso8601)
• rawsuffix (str) – Adds raw data values to a full or incremental dataset, and identifies
these values with {rawsuffix}.
• formoid (str) – FormOID for which to report
• versionitem (str) – Adds the subject’s CRF version to the dataset, and identifies it
with {version-item}
• codelistsuffix (str) – Adds code list OIDS for fields that use a code list to the
dataset, and identifies these values with {codelistsuffix}.
• decodesuffix (str) – Add decoded values of items that have an associated code list to
the dataset, and identifies these values with {decodesuffix}.
• stdsuffix (str) – Adds standard data values to a full or incremental dataset, and iden-
tifies these values with {stdsuffix}.
class rwslib.rws_requests.StudyDraftsRequest(project_name)
Return the list of study drafts
Parameters project_name (str) – Project Name
result(response)
Return RWSResponse object for success :param requests.models.Response response: request respnse
class rwslib.rws_requests.StudySubjectsRequest(project_name, environment_name,
status=False, include=None, sub-
ject_key_type=’SubjectName’,
links=False)
Return the list of study subjects, defaults to the PROD environment
Parameters
• project_name (str) – Project/Study Name
• environment_name (str) – Study Environment Name (eg Prod)
• status (bool) – Add subject level workflow status
Note: If status == True then ?status=all If include then include parameter is also added to query string
result(response)
Return RWSSubjects object for success :param requests.models.Response response: request response
class rwslib.rws_requests.StudyVersionRequest(project_name, oid)
Return a study version as a string
Parameters
• project_name (str) – Project Name
• oid (int) – Metadata version OID (CRF Draft Number)
class rwslib.rws_requests.StudyVersionsRequest(project_name)
Return the list of study versions
Parameters project_name (str) – Project Name
result(response)
Return RWSResponse object for success :param requests.models.Response response: request respnse
class rwslib.rws_requests.SubjectDatasetRequest(project_name, environment_name,
subjectkey, dataset_type=’regular’,
start=None, rawsuffix=None, for-
moid=None, versionitem=None,
codelistsuffix=None, decodesuf-
fix=None, stdsuffix=None)
Return the text of the full datasets for a version as an ODM string. By supplying formoid, will be filtered to just
that formoid data
Parameters
• project_name (str) – Name of the Rave Study
• environment_name (str) – Name of the Rave Study Environment
• dataset_type (str) – Dataset type, one of ‘regular’ or ‘raw’
• start (str) – Start date for the Report (iso8601)
• rawsuffix (str) – Adds raw data values to a full or incremental dataset, and identifies
these values with {rawsuffix}.
• formoid (str) – FormOID for which to report
• versionitem (str) – Adds the subject’s CRF version to the dataset, and identifies it
with {version-item}
• codelistsuffix (str) – Adds code list OIDS for fields that use a code list to the
dataset, and identifies these values with {codelistsuffix}.
• decodesuffix (str) – Add decoded values of items that have an associated code list to
the dataset, and identifies these values with {decodesuffix}.
• stdsuffix (str) – Adds standard data values to a full or incremental dataset, and iden-
tifies these values with {stdsuffix}.
• subjectkey (str) – Subject Key for subject for which to report
class rwslib.rws_requests.TwoHundredRequest
Return RWS MAuth information
class rwslib.rws_requests.VersionDatasetRequest(project_name, environment_name,
version_oid, dataset_type=’regular’,
start=None, rawsuffix=None, for-
moid=None, versionitem=None,
codelistsuffix=None, decodesuf-
fix=None, stdsuffix=None)
Return the text of the full datasets for a version as an ODM string. By supplying formoid, will be filtered to just
that formoid data
Parameters
• project_name (str) – Name of the Rave Study
• environment_name (str) – Name of the Rave Study Environment
• dataset_type (str) – Dataset type, one of ‘regular’ or ‘raw’
• start (str) – Start date for the Report (iso8601)
• rawsuffix (str) – Adds raw data values to a full or incremental dataset, and identifies
these values with {rawsuffix}.
• formoid (str) – FormOID for which to report
• versionitem (str) – Adds the subject’s CRF version to the dataset, and identifies it
with {version-item}
• codelistsuffix (str) – Adds code list OIDS for fields that use a code list to the
dataset, and identifies these values with {codelistsuffix}.
• decodesuffix (str) – Add decoded values of items that have an associated code list to
the dataset, and identifies these values with {decodesuffix}.
• stdsuffix (str) – Adds standard data values to a full or incremental dataset, and iden-
tifies these values with {stdsuffix}.
• version_oid (str) – version for which to report
class rwslib.rws_requests.VersionRequest
Get RWS Version number
class rwslib.rws_requests.VersionRequestBase(project_name, oid)
Base class for study and library metadata version requests
Parameters
• project_name (str) – Project Name
• oid (int) – Metadata version OID (CRF Draft Number)
result(response)
Return RWSResponse object for success :param requests.models.Response response: request respnse
rwslib.rws_requests.check_dataset_type(dataset_type)
Datasets may only be regular or raw :type dataset_type: str
rwslib.rws_requests.format_date_argument(date_element)
Take a date as either a datetime.date/datetime or a string and return it as a iso8601 formatted value :param
Union[datetime.date, datetime.datetime] date_element: passed argument :rtype str :return:
rwslib.rws_requests.make_url(*args, **kwargs)
Makes a URL from component parts
class rwslib.rwsobjects.MetaDataVersion
A single MetaDataVersion instance
classmethod fromElement(elem)
Read properties from a MetaDataVersion element
Parameters elem (lxml.etree._Element) – Source etree Element
class rwslib.rwsobjects.ODMDoc(xml)
A base ODM document
Abstract Doc Class :param bytes xml: Input content
class rwslib.rwsobjects.RWSError(xml)
Extends ODMDoc, inheriting attributes like filetype, creationdatetime etc.
Parses XML of the form:
class rwslib.rwsobjects.RWSErrorResponse(xml)
Parses messages of the form:
<Response
ReferenceNumber="0b47fe86-542f-4070-9e7d-16396a5ef08a"
InboundODMFileOID="Not Supplied"
IsTransactionSuccessful="0"
ReasonCode="RWS00092"
ErrorClientResponseMessage="CRF version not found">
</Response>
class rwslib.rwsobjects.RWSPostErrorResponse(xml)
Responses to Clinical data post messages have additional Attributes to normal RWS Response messages:
<Response
ReferenceNumber="5b1fa9a3-0cf3-46b6-8304-37c2e3b7d04f"
InboundODMFileOID="1"
IsTransactionSuccessful = "0"
ReasonCode="RWS00024"
ErrorOriginLocation="/ODM/ClinicalData[1]/SubjectData[1]"
SuccessStatistics="Rave objects touched: Subjects=0; Folders=0; Forms=0;
˓→Fields=0; LogLines=0"
class rwslib.rwsobjects.RWSPostResponse(xml)
Parses responses from PostODMClinicalData messages with the format:
<Response ReferenceNumber="82e942b0-48e8-4cf4-b299-51e2b6a89a1b"
InboundODMFileOID=""
IsTransactionSuccessful="1"
SuccessStatistics="Rave objects touched: Subjects=0; Folders=0; Forms=0;
˓→ Fields=0; LogLines=0" NewRecords=""
SubjectNumberInStudy="1103" SubjectNumberInStudySite="55">
</Response>
class rwslib.rwsobjects.RWSResponse(xml)
Parses messages of the form:
<Response ReferenceNumber="82e942b0-48e8-4cf4-b299-51e2b6a89a1b"
InboundODMFileOID=""
IsTransactionSuccessful="1"
SuccessStatistics="Rave objects touched: Subjects=0; Folders=0; Forms=0;
˓→Fields=0; LogLines=0" NewRecords="">
</Response>
class rwslib.rwsobjects.RWSStudies(xml)
Represents a list of studies. Extends the list class and adds a couple of extra properties:
<ODM FileType="Snapshot" FileOID="767a1f8b-7b72-4d12-adbe-37d4d62ba75e"
CreationDateTime="2013-04-08T10:02:17.781-00:00"
ODMVersion="1.3"
xmlns:mdsol="http://www.mdsol.com/ns/odm/metadata"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.cdisc.org/ns/odm/v1.3">
<Study OID="Fixitol(Dev)">
<GlobalVariables>
<StudyName>Fixitol (Dev)</StudyName>
<StudyDescription/>
<ProtocolName>Fixitol</ProtocolName>
</GlobalVariables>
</Study>
<Study OID="IANTEST(Prod)">
<GlobalVariables>
<StudyName>IANTEST</StudyName>
<StudyDescription/>
(continues on next page)
isProd()
Is production if environment is empty
Return type bool
class rwslib.rwsobjects.RWSStudyMetadataVersions(xml)
Parses responses from MetaDataVersions request:
<ODM ODMVersion="1.3" Granularity="Metadata" FileType="Snapshot" FileOID=
˓→"d26b4d33-376d-4037-9747-684411190179" CreationDateTime=" 2013-04-08T01:29:13 "
˓→xmlns="http://www.cdisc.org/ns/odm/v1.3" xmlns:mdsol="http://www.mdsol.com/ns/
˓→odm/metadata">
<Study OID="IANTEST">
<GlobalVariables>
<StudyName>IANTEST</StudyName>
<StudyDescription></StudyDescription>
<ProtocolName>IANTEST</ProtocolName>
</GlobalVariables>
<MetaDataVersion OID="1203" Name="Webservice Outbound" />
<MetaDataVersion OID="1195" Name="JC_Demo_Draft1" />
<MetaDataVersion OID="1165" Name="Initial" />
</Study>
</ODM>
class rwslib.rwsobjects.RWSSubjectListItem
Parses response of Subject List request:
The SubjectKey can be either a Subject ID or a UUID depending on the value of SubjectKeyType:
<SiteRef LocationOID="335566"/>
</SubjectData>
</ClinicalData>
</SubjectData>
</ClinicalData>
The ODM message has a ClinicalData element with a single SubjectData and SiteRef elements nested within. I
collapse into a single object
classmethod fromElement(elem)
Note:
• If the SubjectKeyType is SubjectUUID then the subject name lives in the mdsol:SubjectName attribute
• If the SubjectKeyType is SubjectName then the subject name lives in the SubjectKey attribute
class rwslib.rwsobjects.RWSSubjects(xml)
Represents a list of subjects:
<ODM FileType="Snapshot"
FileOID="770f1758-db33-4ab2-af72-38db863734aa"
CreationDateTime="2013-04-08T14:08:06.875-00:00"
ODMVersion="1.3">
</SubjectData>
</ClinicalData>
</SubjectData>
</ClinicalData>
</ODM>
class rwslib.rwsobjects.XMLRepr(xml)
Classes that represent objects passed back from RWS as XML
Parameters xml (str) – XML returned from RWS
rwslib.rwsobjects.getEnvironmentFromNameAndProtocol(studyname, protocolname)
Extract environment name using studyname and protocolname to guide :param str studyname: Name of the
study (including Env) :param str protocolname: Name of the study
rwslib.rwsobjects.parseXMLString(xml)
Parse XML string, return root :param str: Passed in XML
class rwslib.rws_requests.biostats_gateway.CVMetaDataRequest(project_name,
environment_name,
versionitem=None,
rawsuffix=None,
codelistsuf-
fix=None, de-
codesuffix=None)
Return Clinical View Metadata as ODM string
Parameters
• project_name (str) – Project Name
• environment_name (str) – Environment Name
• versionitem (str) – Adds the subject’s CRF version to the dataset, and identifies it
with versionitem
• rawsuffix (str) – Adds raw data values to a full or incremental dataset, and identifies
these values with rawsuffix.
• codelistsuffix (str) – Adds code list OIDS for fields that use a code list to the
dataset, and identifies these values with codelistsuffix
• decodesuffix (str) – Add decoded values of items that have an associated code list to
the dataset, and identifies these values with decodesuffix.
studyname_environment()
Combine the Study Name and Environment
Return type str
class rwslib.rws_requests.biostats_gateway.CommentDataRequest(project_name, en-
vironment_name,
dataset_format=’csv’)
Return Comments from Rave as CSV or XML
Parameters
• project_name (str) – Project Name
• dataset_format (str) – Specify format of the Datasets (either csv or xml)
• environment_name (str) – Environment Name
class rwslib.rws_requests.biostats_gateway.DataDictionariesRequest(project_name,
environ-
ment_name,
dataset_format=’csv’)
Retrieve Data Dictionaries from Rave
Parameters
• project_name (str) – Project Name
• dataset_format (str) – Specify format of the Datasets (either csv or xml)
• environment_name (str) – Environment Name
class rwslib.rws_requests.biostats_gateway.FormDataRequest(project_name, en-
vironment_name,
dataset_type,
form_oid, start=None,
dataset_format=’csv’)
Return CV Form Data as CSV or XML
Parameters
• project_name (str) – Project Name
• environment_name (str) – Environment Name
• dataset_type (str) – Type of dataset (either regular or raw)
• form_oid (str) – OID for the Form of interest
• start (str) – Start Date for the dataset pull (should be an iso8601 formatted date)
• dataset_format (str) – Specify format of the Datasets (either csv or xml)
class rwslib.rws_requests.biostats_gateway.MetaDataRequest(dataset_format=’csv’)
Return Metadata for Clinical Views in CSV or XML fornat
Parameters dataset_format (str) – Specify format of the Datasets (either csv or xml)
class rwslib.rws_requests.biostats_gateway.ProjectMetaDataRequest(project_name,
dataset_format=’csv’)
Return Metadata for Clinical Views in CSV or XML format for a Project
Parameters
• project_name (str) – Project Name
• dataset_format (str) – Specify format of the Datasets (either csv or xml)
class rwslib.rws_requests.biostats_gateway.ProtocolDeviationsRequest(project_name,
envi-
ron-
ment_name,
dataset_format=’csv’)
Retrieve Protocol Deviation Information from Rave
Parameters
• project_name (str) – Project Name
• dataset_format (str) – Specify format of the Datasets (either csv or xml)
• environment_name (str) – Environment Name
class rwslib.rws_requests.biostats_gateway.ViewMetaDataRequest(view_name,
dataset_format=’csv’)
Return Metadata for Clinical Views in CSV fornat for a single View
Parameters
• view_name (str) – Clinical View of interest
• dataset_format (str) – Specify format of the Datasets (either csv or xml)
rwslib.rws_requests.biostats_gateway.check_dataset_format(ds_format)
Ensure dataset format is XML or CSV
Parameters ds_format (str) – Format of the Dataset (expected to be one of csv or xml)
rwslib.rws_requests.biostats_gateway.dataset_format_to_extension(ds_format)
Get the preferred Dataset format extension
Parameters ds_format (str) – Format of the Dataset (expected to be one of csv or xml)
Return type str
Note: Any Class with the Prefix Mdsol represents a Medidata Rave specific extension
Parameters
• context (str) – Context attribute specifies the application domain
• name (str) – Name
class rwslib.builders.metadata.BasicDefinitions
Container for MeasurementUnit
measurement_units = None
Collection of MeasurementUnit
class rwslib.builders.metadata.CheckValue(value)
A value in a RangeCheck
Parameters value (str) – Value for a RangeCheck
class rwslib.builders.metadata.CodeList(oid, name, datatype, sas_format_name=None)
Defines a discrete set of permitted values for an item.
Note:
• Equates to a Rave Dictionary
• Does not support ExternalCodeList
79
rwslib Documentation, Release 1.2.9
Parameters
• oid (str) – CodeList OID
• name (str) – Name of CodeList
• datatype (DataType) – DataType restricts the values that can appear in the CodeList
whether internal or external (integer | float | text | string )
• sas_format_name (str) – SASFormatName must be a legal SAS format for CodeList
aliases = None
Collection of Alias
codelist_items = None
Collection of CodeListItem
class rwslib.builders.metadata.CodeListItem(coded_value, order_number=None, spec-
ify=False)
Defines an individual member value of a CodeList including display format. The actual value is given, along
with a set of print/display-forms.
Parameters
• coded_value (str) – Coded Value for CodeListItem
• order_number (int) – OrderNumber for the CodeListItem - Note: this is a Medidata
Rave Extension, but upstream ODM has been updated to include the OrderNumber attribute
• specify (bool) – Does this have a Specify? option? - Rave Specific Attribute
aliases = None
Collection of Alias
class rwslib.builders.metadata.CodeListRef(oid)
A reference to a CodeList definition.
Parameters oid – OID for CodeList
class rwslib.builders.metadata.Decode
The displayed value relating to the CodedValue
translations = None
Collection of Translation for the Decode
class rwslib.builders.metadata.FormDef(oid, name, repeating=False, order_number=None,
active=True, template=False, signa-
ture_required=False, log_direction=’Portrait’,
double_data_entry=’MustNotDDE’, confirma-
tion_style=’NoLink’, link_study_event_oid=None,
link_form_oid=None)
A FormDef describes a type of form that can occur in a study.
Parameters
• oid (str) – OID for FormDef
• name (str) – Name for FormDef
• repeating (bool) – Is this a repeating Form?
• order_number (int) – OrderNumber for the FormDef
• active (bool) – Indicates that the form is available to end users when you publish and
push the draft to Rave EDC - Rave Specific Attribute
• template (bool) – Indicates that the form is a template form in Rave EDC - Rave Specific
Attribute
• signature_required (bool) – Select to ensure that the form requires investigator
signature for all submitted data points - Rave Specific Attribute
• log_direction (str) – Set the display mode of a form, (Landscape or Portrait) - Rave
Specific Attribute
• double_data_entry (str) – Indicates if the form is used to collect data in Rave Dou-
ble Data Entry (DDE), (Always, Never or As Per Site) - Rave Specific Attribute
• confirmation_style – Style of Confirmation, (None, NotLink, LinkNext or LinkCus-
tom) - Rave Specific Attribute
• link_study_event_oid – OID for StudyEvent target for Link - Rave Specific At-
tribute
• link_form_oid – OID for FormRef target for Link - Rave Specific Attribute
aliases = None
Collection of Alias for Form
entry_restrictions = None
Collection of EntryRestriction for Form - Rave Specific Attribute
helptexts = None
Collection of HelpText for Form (Cardinality not clear) - Rave Specific Attribute
itemgroup_refs = None
Collection of ItemGroupRef for Form
view_restrictions = None
Collection of ViewRestriction for Form - Rave Specific Attribute
class rwslib.builders.metadata.FormRef(oid, order_number, mandatory)
A reference to a FormDef as it occurs within a specific StudyEventDef . The list of FormRef identifies
the types of forms that are allowed to occur within this type of study event. The FormRef within a single
StudyEventDef must not have duplicate FormOIDs nor OrderNumbers.
Parameters
• oid (str) – Set the FormDef OID for the FormRef
• order_number (int) – Define the OrderNumber for the FormRef within the containing
StudyEventDef
• mandatory (bool) – Is this Form Mandatory?
class rwslib.builders.metadata.GlobalVariables(protocol_name, name=None, descrip-
tion=”)
GlobalVariables includes general summary information about the Study.
Note: Name and description are not important. protocol_name maps to the Rave project name
Parameters
• protocol_name (str) – Protocol Name
• name (str) – Study Name
• query_future_date (bool) – Generates a query when the Rave EDC user enters a
future date in the field. - Rave Specific Attribute
• visible (bool) – Indicates that the field displays on the form when the version is pushed
to Rave EDC. - Rave Specific Attribute
• translation_required (bool) – Enables translation functionality for the selected
field. - Rave Specific Attribute
• query_non_conformance (bool) – Generates a query when the Rave EDC user enters
data in a format other than what has been defined for the variable. - Rave Specific Attribute
• other_visits (bool) – Display previous visit data - Rave Specific Attribute
• can_set_item_group_date (bool) – If a form contains log fields, this parameter
assigns the date entered into the field as the date for the record (log line) - Rave Specific
Attribute
• can_set_form_date (bool) – Observation Date of Form assigns the date entered into
the field as the date for the form - Rave Specific Attribute
• can_set_study_event_date (bool) – Observation Date of Folder assigns the date
entered into the field as the date for the folder - Rave Specific Attribute
• can_set_subject_date (bool) – Observation Date of Subject assigns the date en-
tered into the field as the date for the Subject. - Rave Specific Attribute
• visual_verify (bool) – This parameter sets the field as a Visual Verify field in Rave
DDE - Rave Specific Attribute
• does_not_break_signature (bool) – Indicates that the field (both derived and non-
derived) does not participate in signature. - Rave Specific Attribute
• date_time_format (str) – Displays text boxes for the user to enter the day, month,
and year according to the specified variable format. - Rave Specific Attribute
• field_number (str) – Number that displays to the right of a field label in Rave EDC to
create a numbered list on the form. - Rave Specific Attribute
• variable_oid – OID for Variable - Rave Specific Attribute
aliases = None
Collection of Alias
codelistref = None
Matching CodeListRef
entry_restrictions = None
Collection of MdsolEntryRestriction
header_text = None
Matching MdsolHeaderText
help_texts = None
Collection of MdsolHelpText
measurement_unit_refs = None
Collection of MeasurementUnitRef
question = None
Matching Question
range_checks = None
Collection of RangeCheck
review_groups = None
Collection of MdsolReviewGroup
view_restrictions = None
Collection of MdsolViewRestriction
class rwslib.builders.metadata.ItemGroupDef(oid, name, repeating=False,
is_reference_data=False,
sas_dataset_name=None, domain=None,
origin=None, role=None, purpose=None,
comment=None)
An ItemGroupDef describes a type of item group that can occur within a Study.
Parameters
• oid (str) – OID for ItemGroupDef
• name (str) – Name for ItemGroupDef
• repeating (bool) – Is this a repeating ItemDef?
• is_reference_data (bool) – If IsReferenceData is Yes, this type of item group can
occur only within a ReferenceData element. If IsReferenceData is No, this type of item
group can occur only within a ClinicalData element. The default for this attribute is
No.
• sas_dataset_name (str) – SAS Dataset Name
• domain (str) – Domain for Items within this ItemGroup
• origin – Origin of data (eg CRF, eDT, Derived)
• role – Role for the ItemGroup (eg Identifier, Topic, Timing, Qualifiers)
• purpose – Purpose (eg Tabulation)
• comment – Comment on the ItemGroup Contents
aliases = None
Collection of Alias
item_refs = None
Collection of ItemRef
label_refs = None
Collection of MdsolLabelRef
class rwslib.builders.metadata.ItemGroupRef(oid, order_number=None, manda-
tory=True)
A reference to an ItemGroupDef as it occurs within a specific FormDef. The list of ItemGroupRefs identifies
the types of item groups that are allowed to occur within this type of form. The ItemGroupRefs within a single
FormDef must not have duplicate ItemGroupOIDs nor OrderNumbers.
Parameters
• oid (str) – OID for the referenced ItemGroupDef
• order_number (int) – OrderNumber for the ItemGroupRef
• mandatory (bool) – Is this ItemGroupRef required?
class rwslib.builders.metadata.ItemRef(oid, order_number=None, manda-
tory=False, key_sequence=None, impu-
tation_method_oid=None, role=None,
role_codelist_oid=None)
A reference to an ItemDef as it occurs within a specific ItemGroupDef. The list of ItemRefs identifies the
types of items that are allowed to occur within this type of item group.
Parameters
• oid (str) – OID for ItemDef
• order_number (int) – OrderNumber for the ItemRef
• mandatory (bool) – Is this ItemRef required?
• key_sequence (int) – The KeySequence (if present) indicates that this item is a key for
the enclosing item group. It also provides an ordering for the keys.
• imputation_method_oid (str) – DEPRECATED
• role (str) – Role name describing the use of this data item.
• role_codelist_oid (str) – RoleCodeListOID may be used to reference a
CodeList that defines the full set roles from which the Role attribute value is to be
taken.
attributes = None
Collection of MdsolAttribute
class rwslib.builders.metadata.MdsolAttribute(namespace, name, value, transac-
tion_type=’Insert’)
Rave Web Services element for holding Vendor Attributes
name = None
Name for the Attribute
namespace = None
Namespace for the Attribute
transaction_type = None
TransactionType for the Attribute
value = None
Value for the Attribute
class rwslib.builders.metadata.MdsolCheckAction(variable_oid=None, field_oid=None,
form_oid=None, folder_oid=None,
record_position=None,
form_repeat_number=None,
folder_repeat_number=None,
check_action_type=None,
check_string=None,
check_options=None,
check_script=None)
Check Action modeled after check action in Architect Loader spreadsheet.
Note:
• Do not use directly, use appropriate sub-class.
• This is a Medidata Rave Specific Element
Parameters
• variable_oid (str) – OID for the Variable that is the target of the CheckAction
• field_oid (str) – OID for the Field that is the target of the CheckAction
• form_oid (str) – OID for the Form that is the target of the CheckAction
• folder_oid (str) – OID for the Folder that is the target of the CheckAction
• record_position (int) – Record Position for the CheckAction
• form_repeat_number (int) – Form Repeat Number for the CheckAction
• folder_repeat_number (int) – Folder Repeat Number for the CheckAction
• check_string (str) – CheckAction String
• check_options (str) – CheckAction Options
• check_script (str) – CheckAction Script
check_action_type
return the CheckAction Type
class rwslib.builders.metadata.MdsolCheckStep(variable_oid=None, data_format=None,
form_oid=None, folder_oid=None,
field_oid=None, static_value=None,
function=None, custom_function=None,
record_position=None,
form_repeat_number=None,
folder_repeat_number=None, logi-
cal_record_position=None)
A check step modeled after the Architect Loader definition.
Parameters
• variable_oid (str) – OID for Variable targeted by CheckStep
• data_format (str) – Format for Value
• form_oid (str) – OID for Form
• folder_oid (str) – OID for Folder
• field_oid (str) – OID for Field
• custom_function (str) – Name of Custom Function for CheckStep
• record_position (int) – Record Position - If the field is a standard (non-log) field,
enter 0
• form_repeat_number (int) – Repeat Number for Form for CheckStep
• folder_repeat_number (int) – Repeat Number for Folder for CheckStep
• logical_record_position (LogicalRecordPositionType) – LRP value for
the CheckStep
• static_value (str) – Static Value for CheckStep
logical_record_position
Get the Logical Record Position :return: the Logical Record Position
class rwslib.builders.metadata.MdsolConfirmationMessage(message, lang=None)
Form is saved confirmation message
Parameters
• message (str) – Content of confirmation message
• lang (str) – Language declaration for Message
Note:
• This is a Medidata Rave Specific Extension
• VB has been deprecated in later Rave versions.
Parameters
• oid (str) – OID for CustomFunction
• code (str) – Content for the CustomFunction
• language (str) – Language for the CustomFunction
Parameters
• oid (str) – OID for Derivation
• active (bool) – Is this Derivation Active?
• bypass_during_migration (bool) – Bypass this Derivation on Study Migration?
derivation_steps = None
Set of MdsolDerivationStep for this derivation
logical_record_position
Get the Logical Record Position :return: the Logical Record Position
class rwslib.builders.metadata.MdsolDerivationStep(variable_oid=None,
data_format=None,
form_oid=None,
folder_oid=None,
field_oid=None, value=None,
function=None, cus-
tom_function=None,
record_position=None,
form_repeat_number=None,
folder_repeat_number=None,
logical_record_position=None)
A derivation step modeled after the Architect Loader definition.
Parameters
• variable_oid (str) – OID for Variable targeted by Derivation
• data_format (str) – Format for Value
• form_oid (str) – OID for Form
• folder_oid (str) – OID for Folder
• field_oid (str) – OID for Field
function
Return the Derivation Function :return:
logical_record_position
Get the Logical Record Position :return: the Logical Record Position
class rwslib.builders.metadata.MdsolEditCheckDef(oid, active=True, by-
pass_during_migration=False,
needs_retesting=False)
Extension for Rave edit checks
Parameters
• oid (str) – EditCheck OID
• active (bool) – Is this EditCheck active?
• bypass_during_migration (bool) – Bypass this EditCheck during a Study Migra-
tion
• needs_retesting (bool) – Does this EditCheck need Retesting?
check_actions = None
Set of MdsolCheckAction for this EditCheck
check_steps = None
Set of MdsolCheckStep for this EditCheck
class rwslib.builders.metadata.MdsolEntryRestriction(rolename)
EntryRestriction for FormDef and ItemDef
rolename = None
Name for the role for which the EntryRestriction applies
class rwslib.builders.metadata.MdsolHeaderText(content, lang=None)
Header text for ItemDef when shown in grid
Parameters
• content (str) – Content for the Header Text
• lang (str) – Language specification for Header
content = None
HelpText content
lang = None
Language specification for HelpText
class rwslib.builders.metadata.MdsolLabelDef(oid, name, field_number=None)
Label definition
Parameters
• oid – OID for the MdsolLabelDef
• name – Name for the MdsolLabelDef
• field_number (int) – FieldNumber for the MdsolLabelDef
help_texts = None
Collection of HelpText
translations = None
Collection of Translation
view_restrictions = None
Collection of ViewRestriction
class rwslib.builders.metadata.MdsolLabelRef(oid, order_number)
A reference to a label on a form
oid = None
OID for the corresponding MdsoLabel
order_number = None
OrderNumber for the Label
class rwslib.builders.metadata.MdsolReviewGroup(name)
Maps to Rave review groups for an ItemDef
class rwslib.builders.metadata.MdsolViewRestriction(rolename)
ViewRestriction for FormDef and ItemDef
rolename = None
Name for the role for which the ViewRestriction applies
class rwslib.builders.metadata.MeasurementUnit(oid, name, unit_dictionary_name=None,
constant_a=1, constant_b=1, con-
stant_c=0, constant_k=0, stan-
dard_unit=False)
The physical unit of measure for a data item or value. The meaning of a MeasurementUnit is determined by its
Name attribute.
Parameters
• oid (str) – MeasurementUnit OID
• name (str) – Maps to Coded Unit within unit dictionary entries in Rave.
• unit_dictionary_name (str) – Maps to unit dictionary Name in Rave. - Rave spe-
cific attribute
• constant_a (int) – Maps to the unit dictionary Constant A in Rave. - Rave specific
attribute
• constant_b (int) – Maps to the unit dictionary Constant B in Rave. - Rave specific
attribute
• constant_c (int) – Maps to the unit dictionary Constant C in Rave. - Rave specific
attribute
• constant_k (int) – Maps to the unit dictionary Constant K in Rave. - Rave specific
attribute
• standard_unit (bool) – Yes = Standard checked within the unit dictionary entry in
Rave. No = Standard unchecked within the unit dictionary entry in Rave. - Rave specific
attribute
symbols = None
Collection of Symbol for this MeasurementUnit
class rwslib.builders.metadata.MeasurementUnitRef(oid)
A reference to a measurement unit definition (MeasurementUnit).
Parameters oid (str) – MeasurementUnit OID
class rwslib.builders.metadata.MetaDataVersion(oid, name, description=None,
primary_formoid=None, de-
fault_matrix_oid=None,
delete_existing=False, signa-
ture_prompt=None)
A metadata version (MDV) defines the types of study events, forms, item groups, and items that form the study
data.
Parameters
• oid (str) – MDV OID
Note: In Rave the OrderNumber attribute is not reported for the SUBJECT Form, for this reason the or-
der_number attribute is not mandatory and will default to None
Parameters
• oid (str) – StudyEventDef OID
• order_number (Union(int, None)) – OrderNumber for the StudyEventRef
within the Study
• mandatory (bool) – Is this StudyEventDef Mandatory? (True|False)
class rwslib.builders.metadata.Symbol
A human-readable name for a MeasurementUnit.
translations = None
Collection of TranslatedText
class rwslib.builders.metadata.TranslatedText(text, lang=None)
Represents a language and a translated text for that language
Parameters
• text (str) – Content expressed in language designated by lang
Note: Any Class with the Prefix Mdsol represents a Medidata Rave specific extension
Parameters
• id (str or None) – ID for this Annotation (required if contained within an Annotations
element)
• seqnum (int) – SeqNum for Annotation
• flags (Flag or list(Flag)) – one or more Flag for the Annotation
• comment (Comment) – one or more Comment for the Annotation
• transaction_type – TransactionType for Annotation (one of Insert, Update,
Remove, Upsert, Context)
annotation_id
ID for annotation
seqnum
SeqNum attribute (a small positive integer) uniquely identifies the annotation within its parent entity.
class rwslib.builders.clinicaldata.Annotations(annotations=[])
Groups Annotation elements referenced by ItemData[TYPE] elements.
class rwslib.builders.clinicaldata.AuditRecord(edit_point=None,
used_imputation_method=None, identi-
fier=None, include_file_oid=None)
An AuditRecord carries information pertaining to the creation, deletion, or modification of clinical data. This
information includes who performed that action, and where, when, and why that action was performed.
Parameters
• identifier (str) – Audit identifier
• edit_point (str) – EditPoint attribute identifies the phase of data processing in which
action occurred (Monitoring, DataManagement, DBAudit)
• used_imputation_method (bool) – Indicates whether the action involved the use of
a Method
• include_file_oid (bool) – Include the FileOID in the AuditRecord
audit_id
AuditRecord ID
Note: If an AuditRecord is contained within an AuditRecords element, the ID attribute must be provided.
date_time_stamp = None
DateTimeStamp for the AuditRecord
edit_point
EditPoint attribute identifies the phase of data processing in which action occurred (Monitoring,
DataManagement, DBAudit)
location_ref = None
LocationRef for the AuditRecord
reason_for_change = None
ReasonForChange for the AuditRecord
source_id = None
SourceID for the AuditRecord
user_ref = None
UserRef for the AuditRecord
class rwslib.builders.clinicaldata.ClinicalData(projectname, environment, meta-
data_version_oid=’1’, annota-
tions=None)
Models the ODM ClinicalData object
Parameters
• projectname – Name of Project in Medidata Rave
• environment – Rave Study Enviroment
• metadata_version_oid – MetadataVersion OID
subject_data = None
collection of SubjectData for the ClinicalData Element
class rwslib.builders.clinicaldata.Comment(text=None, sponsor_or_site=None)
A free-text (uninterpreted) comment about clinical data. The comment may have come from the Sponsor or the
clinical Site.
Parameters
• text (str) – Text for Comment
• sponsor_or_site (str) – Originator flag for Comment (either _Sponsor_ or _Site_)
sponsor_or_site
Originator of comment (either Sponsor or Site)
text
Text content of Comment
class rwslib.builders.clinicaldata.DateTimeStamp(date_time)
The date/time that the data entry, modification, or signature was performed. This applies to the initial occurrence
of the action, not to subsequent transfers between computer systems.
date_time = None
specified DateTime for event
class rwslib.builders.clinicaldata.Flag(flag_type=None, flag_value=None)
A machine-processable annotation on clinical data.
Parameters
• flag_type (FlagType) – Type for Flag
• flag_value (FlagValue) – Value for Flag
codelist_oid
Reference to the CodeList for the FlagType
class rwslib.builders.clinicaldata.FlagValue(flag_value, codelist_oid=None)
The value of the flag. The meaning of this value is typically dependent on the associated FlagType. The actual
value must be a member of the referenced CodeList.
codelist_oid
Reference to the CodeList for the FlagType
class rwslib.builders.clinicaldata.FormData(formoid, transaction_type=None,
form_repeat_key=None)
Models the ODM FormData object
Parameters
• formoid (str) – FormDef OID
• transaction_type (str) – Transaction Type for Data (one of Insert, Update, Upsert,
Context, Remove)
• form_repeat_key (str) – Repeat Key for FormData
annotations = None
Collection of Annotation for FormData - Not supported by Rave
signature = None
Signature for FormData
class rwslib.builders.clinicaldata.ItemData(itemoid, value, specify_value=None, transac-
tion_type=None, lock=None, freeze=None,
verify=None)
Models the ODM ItemData object
Parameters
• itemoid (str) – OID for the matching ItemDef
• value (str) – Value for the the ItemData
• specify_value (str) – ‘If other, specify’ value - Rave specific attribute
• transaction_type (str) – Transaction Type for Data (one of Insert, Update, Upsert,
Context, Remove)
• lock (bool) – Lock the DataPoint? - Rave specific attribute
• freeze (bool) – Freeze the DataPoint? - Rave specific attribute
• verify (bool) – Verify the DataPoint? - Rave specific attribute
annotations = None
the list of Annotation on the DataPoint - Not supported by Rave
audit_record = None
the corresponding AuditRecord for the DataPoint
deviations = None
the list of MdsolProtocolDeviation references on the DataPoint - Rave Specific Attribute
measurement_unit_ref = None
the corresponding MeasurementUnitRef for the DataPoint
queries = None
the list of MdsolQuery on the DataPoint - Rave Specific Attribute
class rwslib.builders.clinicaldata.ItemGroupData(itemgroupoid=None,
transaction_type=None,
item_group_repeat_key=None,
whole_item_group=False, annota-
tions=None)
Models the ODM ItemGroupData object.
Note: No name for the ItemGroupData element is required. This is built automatically by the form.
Parameters
• transaction_type (str) – Transaction Type for Data (one of Insert, Update, Upsert,
Context, Remove)
• item_group_repeat_key (int) – RepeatKey for the ItemGroupData
signature = None
Signature for ItemGroupData
class rwslib.builders.clinicaldata.LocationRef(oid)
Reference to a Location
Parameters oid (str) – OID for referenced Location
class rwslib.builders.clinicaldata.MdsolProtocolDeviation(value, status,
repeat_key=1,
code=None,
klass=None, trans-
action_type=None)
Extension for Protocol Deviations in Rave
Note:
• This is a Medidata Rave Specific Extension
• This primarily exists as a mechanism for use by the Clinical Audit Record Service, but it is useful to define
for the builders
Parameters
• value (str) – Value for the Protocol Deviation
• status (rwslib.builder_constants.ProtocolDeviationStatus) –
• repeat_key (int) – RepeatKey for the Protocol Deviation
• code (basestring) – Protocol Deviation Code
• klass (basestring) – Protocol Deviation Class
• transaction_type – Transaction Type for the Protocol Deviation
Parameters
• value (str) – Query Value
• query_repeat_key (int) – Repeat key for Query
• recipient (str) – Recipient for Query (Marking Group)
• status (QueryStatusType) – Query status
status
Query Status
class rwslib.builders.clinicaldata.ReasonForChange(reason)
A user-supplied reason for a data change.
Parameters reason (str) – Supplied Reason for change
class rwslib.builders.clinicaldata.Signature(signature_id=None, user_ref=None, lo-
cation_ref=None, signature_ref=None,
date_time_stamp=None)
An electronic signature applies to a collection of clinical data. This indicates that some user accepts legal
responsibility for that data. See 21 CFR Part 11. The signature identifies the person signing, the location of
signing, the signature meaning (via the referenced SignatureDef), the date and time of signing, and (in the case
of a digital signature) an encrypted hash of the included data.
Parameters
• user_ref (UserRef) – UserRef for User signing Data
• location_ref (LocationRef) – LocationRef for Location of signing
• signature_ref (SignatureRef) – SignatureRef for SignatureDef provid-
ing signature meaning
• date_time_stamp – DateTimeStamp for the time of Signature
signature_id
The ID for the Signature
Note: If a Signature element is contained within a Signatures element, the ID attribute is required.
class rwslib.builders.clinicaldata.SignatureRef(oid)
Reference to a Signature
Parameters oid (str) – OID for referenced Signature
class rwslib.builders.clinicaldata.SiteRef(oid)
Reference to a Location The default value is SiteName, and the value SiteUUID implies that the LocationOID
.. note:: The mdsol:LocationOIDType attribute should be used to indicate the type of LocationOID
Parameters oid (str) – OID for referenced Location
class rwslib.builders.clinicaldata.SourceID(source_id)
Information that identifies the source of the data within an originating system. It is only meaningful
within the context of that system.
source_id = None
specified DateTime for event
class rwslib.builders.clinicaldata.StudyEventData(study_event_oid, trans-
action_type=’Update’,
study_event_repeat_key=None)
Models the ODM StudyEventData object
Parameters
Note: Any Class with the Prefix Mdsol represents a Medidata Rave specific extension
Parameters
• id (str or None) – ID for this Annotation (required if contained within an Annotations
element)
• seqnum (int) – SeqNum for Annotation
• flags (Flag or list(Flag)) – one or more Flag for the Annotation
• comment (Comment) – one or more Comment for the Annotation
• transaction_type – TransactionType for Annotation (one of Insert, Update,
Remove, Upsert, Context)
annotation_id
ID for annotation
seqnum
SeqNum attribute (a small positive integer) uniquely identifies the annotation within its parent entity.
class rwslib.builders.clinicaldata.Annotations(annotations=[])
Groups Annotation elements referenced by ItemData[TYPE] elements.
class rwslib.builders.clinicaldata.AuditRecord(edit_point=None,
used_imputation_method=None, identi-
fier=None, include_file_oid=None)
An AuditRecord carries information pertaining to the creation, deletion, or modification of clinical data. This
information includes who performed that action, and where, when, and why that action was performed.
Parameters
• identifier (str) – Audit identifier
• edit_point (str) – EditPoint attribute identifies the phase of data processing in which
action occurred (Monitoring, DataManagement, DBAudit)
• used_imputation_method (bool) – Indicates whether the action involved the use of
a Method
• include_file_oid (bool) – Include the FileOID in the AuditRecord
audit_id
AuditRecord ID
Note: If an AuditRecord is contained within an AuditRecords element, the ID attribute must be provided.
date_time_stamp = None
DateTimeStamp for the AuditRecord
edit_point
EditPoint attribute identifies the phase of data processing in which action occurred (Monitoring,
DataManagement, DBAudit)
location_ref = None
LocationRef for the AuditRecord
reason_for_change = None
ReasonForChange for the AuditRecord
source_id = None
SourceID for the AuditRecord
user_ref = None
UserRef for the AuditRecord
class rwslib.builders.clinicaldata.ClinicalData(projectname, environment, meta-
data_version_oid=’1’, annota-
tions=None)
Models the ODM ClinicalData object
Parameters
• projectname – Name of Project in Medidata Rave
• environment – Rave Study Enviroment
• metadata_version_oid – MetadataVersion OID
subject_data = None
collection of SubjectData for the ClinicalData Element
class rwslib.builders.clinicaldata.Comment(text=None, sponsor_or_site=None)
A free-text (uninterpreted) comment about clinical data. The comment may have come from the Sponsor or the
clinical Site.
Parameters
• text (str) – Text for Comment
• sponsor_or_site (str) – Originator flag for Comment (either _Sponsor_ or _Site_)
sponsor_or_site
Originator of comment (either Sponsor or Site)
text
Text content of Comment
class rwslib.builders.clinicaldata.DateTimeStamp(date_time)
The date/time that the data entry, modification, or signature was performed. This applies to the initial occurrence
of the action, not to subsequent transfers between computer systems.
date_time = None
specified DateTime for event
class rwslib.builders.clinicaldata.Flag(flag_type=None, flag_value=None)
A machine-processable annotation on clinical data.
Parameters
• flag_type (FlagType) – Type for Flag
• flag_value (FlagValue) – Value for Flag
codelist_oid
Reference to the CodeList for the FlagType
class rwslib.builders.clinicaldata.FlagValue(flag_value, codelist_oid=None)
The value of the flag. The meaning of this value is typically dependent on the associated FlagType. The actual
value must be a member of the referenced CodeList.
codelist_oid
Reference to the CodeList for the FlagType
class rwslib.builders.clinicaldata.FormData(formoid, transaction_type=None,
form_repeat_key=None)
Models the ODM FormData object
Parameters
• formoid (str) – FormDef OID
• transaction_type (str) – Transaction Type for Data (one of Insert, Update, Upsert,
Context, Remove)
• form_repeat_key (str) – Repeat Key for FormData
annotations = None
Collection of Annotation for FormData - Not supported by Rave
signature = None
Signature for FormData
Note: No name for the ItemGroupData element is required. This is built automatically by the form.
Parameters
• transaction_type (str) – Transaction Type for Data (one of Insert, Update, Upsert,
Context, Remove)
• item_group_repeat_key (int) – RepeatKey for the ItemGroupData
• whole_item_group (bool) – Is this the entire ItemGroupData, or just parts? - Rave
specific attribute
• annotations (list(Annotation) or Annotation) – Annotation for the Item-
Group - Not supported by Rave
signature = None
Signature for ItemGroupData
class rwslib.builders.clinicaldata.LocationRef(oid)
Reference to a Location
Parameters oid (str) – OID for referenced Location
class rwslib.builders.clinicaldata.MdsolProtocolDeviation(value, status,
repeat_key=1,
code=None,
klass=None, trans-
action_type=None)
Extension for Protocol Deviations in Rave
Note:
• This is a Medidata Rave Specific Extension
• This primarily exists as a mechanism for use by the Clinical Audit Record Service, but it is useful to define
for the builders
Parameters
• value (str) – Value for the Protocol Deviation
• status (rwslib.builder_constants.ProtocolDeviationStatus) –
• repeat_key (int) – RepeatKey for the Protocol Deviation
• code (basestring) – Protocol Deviation Code
• klass (basestring) – Protocol Deviation Class
• transaction_type – Transaction Type for the Protocol Deviation
Parameters
• value (str) – Query Value
• query_repeat_key (int) – Repeat key for Query
• recipient (str) – Recipient for Query (Marking Group)
• status (QueryStatusType) – Query status
• requires_response (bool) – Does this Query need a response?
• response (str or None) – Query response (if any)
• preceding_query_repeat_key (int) – Query Key returned by OpenQuery call
status
Query Status
class rwslib.builders.clinicaldata.ReasonForChange(reason)
A user-supplied reason for a data change.
Parameters reason (str) – Supplied Reason for change
class rwslib.builders.clinicaldata.Signature(signature_id=None, user_ref=None, lo-
cation_ref=None, signature_ref=None,
date_time_stamp=None)
An electronic signature applies to a collection of clinical data. This indicates that some user accepts legal
responsibility for that data. See 21 CFR Part 11. The signature identifies the person signing, the location of
signing, the signature meaning (via the referenced SignatureDef), the date and time of signing, and (in the case
of a digital signature) an encrypted hash of the included data.
Parameters
• user_ref (UserRef) – UserRef for User signing Data
• location_ref (LocationRef) – LocationRef for Location of signing
• signature_ref (SignatureRef) – SignatureRef for SignatureDef provid-
ing signature meaning
• date_time_stamp – DateTimeStamp for the time of Signature
signature_id
The ID for the Signature
Note: If a Signature element is contained within a Signatures element, the ID attribute is required.
class rwslib.builders.clinicaldata.SignatureRef(oid)
Reference to a Signature
Parameters oid (str) – OID for referenced Signature
class rwslib.builders.clinicaldata.SiteRef(oid)
Reference to a Location The default value is SiteName, and the value SiteUUID implies that the LocationOID
.. note:: The mdsol:LocationOIDType attribute should be used to indicate the type of LocationOID
Parameters oid (str) – OID for referenced Location
class rwslib.builders.clinicaldata.SourceID(source_id)
Information that identifies the source of the data within an originating system. It is only meaningful
within the context of that system.
source_id = None
specified DateTime for event
class rwslib.builders.clinicaldata.StudyEventData(study_event_oid, trans-
action_type=’Update’,
study_event_repeat_key=None)
Models the ODM StudyEventData object
Parameters
• study_event_oid (str) – StudyEvent OID
• transaction_type (str) – Transaction Type for Data (one of Insert, Update, Upsert,
Context, Remove)
• study_event_repeat_key (int) – StudyEventRepeatKey for StudyEventData
annotations = None
Annotation for Study Event Data - Not Supported by Rave
forms = None
FormData part of Study Event Data
signature = None
Signature for Study Event Data
class rwslib.builders.clinicaldata.SubjectData(site_location_oid, subject_key, sub-
ject_key_type=’SubjectName’, transac-
tion_type=’Update’)
Models the ODM SubjectData and ODM SiteRef objects
Parameters
• site_location_oid (str) – SiteLocation OID
• subject_key (str) – Value for SubjectKey
• subject_key_type (str) – Specifier as to the type of SubjectKey (either Subject-
Name or SubjectUUID)
• transaction_type (str) – Transaction Type for Data (one of Insert, Update, Upsert,
Context, Remove)
annotations = None
collection of Annotation
audit_record = None
AuditRecord for SubjectData - Not Supported By Rave
signature = None
Signature for SubjectData
siteref = None
SiteRef
study_events = None
collection of StudyEventData
class rwslib.builders.clinicaldata.UserRef(oid)
Reference to a User
Parameters oid (str) – OID for referenced User
Note: Any Class with the Prefix Mdsol represents a Medidata Rave specific extension
Parameters
• study_oid (str) – References the Study that uses this metadata version.
• metadata_version_oid (str) – References the rwslib.builders.
MetaDataVersion (within the above Study).
class rwslib.builders.admindata.Organization(text)
The user’s organization.
class rwslib.builders.admindata.OtherText(text)
Any other text needed as part of a user’s postal address.
class rwslib.builders.admindata.Phone(text)
The user’s voice phone number.
class rwslib.builders.admindata.PostalCode(text)
The postal code part of a user’s postal address.
class rwslib.builders.admindata.SimpleChildElement(text)
Generic Element, for elements we’re not ready to flesh out in the builders
class rwslib.builders.admindata.StateProv(text)
The state or province name part of a user’s postal address.
class rwslib.builders.admindata.StreetName(text)
The street address part of a user’s postal address.
class rwslib.builders.admindata.User(oid, user_type=None, login_name=None, dis-
play_name=None, full_name=None, first_name=None,
last_name=None, organisation=None, addresses=[],
emails=[], phones=[], locations=[])
Information about a specific user of a clinical data collection system. This may be an investigator, a CRA, or
data management staff. Study subjects are not users in this sense.
Parameters
• oid (str) –
• user_type (rwslib.builder_constants.UserType) – User Type
• login_name (LoginName) – User Login Name - see LoginName
• display_name (DisplayName) – User Display Name - see DisplayName
• full_name (FullName) – User Full Name - see FullName
• first_name (FirstName) – User First Name - see FirstName
• last_name (LastName) – User Last Name - see LastName
• organisation (Organisation) – User Organisation - see Organisation
• addresses (list(Address)) – User Address - see Address
• emails (list(Email)) – User Email - see Email
• phones (list(Phone)) – User Phone - see Phone
• locations (list(LocationRef)) – Locations for User - see LocationRef
user_type
User Type :return:
• genindex
• modindex
• search
111
rwslib Documentation, Release 1.2.9
r
rwslib, 65
rwslib.builders.admindata, 107
rwslib.builders.clinicaldata, 100
rwslib.builders.metadata, 79
rwslib.rws_requests, 66
rwslib.rws_requests.biostats_gateway,
75
rwslib.rws_requests.odm_adapter, 78
rwslib.rwsobjects, 71
113
rwslib Documentation, Release 1.2.9
A audit_record (rwslib.builders.clinicaldata.SubjectData
Address (class in rwslib.builders.admindata), 107 attribute), 100, 107
AdminData (class in rwslib.builders.admindata), 108 AuditRecord (class in rwslib.builders.clinicaldata),
Alias (class in rwslib.builders.metadata), 79 94, 101
aliases (rwslib.builders.metadata.CodeList attribute), AuditRecordsRequest, 57
80 AuditRecordsRequest (class in
aliases (rwslib.builders.metadata.CodeListItem at- rwslib.rws_requests.odm_adapter), 78
tribute), 80 AuthorizationException, 65
aliases (rwslib.builders.metadata.FormDef attribute),
81
B
aliases (rwslib.builders.metadata.ItemDef attribute), BasicDefinitions (class in
83 rwslib.builders.metadata), 79
aliases (rwslib.builders.metadata.ItemGroupDef at- BuildVersionRequest, 9
tribute), 84 BuildVersionRequest (class in
Annotation (class in rwslib.builders.clinicaldata), 94, rwslib.rws_requests), 66
100
annotation_id (rwslib.builders.clinicaldata.AnnotationC
attribute), 94, 101 CacheFlushRequest, 11
Annotations (class in rwslib.builders.clinicaldata), CacheFlushRequest (class in rwslib.rws_requests),
94, 101 66
annotations (rwslib.builders.clinicaldata.FormData check_action_type
attribute), 97, 103 (rwslib.builders.metadata.MdsolCheckAction
annotations (rwslib.builders.clinicaldata.ItemData attribute), 86
attribute), 97, 104 check_actions (rwslib.builders.metadata.MdsolEditCheckDef
annotations (rwslib.builders.clinicaldata.StudyEventData attribute), 89
attribute), 100, 106 check_dataset_format() (in module
annotations (rwslib.builders.clinicaldata.SubjectData rwslib.rws_requests.biostats_gateway), 77
attribute), 100, 107 check_dataset_type() (in module
args() (rwslib.rws_requests.PostDataRequest method), rwslib.rws_requests), 70
67 check_steps (rwslib.builders.metadata.MdsolEditCheckDef
args() (rwslib.rws_requests.PostMetadataRequest attribute), 89
method), 67 CheckValue (class in rwslib.builders.metadata), 79
args() (rwslib.rws_requests.RWSRequest method), 68 City (class in rwslib.builders.admindata), 108
attributes (rwslib.builders.metadata.ItemRef at- ClinicalData (class in rwslib.builders.clinicaldata),
tribute), 85 95, 102
audit_id (rwslib.builders.clinicaldata.AuditRecord at- ClinicalStudiesRequest, 13
tribute), 95, 101 ClinicalStudiesRequest (class in
audit_record (rwslib.builders.clinicaldata.ItemData rwslib.rws_requests), 66
attribute), 97, 104 CodeList (class in rwslib.builders.metadata), 79
115
rwslib Documentation, Release 1.2.9
codelist_items (rwslib.builders.metadata.CodeList E
attribute), 80 edit_point (rwslib.builders.clinicaldata.AuditRecord
codelist_oid (rwslib.builders.clinicaldata.FlagType attribute), 95, 102
attribute), 96, 103 Email (class in rwslib.builders.admindata), 108
codelist_oid (rwslib.builders.clinicaldata.FlagValue entry_restrictions
attribute), 96, 103 (rwslib.builders.metadata.FormDef attribute),
CodeListItem (class in rwslib.builders.metadata), 80 81
CodeListRef (class in rwslib.builders.metadata), 80 entry_restrictions
codelistref (rwslib.builders.metadata.ItemDef at- (rwslib.builders.metadata.ItemDef attribute),
tribute), 83 83
CodeNameRequest, 10
CodeNameRequest (class in rwslib.rws_requests), 66 F
Comment (class in rwslib.builders.clinicaldata), 95, 102
FirstName (class in rwslib.builders.admindata), 108
CommentDataRequest, 53 Flag (class in rwslib.builders.clinicaldata), 96, 103
CommentDataRequest (class in
FlagType (class in rwslib.builders.clinicaldata), 96,
rwslib.rws_requests.biostats_gateway), 76 103
comparator (rwslib.builders.metadata.RangeCheck FlagValue (class in rwslib.builders.clinicaldata), 96,
attribute), 92 103
ConfigurableDatasetRequest, 11 format_date_argument() (in module
ConfigurableDatasetRequest (class in rwslib.rws_requests), 70
rwslib.rws_requests), 66 FormData (class in rwslib.builders.clinicaldata), 96,
content (rwslib.builders.metadata.MdsolHelpText at- 103
tribute), 90 FormDataRequest, 45
Country (class in rwslib.builders.admindata), 108 FormDataRequest (class in
CVMetaDataRequest, 43 rwslib.rws_requests.biostats_gateway), 76
CVMetaDataRequest (class in
FormDef (class in rwslib.builders.metadata), 80
rwslib.rws_requests.biostats_gateway), 75 FormRef (class in rwslib.builders.metadata), 81
forms (rwslib.builders.clinicaldata.StudyEventData at-
D tribute), 100, 107
DataDictionariesRequest, 55 fromElement() (rwslib.rwsobjects.MetaDataVersion
DataDictionariesRequest (class in class method), 71
rwslib.rws_requests.biostats_gateway), 76 fromElement() (rwslib.rwsobjects.RWSStudyListItem
dataset (rwslib.rws_requests.ConfigurableDatasetRequest class method), 73
attribute), 66 fromElement() (rwslib.rwsobjects.RWSSubjectListItem
dataset_format_to_extension() (in module class method), 74
rwslib.rws_requests.biostats_gateway), 77 FullName (class in rwslib.builders.admindata), 108
date_time (rwslib.builders.clinicaldata.DateTimeStamp function (rwslib.builders.metadata.MdsolDerivationStep
attribute), 96, 102 attribute), 89
date_time_stamp (rwslib.builders.clinicaldata.AuditRecord
attribute), 95, 102 G
DateTimeStamp (class in getEnvironmentFromNameAndProtocol() (in
rwslib.builders.clinicaldata), 96, 102 module rwslib.rwsobjects), 75
Decode (class in rwslib.builders.metadata), 80 GlobalLibrariesRequest, 29
derivation_steps (rwslib.builders.metadata.MdsolDerivationDef
GlobalLibrariesRequest (class in
attribute), 88 rwslib.rws_requests), 66
deviations (rwslib.builders.clinicaldata.ItemData at- GlobalLibraryDraftsRequest, 29
tribute), 97, 104 GlobalLibraryDraftsRequest (class in
DiagnosticsRequest, 10 rwslib.rws_requests), 66
DiagnosticsRequest (class in GlobalLibraryVersionRequest, 30
rwslib.rws_requests), 66 GlobalLibraryVersionRequest (class in
DisplayName (class in rwslib.builders.admindata), rwslib.rws_requests), 66
108 GlobalLibraryVersionsRequest, 30
GlobalLibraryVersionsRequest (class in
rwslib.rws_requests), 67
116 Index
rwslib Documentation, Release 1.2.9
Index 117
rwslib Documentation, Release 1.2.9
118 Index
rwslib Documentation, Release 1.2.9
Index 119
rwslib Documentation, Release 1.2.9
T ViewMetaDataRequest, 51
text (rwslib.builders.clinicaldata.Comment attribute), ViewMetaDataRequest (class in
96, 102 rwslib.rws_requests.biostats_gateway), 77
transaction_type (rwslib.builders.metadata.MdsolAttribute
attribute), 85 X
TranslatedText (class in rwslib.builders.metadata), X-MWS-CV-Last-Updated, 21
93 XMLRepr (class in rwslib.rwsobjects), 75
translations (rwslib.builders.metadata.Decode at-
tribute), 80
translations (rwslib.builders.metadata.MdsolLabelDef
attribute), 90
translations (rwslib.builders.metadata.Question at-
tribute), 92
translations (rwslib.builders.metadata.Symbol at-
tribute), 93
TwoHundredRequest, 10
TwoHundredRequest (class in rwslib.rws_requests),
70
U
User (class in rwslib.builders.admindata), 109
user_ref (rwslib.builders.clinicaldata.AuditRecord at-
tribute), 95, 102
user_type (rwslib.builders.admindata.User attribute),
109
UserRef (class in rwslib.builders.clinicaldata), 100,
107
UsersRequest, 61
UsersRequest (class in
rwslib.rws_requests.odm_adapter), 78
using_builders, 35
V
value (rwslib.builders.metadata.MdsolAttribute at-
tribute), 85
VersionDatasetRequest, 20
VersionDatasetRequest (class in
rwslib.rws_requests), 70
VersionFoldersRequest, 58
VersionFoldersRequest (class in
rwslib.rws_requests.odm_adapter), 78
VersionRequest, 9
VersionRequest (class in rwslib.rws_requests), 70
VersionRequestBase (class in
rwslib.rws_requests), 70
view_restrictions
(rwslib.builders.metadata.FormDef attribute),
81
view_restrictions
(rwslib.builders.metadata.ItemDef attribute),
84
view_restrictions
(rwslib.builders.metadata.MdsolLabelDef
attribute), 90
120 Index