DFws API User Guide

Release 5.1.0

All rights reserved. No part of this publication may be re-transmitted in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of DF/Net Research, Inc.. Permission is granted for internal re-distribution of this publication by the license holder and their employees for internal use only, provided that the copyright notices and this permission notice appear in all copies.

The information in this document is furnished for informational use only and is subject to change without notice. DF/Net Research, Inc. assumes no responsibility or liability for any errors or inaccuracies in this document or for any omissions from it.

All products or services mentioned in this document are covered by the trademarks, service marks, or product names as designated by the companies who market those products.

Feb 01, 2019

Abstract

This guide describes the DFdiscover application programming interface, commonly known as the DFws API, or simply DFws.

The DFdiscover API is a programming resource for users who would like to extend DFdiscover or build connectors from other environments to DFdiscover. Use or understanding of the DFws is not required for successful use of DFdiscover. Most users will never use DFws. This guide is intended for programmers.


Table of Contents

Preface
1. Getting Help
2. DFdiscover Mailing List
3. Conventions
1. Introduction
1.1. What is DFws?
1.2. How does it work?
1.3. How can we use it?
2. Quick Start with DFws
2.1. Just the Essentials
2.2. PHP Example
3. Developing with DFws
3.1. Prerequisites
3.2. API Client Account
3.3. DFdiscover and DFws API
3.3.1. Sessions
3.4. Getting Started
3.4.1. Authorize request
3.4.2. Subsequent Requests
3.4.3. Logout Request
3.5. Status Codes
3.5.1. Errors
3.6. JWT Code Samples
3.7. Details of all supported API endpoints
3.7.1. Session Management
3.7.2. Study Setup
3.8. Study Data
3.8.1. Subject list
3.8.2. Keys for Subject
3.8.3. Keys Available by Site
3.8.4. Status for keys
3.8.5. Database Records by filter
3.8.6. Database record by keys
3.8.7. Database record by name
3.8.8. Unlock
3.8.9. Lock
3.8.10. Add/Update Record
3.9. Document Management
3.9.1. Get Document
3.9.2. Add Document
3.10. User / Permission / Role Management
3.10.1. User Profile
3.10.2. Change Password
3.10.3. User Account
3.10.4. User Roles
3.10.5. Study Roles
3.10.6. Role Permissions
3.11. Metrics
3.11.1. License Metrics
3.11.2. Feature Metrics
4. Administering DFws
4.1. Installing DFws
4.2. Configuration File (dfws.cf)
4.3. DFws System Database (dfws.db)
4.3.1. DF_DEVELOPERS (Table Definition)
4.3.2. DF_LOG (Table Definition)
4.4. Starting and Stopping DFws
4.5. Monitoring DFws Activities
4.5.1. Using DFwsadmin
4.5.2. API Client Account Management
4.5.3. Log Management
4.5.4. System Status
A. Copyrights - Acknowledgments
A.1. External Software Copyrights
A.1.1. DCMTK software package
A.1.2. Jansson License
A.1.3. HylaFAX Facsimile Software
A.1.4. Mimencode
A.1.5. RSA Data Security, Inc., MD5 message-digest algorithm
A.1.6. mpack/munpack
A.1.7. TIFF
A.1.8. PostgreSQL
A.1.9. OpenSSL License
A.1.10. Original SSLeay License
A.1.11. gawk
A.1.12. Ghostscript
A.1.13. MariaDB and FreeTDS
A.1.14. QtAV
A.1.15. FFmpeg
A.1.16. c3.js
A.1.17. d3.js

Preface

Considerable familiarity with web application development principles is required. In addition to understanding DFws, successful implementation will require additional web programming skills and frameworks. Those skills and frameworks are not covered in this guide, except in examples to demonstrate use of DFws.

1. Getting Help

DF/Net Research, Inc.'s Technical Support Department can be contacted Monday to Friday between 9:00 am and 5:00 pm Eastern Time via any of the following methods:


55 Head Street, Suite 403
DundasOntario  L9H 3H8
Telephone: (905) 522-3282
Email: 
URL: www.dfnetresearch.com

2. DFdiscover Mailing List

DF/Net Research, Inc. provides an automated email mailing list for tips, help, and interaction with other DFdiscover users.

To subscribe to the mailing list, complete the simple form found at the DFdiscover User's Group mailing list webpage. It is also possible to unsubscribe from the mailing list by visiting the same webpage.

To submit a message to the mailing list

  1. Subscribe to the list. Message submissions are only accepted from members of the list.

  2. Create your email message.

  3. Send the email message to .

3. Conventions

A number of conventions have been used throughout this document.

Any freestanding sections of code are generally shown like this:

# this is example code
code = code + overhead;

If a line starts with # or %, this character denotes the system prompt and is not typed by the user.

Text may also have several styles:

  • Emphasized words are shown as follows: emphasized words.

  • Filenames appear in the text like so: dummy.c.

  • Code, constants, and literals in the text appear like so: main.

  • Variable names appear in the text like so: nBytes.

  • Text on user interface labels or menus is shown as: Printer name, while buttons in user interfaces are shown as Cancel.

  • Menus and menu items are shown as: File > Exit.

Chapter 1. Introduction

1.1. What is DFws?

DFws is an application programming interface (API) service for DFdiscover. It provides a public, session-based interface to DFdiscover resources.

1.2. How does it work?

DFws executes as a server-side daemon, talking to one or more DFdiscover servers. It provides session management for authenticated clients, accepts resource requests from clients, passes the requests to study database servers, waits for response and then passes the results back to the authenticated client in a response.

For the current release, DFws services are all routed through a server maintained by DF/Net Research, Inc.. For future releases, customers will have the ability to deploy their own DFws server.

1.3. How can we use it?

DFws is most useful to clients that need to interact with DFdiscover at a programmatic level. They need to interact with DFdiscover, retrieving or submitting data, in a way that is not already provided by an existing application (such as DFexplore) or a command-line program.

DFweb and DFcollect are examples of authenticated clients that provide interfaces to DFdiscover and DFdiscover data in unique ways. They both request data from DFws, manipulate it through their interfaces, and submit data through DFws to one or more study databases. The data is available to any user with the appropriate permissions and using any of the DFdiscover tools.

What tools can you create that interface with DFdiscover to solve unique clinical trial data management problems?

Chapter 2. Quick Start with DFws

2.1. Just the Essentials

Before you can develop solutions with DFws, a few essential pieces are needed. These pieces include:

  1. Get API access credentials from DFws Admin. The credentials include values for:

    • CLIENT_ID

    • CLIENT_PASS

    • CLIENT_SECRET

    • API server base URI

  2. Choose your method of sending HTTPS requests:

    • Web, Mobile or Desktop application

    • Unix Script (cURL)

    • REST API Client apps such as: Postman, Paw, HTTPie, SoapUI, Insomnia REST Client

  3. Start sending requests and receiving data.

2.2. PHP Example

This example uses PHP web page scripts to login to a DFdiscover server, namely explore.dfdiscover.com using a DFws API server, dfws.dfdiscover.com, and request the list of available studies.

An authorize API request is sent that includes DFdiscover login credentials and an authorization string to authenticate the API client. A sessionID is returned in the response. This sessionID is required to send subsequent requests. Additionally, all subsequent requests require encoding.

For the example, there are five files that must be copied to your php web server environment:

  • index.php: login page

  • apirequests.php: functions to send cURL API calls

  • studies.php: studies list page

  • styles.css: stylesheet for html rendering

  • CA.pem: SSL CA Bundle

These files will require some editing to specify your unique API server access credentials. Also, ensure that your SSL CA certificate file is correctly referenced.

For a full list of available API endpoints, consult Details of all supported API endpoints.

Example 2.1. index.php

<?php

$error=''; 
if (isset($_POST['submit'])) {
        include('apirequests.php'); // INCLUDE FUNCTIONS FILE
        if (empty($_POST['server']) || empty($_POST['username']) || empty($_POST['password'])) {
                $error = "Server, Username and Password must be provided";
        } else {
                $username=$_POST['username'];
                session_start();
                $session_id=login($_POST['server'], $username, 
                                                        $_POST['password'], $error);
                if (!empty($session_id)) {
                        $_SESSION['session_id']=$session_id;
                        $_SESSION['username']=$username;
                        header("location: studies.php"); // Redirecting To Studies List
                } else {
                        $error = "Username or Password is invalid<br>".$err.$response;
                }
        }
}
?>

<html>
<head>
<title>Login to DFdiscover via DFws</title>
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body> <center>
<div id="logo"></div> <div id="main"><h1>Login</h1>
<div id="login" align=left>
<form action="" method="post">
<label>DFdiscover Server:</label><input id="server" name="server" type="text"><br>
<label>Username:</label><input id="name" name="username" type="text"><br>
<label>Password:</label><input id="password" name="password" type="password"><br><br>
<input name="submit" type="submit" value=" Login "><br>
<span><?php echo $error; ?></span>
</form></div></div>
<a href="https://www.dfdiscover.com">www.dfdiscover.com</a>
</center></body>
</html>

// End of file index.php

Example 2.2. apirequests.php

<?php

//////////////API Requests Functions //////////////////////

//////////// Request to authorize and login //////////////
function login($svr, $uid, $pwd, &$err)
{
        $SSL_PEM_FILE = "CA.pem";
        $API_PORT= "4433";
        $API_URL= "https://dfws.dfdiscover.com:4433";
        $API_AUTH= base64_encode("CLIENT_ID:CLIENT_PASS");
        
        $json_str = "{ \n\t\"server\": \"".$svr."\",\n\t\"username\": \"".$uid."\",\n\t\"password\": \"".$pwd."\",\n\t\"sessionDuration\": \"1\"\n}";
        $curl = curl_init();
        curl_setopt_array($curl, array(
          CURLOPT_SSL_VERIFYPEER => true,
          CURLOPT_SSL_VERIFYHOST => 2,
          CURLOPT_CAINFO => $SSL_PEM_FILE,
          CURLOPT_PORT => $API_PORT,
          CURLOPT_URL => $API_URL."/dfws/v5/authorize",
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_ENCODING => "",
          CURLOPT_MAXREDIRS => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
          CURLOPT_CUSTOMREQUEST => "POST",
          CURLOPT_POSTFIELDS => $json_str,
          CURLOPT_HTTPHEADER => array(
            "authorization: Basic ".$API_AUTH,
            "cache-control: no-cache",
            "content-type: application/json"
          ),
        ));

        $response = curl_exec($curl);
        $err = curl_error($curl);
        $server_resp = json_decode($response);
        curl_close($curl);

        $session_id="";
        if (isset($server_resp->sessionToken))
        {
                $session_id=$server_resp->sessionToken->sessionID;
        }
        return  $session_id;
}

//////////// JWT encoding //////////////
function base64url_encode($data) {
  return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
function encodeJWT($s_id, $u_r_l)
{
        $API_SECRET  = 'CLIENT_SECRET';
        $payload= array('sessionId' => $s_id, 'url' => $u_r_l);
        $header = array('alg' => 'HS256', 'typ' => 'JWT');
        $segments = array();
        $segments[]=base64url_encode(json_encode($header,
                                JSON_UNESCAPED_SLASHES));
        $segments[]=base64url_encode(json_encode($payload,
                                JSON_UNESCAPED_SLASHES));
        $signing_input = implode('.', $segments);
        $signature = hash_hmac('sha256', $signing_input, $API_SECRET, true);
        $segments[] = str_replace('=', '', base64url_encode($signature));
        return implode('.', $segments);
}

//////////// Requests requiring JWT ///////////
function reqDFData($sid, $req_url, &$response, &$err)
{
        $SSL_PEM_FILE = "CA.pem";
        $API_PORT= "4433";
        $API_URL= "https://dfws.dfdiscover.com:4433";
        $jwt_str = encodeJWT($sid,$req_url);
        $curl = curl_init();
        curl_setopt_array($curl, array(
                CURLOPT_SSL_VERIFYPEER => true,
                CURLOPT_SSL_VERIFYHOST => 2,
                CURLOPT_CAINFO => $SSL_PEM_FILE,
                CURLOPT_PORT => $API_PORT,
                CURLOPT_URL => $API_URL.$req_url,
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_ENCODING => "",
                CURLOPT_MAXREDIRS => 10,
                CURLOPT_TIMEOUT => 30,
                CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                CURLOPT_CUSTOMREQUEST => "GET",
                CURLOPT_HTTPHEADER => array(
                "authorization: Bearer ".$jwt_str,
                "from: CLIENT_ID",
                "cache-control: no-cache"
                ),
        ));
        $response = curl_exec($curl);
        $err = curl_error($curl);
        curl_close($curl);
        if ($err) {
                  echo "cURL Error #:" . $err;
                return 0;
        }
        return 1;
}
?>
// End of file apirequests.php

Example 2.3. studies.php

<?php

/////////////// GET & SHOW STUDIES LIST //////////
include('apirequests.php');
session_start();
if ( !isset($_SESSION['username']) || 
        !isset($_SESSION['session_id']) ) 
{
        echo '<font color=blue>Session Expired!</font>';
        echo '<br><a href="index.php">Click here to Login</a>';
        exit;
}
$username=$_SESSION['username'];
$session_id=$_SESSION['session_id'];
if (!reqDFData($session_id, "/dfws/v5/studies", $response, $err)) exit;
$server_resp = json_decode($response);
if (is_object($server_resp) && $server_resp->status)
{
        echo '<font color=blue>'.$server_resp->message.'</font>';
        $_SESSION['reason']=$server_resp->message;
        echo '<br><a href="index.php">Click here to Login</a>';
                exit;
        }
?>
<html> <head>
<title>DFdiscover Web - Sample</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head> 
<body> <center>
<h2>Studies List</h2> 
<?php  
foreach ($server_resp as $val)
{
        if (!is_object($val)) continue;        
        echo '<div class=study><div align=left>';
        echo $val->studyId."&nbsp;&nbsp;\t".$val->name; 
        if ($val->disabled)
                echo '<font class=study_status color=red>Not Available: '.$val->disabledWhy.'</font></div>';
        else if ($val->restricted)
                echo '<font class=study_status color=red> Restricted: '.$val->restrictedWhy.'</font>';
        else        
                echo '<font class=study_status color=green>Available</font></div>';
         echo '</div> </div> <br>';
 } ?> 
</center>
</body>
</html>

// End of file studies.php

Example 2.4. styles.css

@import http://fonts.googleapis.com/css?family=Raleway;

#main {width:960px;margin:50px auto;font-family:raleway}

span {color:red }

h2 {background-color:#FEFFED;color:#2E2E2E;text-align:center;border-radius:-10px -10px 0 0;margin:0px 0px;padding:5px}

hr {border:0;border-bottom:1px solid #ccc;margin:10px -40px;margin-bottom:30px}

#login {width:300px;float:center;border-radius:10px;font-family:raleway;border:2px solid #ccc;padding:10px 40px 25px;margin-top:70px}
input[type=text],input[type=password] {width:99.5%;padding:10px;margin-top:8px;border:1px solid #ccc;padding-left:5px;font-size:16px;font-family:raleway}

input[type=submit] {width:100%;background-color:#FFBC00;color:#fff;border:2px solid #FFCB00;padding:10px;font-size:20px;cursor:pointer;border-radius:5px;margin-bottom:15px}

.study{width: 700px;float:center;border-radius:2px;font-family:arial;border:1px solid #E5E4E2;padding:10px 20px 8px;color:#483C32;background: -webkit-gradient(linear, left top, left bottom,from(#f2f2f2), to(#f2f2f2));background: -moz-linear-gradient(top,  #F5F5DC,  #f2f2f2);        }

.study_status{width: 50%;float:right;border-radius:1px;font-size:12px;font-family:arialnarrow;padding:2px 3px 1px;}

a {text-decoration:none;color:#4863A0;}

// End of file styles.css

Chapter 3. Developing with DFws

This chapter provides detailed information for using and programming with the DFdiscover API (DFws API), as well as details of all supported API endpoints.

3.1. Prerequisites

There are two important pre-requisites for using the DFws API:

  1. The DFws API is licensed separately from DFdiscover. A valid license with the DFWS feature enabled is required. Contact DF/Net Research, Inc. for licensing information.

  2. A DFws API server must be installed and configured. This chapter references the generic DFws API server that is available at dfws.dfdiscover.com. For future releases, you may be using your own DFws API service, exposed through your own dfwsApiServer.

To access resources from dfwsApiServer, clients require a base URI (Uniform Resource Identifier). The base URI is the hostname of the dfwsApiServer appended with the service name and the API version. The DFws API supports HTTPS requests only, providing TLS1.2 encrypted communications over the exposed port. DFws API clients must also be aware of the correct port number to use for sending HTTPS requests. In our demo example, we use port number 4433. Together with the generic DFws API server, the correct Base URI to send requests is thus:

https://dfws.dfdiscover.com:4433/dfws/v5

3.2. API Client Account

Before accessing resources provided by dfwsApiServer, clients must have an API Client Account defined in the DFws database. This is typically requested of, and provided by the DFws administrator (which is DF/Net Research, Inc. at this time). The result of that request is a set of API Client Account credentials.

CredentialsDescription
client_idThe login username of the API client, used for authorize requests and for all other requests as request sender (From header).
client_passThe password of the API client used for authorize requests (Encoded with client_id for Authorization header).
client_secretThe passcode to encode API requests requiring a session token (JWT).

3.3. DFdiscover and DFws API

To use API resources, it is important to be familiar with DFdiscover. All DFdiscover clients communicate with a DFdiscover server using an encrypted connection. DFdiscover login credentials are required to establish a connection, which are then followed by data transactions. Each DFdiscover user is provided with the hostname of the DFdiscover server to connect to along with a Username and Password (these are normal DFdiscover user credentials, which are different from the API client account credentials). Once users are logged-in to the DFdiscover server using a client application, the application maintains that session for all database queries to DFdiscover. Similarly, all DFws API requests require an authenticated session that must be initialized using the authorize request. This request serves as an entry point for starting any new sessions to a DFdiscover server via the DFws API.

3.3.1. Sessions

A session is initialized using the authorize request and a session is terminated using the logout request. Creation of a session provides a unique sessionID. All subsequent requests must provide an encoded JWT session token, which includes this sessionID.

The following section outlines details of how to compile requests and tokens. A JWT Token is uniquely generated for each API request using an algorithm provided to clients as part of the application distribution. The algorithm requires a client_secret, request_URI and the sessionID. For more information regarding JWT see jwt.io and the JWT generation code examples in this document.

3.4. Getting Started

Each request is sent to the dfwsApiServer using HTTPS syntax and semantics. The Header component includes the API client/session information while the Body contains the JSON data of the request.

3.4.1. Authorize request

The authorize request starts a new DFws API session for a specific DFdiscover server. In the HTTP Header, the Basic Authorization Header is used to send API client credentials as a base64 encoded string based in the format

client_id:client_pass

The Body of the request includes JSON containing the DFdiscover server hostname and user login credentials.

Note that the client_id:client_pass must be Base64 encoded. This is easily accomplished using a standard base64encode function, e.g., base64('client_id:client_pass'); (where client_id and client_pass are concatenated with a colon)

Assuming a client_id of user1 and a client_pass of X, the base64 encoded result might be ZGZjb2xsZWN0OjFwYXNzd2Q=. That result is then included in the HTTPS request body as follows:

POST https://dfws.dfdiscover.com:4433/dfws/v5/authorize HTTP/1.1
Authorization: Basic ZGZjb2xsZWN0OjFwYXNzd2Q= 
Body: {server:"s1.dfdiscover.com",username:"user1",password:"x"}

Response to the request includes the unique sessionID. This sessionID is subsequently required for composing session tokens to be used in subsequent requests. The response has the following appearance:

{
  "serverResponse": {
    "isRouterUser": true,
    "isSysAdmin": false,
    "passExpiryDays": 47,
    "server": "s1.dfdiscover.com",
    "timestamp": "2018-03-07T14:55:26",
    "userEmail": "",
    "userFullName": "Firstname Lastname"
  },
  "sessionToken": {
    "expiryDate": "Tue Mar 7 19:58:26 2018 GMT",
    "sessionID": "2116b375-2941-45fa-8a74-19a356e114ec"
  }
}

3.4.2. Subsequent Requests

All requests (except authorize, broadcast and log) must provide a From header with client_id and Authorization header with the JWT sessionToken in the format Bearer ${jwt_token}. The HTTP request components for studies request are as follows:

GET /studies HTTP/1.1
Authorization: Bearer ${jwt_token}
From: ${client_id} 

for example:

GET https://dfws.dfdiscover.com:4433/dfws/v5/studies HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXNzaW9uSWQiOiIyMTE2YjM3NS0yOTQxLTQ1ZmEtOGE3NC0x
OWEzNTZlMTE0ZWMiLCJ1cmwiOiIvZGZ3ZWJhcGkvdjAvc3R1ZGllcyJ9.yrZJbzubVaG9vfqT19h7fbUfKx7quzzmQ
fPjKfbzplQ
From: dfcollect

3.4.3. Logout Request

Every API client is required to logout, thereby terminating the sessionID and closing the connection. To terminate an authorized user's session with a DFdiscover server, make a GET request to logout as follows:

GET /logout HTTP/1.1
Authorization: Bearer ${jwt_token}
From: ${client_id} 

For example,

GET https://dfws.dfdiscover.com:4433/dfws/v5/logout HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXNzaW9uSWQiOiJkOTEwNDU3NS1mN2Q2LTQzNDAtYjhlYy00
ODg2YTk1ODBjZjYiLCJ1cmwiOiIvZGZ3cy92NS9sb2dvdXQifQ==.GR/9EKqwhptEHmpeet5J2CGOBupBnYaZB9bG2
16iZZ8
From: dfcollect

HTTP MethodDescription
GETRetrieve resources
PUTUpdate resources
POSTCreate resources and perform resource actions
LOCKAcquire resource lock
UNLOCKRelease resource lock

The following resources may be requested.

RequestDescriptionMore Info
POST /authorizeInitialize a new authorized sessionSection 3.7.1.1, “Authorize”
GET /logoutClose sessionSection 3.7.1.7, “Logout”
GET /studiesGet list of studiesSection 3.7.1.8, “Studies”
GET /studies/:studyNumGet study statusSection 3.7.1.9, “Study Status”
GET /studies/:studyNum/visitmapGet visit map for study :studyNumSection 3.7.2.5, “Visit Map”
GET /studies/:studyNum/sitesGet sites for study :studyNumSection 3.7.2.7, “Sites”
GET /studies/:studyNum/missingmapGet missing values map for study :studyNumSection 3.7.2.3, “Missing Map”
GET /studies/:studyNum/querycategorymapGet query category map for study :studyNumSection 3.7.2.4, “Query Category Map”
GET /studies/:studyNum/lut/:lut_nameGet the study lookup table :lut_name. If there is no matching lookup table, return the matching system lookup table.Section 3.7.2.2, “Lookup Table”
GET /studies/:studyNum/setupGet setup for study :studyNumSection 3.7.2.8, “Setup Definition”
GET /studies/:studyNum/setup/plates/:plateGet setup information for a particular plate in the studySection 3.7.2.9, “Setup Plate”
GET /studies/:studyNum/setup/plates/:plate/modules/:module_idReturns module reference object for a particular plate in the studySection 3.7.2.10, “Setup Module”
GET /studies/:studyNum/setup/plates/:plate/modules/:module_id/fields/:field_idReturns module reference object for a particular field in the studySection 3.7.2.11, “Setup Fields”
GET /studies/:studyNum/editchecksReturns editchecks binary (compiled editchecks) for the studySection 3.7.2.12, “Edit Checks”
GET /studies/:studyNum/logoGet the logo for the studySection 3.7.2.1, “Logo”
GET /studies/:studyNum/sitesubjects/:site_id?includenewGet a list of all subjects for the specified site that have records in the database for the specified study.

The optional parameter 'includenew' can be specified to also return the next set of subject IDs that are not yet in the databse. The number of new subjects returned matches the value of Show next [#] New Subject Binders defined in the study global settings.

Section 3.8.1, “Subject list”
GET /studies/:studyNum/subjectkeys/:subjectGet a list of all existing record keys (subject, visit, plate, status, and validation level) for a given subject in the database for the specified studySection 3.8.2, “Keys for Subject”
GET /studies/:studyNum/sitekeys/:site_idGet a list of all primary keys that exist for a given site in the database for the specified studySection 3.8.3, “Keys Available by Site”
GET /studies/:studyNum/keysinfoGet keys filtered based on parametersSection 3.8.4, “Status for keys”
GET /studies/:studyNum/recordsGet records filtered based on parameters (See detailed description for parameter options)Section 3.8.5, “Database Records by filter”
GET /studies/:studyNum/records/:subject/:visit/:plateGet a record with the given set of keys - subject, visit and plate from database in the specified studySection 3.8.6, “Database record by keys”
LOCK /studies/:studyNum/records/:subject/:visit/:plateLock a record with the given set of keys - subject, visit and plate from database in the specified study. The lock is held until released, the client exits or session time-out occurs.Section 3.8.9, “Lock”
UNLOCK /studies/:studyNum/records/:subject/:visit/:plateRelease lock on data record with the given set of keys - subject, visit and plate from database in the specified studySection 3.8.8, “Unlock”
PUT /studies/:studyNum/records/:subject/:visit/:plateUpdate a record with the given set of keys - subject, visit and plate from database in the specified studySection 3.8.10, “Add/Update Record”
GET /studies/:studyNum/documents/:image_idGet JSON with base64 encoded image file that matches the image_id for the specified studySection 3.9.1, “Get Document”
PUT /studies/:studyNum/documents/:subject/:visit/:plateUpload the specified image file to server for the specified keys in the database for the specified studySection 3.9.2, “Add Document”
GET /studies/:studyNum/report/:reportnameRun :reportname for the specified study and return study resultsSection 3.7.2.6, “Reports”
GET /licensemetricsGet license metrics of DFdiscover serverSection 3.11.1, “License Metrics”
GET /featuremetricsGet feature metrics of DFdiscover serverSection 3.11.2, “Feature Metrics”
GET /users{/:user_name}Get account detail for all users or specified user :user_nameSection 3.10.3, “User Account”
POST /contactinfo/:user_nameChange current user's own profileSection 3.10.1, “User Profile”
GET /users/:user_name/userrolesGet user roles for DFdiscover user :user_nameSection 3.10.4, “User Roles”
GET /roles/:studyNumGet roles defined for study :studyNumSection 3.10.5, “Study Roles”
GET /roles/:role_id/rolepermsGet role-perms for role :role_idSection 3.10.6, “Role Permissions”
GET /broadcastGet broadcast message, login.html contents from DFdiscover serverSection 3.7.1.2, “Broadcast”
GET /keepaliveA connection keep-alive request that resets session expiry timerSection 3.7.1.6, “Keepalive”
GET /sessionsGet most recent 500 records from internal DFws log. Restricted to DFws admins only.Section 3.7.1.3, “Log”
GET /closesessionClose an active DFws session. Authorized DFdiscover admin user session must be initialized by the API client in order to close DFws sessions to the DFdiscover server.Section 3.7.1.5, “Close Session”

3.5. Status Codes

Following is the list of HTTP status codes that may be returned by a DFws API server. For the full list/details of HTTP status codes, see the wikipedia page.

Status CodeDescription
200OK
204No Content
400Bad request
401Unauthorized
403Forbidden
404No such oject
409Conflict
500Internal error
501Not implemented
503Service not available
600Host not found
601Connection refused
602Connection closed

3.5.1. Errors

If the API request does not return with a status of 200, the error is represented as a JSON object with status and error message like this:

{
  "status": 403,
  "message": "Forbidden"
}

3.6. JWT Code Samples

There are several methods available for generating a JSON web token. Implementation is left to the developer. A few examples are provided here.

Example 3.1. JWT Generation in AngularJS

<!-- BEGIN CODE SNIPPET -->
  function createJWT(uri, sessionId) {
    let header = {
      "alg": "HS256",
      "typ": "JWT"
    };
    let payload = {
      "sessionId": sessionId,
      "url": uri
    };
    let secret = 'client_secret'; // Provided to all API clients
    let b64Header = b64Encode(JSON.stringify(header));
    let b64Payload = b64Encode(JSON.stringify(payload));
    let b64Secret = b64Encode(secret);
    return b64Header + '.' + b64Payload + '.' + 
       hmacSHA256(b64Header + "." + b64Payload, b64Secret);
  } 

  // How to call above function
  jwt_token = createJWT("/dfws/v5/studies", 
       "2116b375-2941-45fa-8a74-19a356e114ec");
<!-- END CODE SNIPPET -->

Example 3.2. JWT Generation function in PHP

<!-- BEGIN CODE SNIPPET -->
  function create_JWT($uri, $sessionId)
  { 
$payload= array('sessionId' => $sessionId, 'url' => $uri); 
$header = array('alg' => 'HS256', 'typ' => 'JWT'); 
$segments = array();
$segments[] = base64_encode(
       json_encode($header,JSON_UNESCAPED_SLASHES));
$segments[] = base64_encode(
       json_encode($payload,JSON_UNESCAPED_SLASHES));
$signing_input = implode('.', $segments);
$signature = hash_hmac('sha256', $signing_input,'client_secret', true);
$segments[] = str_replace('=','', base64_encode($signature)); 
return implode('.', $segments); 
  }

  // How to call above function
  $jwt_token = create_JWT('/dfws/v5/studies', 
       '2116b375-2941-45fa-8a74-19a356e114ec');
<!-- END CODE SNIPPET -->

Example 3.3. JWT Generation using JWT.IO library (www.jwt.io)

For JWT.IO simply compose payload with 'url' and 'sessionId' and use client_secret to generate token.

<!-- Sample Header-->
{
  "alg": "HS256",
  "typ": "JWT"
}
<!-- Sample Payload -->
{
  "sessionId": "929e9444-a028-4a94-8931-e2cbdf4b4a1f",
  "url": "/dfws/v5/studies"
}

3.7. Details of all supported API endpoints

3.7.1. Session Management

3.7.1.1. Authorize

Authorize a DFdiscover user and start a new session

RequestPOST /authorize
Example Response
{
    "serverResponse": {
        "cdnUrl": "https://cdn.dfdiscover.com/v5.1",
        "isRouterUser": true,
        "isSysAdmin": true,
        "maxMediaSize": 26214400,
        "passExpiryDays": 140,
        "passRules": {
            "charDigitRequired": true,
            "minLength": 7,
            "specialCharRequired": false,
            "upperLowerRequired": false
        },
        "server": "explore.dfdiscover.com",
        "serverVersion": "5.1.0",
        "timestamp": "2019-01-09T09:33:07",
        "userEmail": "",
        "userFullName": "Example Admin"
    },
    "sessionToken": {
        "expiryDate": "2019-01-09T14:43:07Z",
        "sessionID": "e2e88735-a265-4eb7-b9af-c2afb170f1bd"
    }
  }
}
Notes

POST Body JSONTypeDescription
serverstring (Required)Server name (e.g. test.dfnetresearch.com)
usernamestring (Required)DFdiscover username
passwordstring (Required)DFdiscover password
sessionDurationinteger (Optional)Connection keep-alive time in minutes. Default is 3 minutes if sessionDuration not provided. Connection terminates if no activity within sessionDuration period

3.7.1.2. Broadcast

Retrieve Login.html contents from DFdiscover server.

RequestPOST /broadcast
Example Response
{
  "data": "<center>DFdiscover 5.0 running on OpenSUSE 13.2</center>"
}
Notes
POST Body JSON fieldTypeDescription
serverstring (Required)Server name (e.g. test.dfnetresearch.com)

This is an independent request and does not depend on 'authorize' request. For this reason, the API user must pass the Authorization header.

Provide your client credentials in the Authorization header ("Basic "+ client_id:client_secret) where client_id:client_secret is Base64 encoded.

GET https://dfws.dfdiscover.com:4433/dfws/v5/broadcast HTTP/1.1
Authorization: Basic ZGZjb2xsZWN0OjFwYXNzd2Q= 

3.7.1.3. Log

Returns recent 500 records from internal DFws log. Restricted to DFws admins only. Provide your client credentials in the Authorization header ("Basic "+ client_id:client_secret) where client_id:client_secret is Base64 encoded.

GET https://dfws.dfdiscover.com:4433/dfws/v5/log HTTP/1.1
Authorization: Basic ZGZjb2xsZWN0OjFwYXNzd2Q= 
RequestGET /log
Example Response
[
    {
        "DFDEVLOGIN": "",
        "DFMESSAGE": "Invalid Authorization Token",
        "DFMETHOD": "POST",
        "DFPEER": "::ffff:192.168.4.105",
        "DFSTATUS": 200,
        "DFTIMESTAMP": "20181018193011",
        "DFTYPE": 1,
        "DFURI": "/dfws/v0/authorize",
        "DFUSER": ""
    },
    {
        "DFDEVLOGIN": "",
        "DFMESSAGE": "Invalid API call",
        "DFMETHOD": "POST",
        "DFPEER": "::ffff:192.168.4.105",
        "DFSTATUS": 503,
        "DFTIMESTAMP": "20181018192503",
        "DFTYPE": 1,
        "DFURI": "/dfws/v0/austorize",
        "DFUSER": ""
    }
]

3.7.1.4. Sessions

Returns details of current active sessions. This request is restricted to DFdiscover admins or DFws admins. The DFws admin can access sessions list in the following ways: Provide the admin credentials in the Authorization header ("Basic "+ client_id:client_secret) where client_id:client_secret is Base64 encoded.

GET https://dfws.dfdiscover.com:4433/dfws/v5/sessions HTTP/1.1
Authorization: Basic ZGZjb2xsZWN0OjFwYXNzd2Q= 
RequestGET /sessions
Example Response
[
    {
        "apiClient": "dfweb",
        "datafaxServer": "t50suse.datafax.com",
        "duration": 3,
        "expiryTime": "Wed Jul 12 19:57:35 2017 GMT",
        "hostAddresses": [
            {
                "hostAddress": "::ffff:192.168.4.223",
                "order": 1
            }
        ],
        "openedStudy": 154,
        "origin": "",
        "sessionID": "c4e6d9f4-7b77-4d88-9455-a16c117179c1",
        "startTime": "Wed Jul 12 19:54:33 2017 GMT",
        "status": "idle",
        "sysAdmin": true,
        "userID": "datafax"
    },
    {
        "apiClient": "dfwebadmin",
        "datafaxServer": "t50centos.datafax.com",
        "duration": 3,
        "expiryTime": "Wed Jul 12 19:56:43 2017 GMT",
        "hostAddresses": [
            {
                "hostAddress": "::ffff:192.168.4.105",
                "order": 1
            }
        ],
        "openedStudy": 0,
        "origin": "",
        "sessionID": "54d78cf9-604f-48b6-83c7-add7b142ce04",
        "startTime": "Wed Jul 12 19:52:06 2017 GMT",
        "status": "idle",
        "sysAdmin": true,
        "userID": "datafax"
    }
]

3.7.1.5. Close Session

Close an active DFws session. An authorized DFdiscover admin user session must be initialized by the API client in order to close DFws sessions to the DFdiscover server. Therefore, like all non-admin requests, this request requires JWT token in Authorization header as well as client_id in From header.

RequestGET /closesession?sessionID=${SESSIONID}
Example Response
{
  "logout": true,
  "timestamp": "2016-07-12T12:11:48",
  "message": "Session closed successfully"
}

3.7.1.6. Keepalive

A connection keep-alive request that resets the session's expiry timer

RequestGET /keepalive
Example Response
{
   "sessionDuration": 10,
   "status": "OK"
}   

3.7.1.7. Logout

Terminate an authorized user's connection to a DFdiscover server

RequestGET /logout
Example Response
{
    "logout": true,
    "sessionID": "94e25498-1ea6-401b-80aa-e35ebe1e626d",
    "username": "datafax"
}

3.7.1.8. Studies

Request the list of all permitted studies and their status

RequestGET /studies
Example Response
[
  {
    "disabled": false,
    "disabledWhy": "",
    "name": "Demo 253",
    "restricted": false,
    "restrictedWhy": "",
    "studyId": 253
  },
  {
    "disabled": false,
    "disabledWhy": "",
    "name": "Acceptance Test Study",
    "restricted": false,
    "restrictedWhy": "",
    "studyId": 254
  }
]
Notes

Each study in the result is an element in a JSON array. For each study element, the following attributes are provided.

AttributeTypeDescription
disabledbooleanTrue if study is disabled, false otherwise
disabledWhystringReason why the study is disabled, blank if not disabled
namestringStudy name
restrictedbooleanTrue if study is restricted, false otherwise
restrictedWhystringReason why the study is restricted, blank if not restricted
studyIdnumber, 1 to 999Unique study number

3.7.1.9. Study Status

Get the status of a particular study and keep study connection open for the session.

RequestGET /studies/:study_num
Example Response
{
  "readOnly": false,
  "studyId": 250
}

3.7.1.10. Release Study

Release the study opened in current session and return the status of the study.

RequestGET /studies?release
Example Response
{
  "readOnly": false,
  "studyId": 250
}

3.7.2. Study Setup

3.7.2.1. Logo

Get study logo image, base64 encoded

RequestGET /studies/:study_num/logo
Example ResponseBinary format
NotesLogo is a PNG image, with base64 encoding applied.

3.7.2.2. Lookup Table

Get a named lookup table

RequestGET /studies/:study_num/lut/:lut_name
Example Response
[
  {
    "code": "refax",
    "label": "corrections on refaxed CRF from a clinical site"
  },
  {
    "code": "letter",
    "label": "corrections described in a letter from the clinical investigator"
  },
  {
    "code": "typo",
    "label": "data entry error correction"
  }
]
NotesSpecial lookup table names include QC, QCNOTE, QCREPLY, REASON

3.7.2.3. Missing Map

Get missing values lookup

RequestGET /studies/:study_num/missingmap
Example Response
[
  {
    "code": ".U",
    "label": "Unknown"
  },
  {
    "code": ".D",
    "label": "Not Done"
  },
  {
    "code": ".A",
    "label": "Not Available"
  },
  {
    "code": ".R",
    "label": "Not Relevant"
  }
]

3.7.2.4. Query Category Map

Get query category map

RequestGET /studies/:study_num/querycategorymap
Example Response
[
    {
        "code": "1",
        "label": "Missing",
        "autoResolve": 0,
        "sortValue": 0
    },
    {
        "code": "2",
        "label": "Illegal",
        "autoResolve": 1,
        "sortValue": 0
    }
]

3.7.2.5. Visit Map

Get visit map

RequestGET /studies/:study_num/visitmap
Example Response
[
  {
    "dueDay": 0,
    "label": "Screening Visits",
    "missedVisitPlate": 0,
    "optionalPlates": [102,101],
    "overdueAllowance": 0,
    "requiredPlates": [1],
    "terminationWindow": "",
    "type": "X",
    "visitDateField": 13,
    "visitDatePlate": 1,
    "visitId": 0,
    "visitIds": [
      {
        "end": 0,
        "start": 0
      }
    ]
  },
  {
    "dueDay": 0,
    "label": "Baseline",
    "missedVisitPlate": 0,
    "optionalPlates": [102],
    "overdueAllowance": 0,
    "requiredPlates": [2,4,3],
    "terminationWindow": "",
    "type": "B",
    "visitDateField": 9,
    "visitDatePlate": 2,
    "visitId": 1,
    "visitIds": [
      {
        "end": 1,
        "start": 1
      }
    ]
  }
]
Notes
Visit AttributeTypeDescription
dueDayintegerThe number of days before/after the baseline visit that the visit is scheduled. The baseline visit must have a value of 0 and pre-baseline visits must have negative values.
label string A short (maximum 40 character) textual description of the visit
missedVisitPlate integer Plate number which if received, indicates that the visit number coded on that plate was missed.
optionalPlates array Array of plate numbers for forms that may be completed on this visit, but are not required
overdueAllowance integer The number of days that a scheduled visit is allowed to be late. Visits are considered overdue if they have not arrived within this number of days following the visit due day
requiredPlates array Array of plate numbers for forms that are required to be completed on this visit
terminationWindow string For visit type W, a termination window is required and may be one of the following forms: - On yy/mm/dd - Before yy/mm/dd - After yy/mm/dd Between yy/mm/dd-yy/mm/dd fraction In each case, the date value uses the format that is defined as the visitDateField's format
type single character 1 character code for the type of visit. Legal values are from Visit Codes.
visitDateField integer The data field number of the visit date on the visitDatePlate.
visitDatePlate integer The plate on which the visit date can always be found. This must be one of the required plates listed in the requiredPlates array.
visitId integer The unique visit number
visitIds array Defines visit ids (start-end, inclusive) for visits that occur multiple times. The client often handles this in the following manner: 1. Fill out form or group of forms for the first visit id in the range 2. Once that form is assigned a status, a new visit with the next id defined in the range appears
Visit CodeMeaningScheduledRequired
X screening no If subject enters the trial (baseline arrives)
P pre-baseline visit yes Before arrival of baseline visit
B baseline yes Can be scheduled from a pre-baseline visit
S scheduled follow-up yes scheduled from the baseline visit
O optional follow-up no not a required visit
r required by date of termination visit no before arrival of next visit
R required by date of termination visit yes on termination if scheduled pre-termination
T cycle termination visit yes scheduled from the baseline visit
E early termination of current cycle if early termination occurs
A abort all cycles no if abort event occurs
F final visit (terminates all cycles) no
W study termination date window yes Date scheduling of final visit

3.7.2.6. Reports

Run study report and return JSON results

RequestGET /studies/:study_num/report/:reportname
Example ResponseEach response has a context section, optional labels section and a results section
[
    {
        "context": {
            "args": {
            },
            "endTime": "2018-04-16T15:06:46.552",
            "reportName": "Enrollment by Site",
            "startTime": "2018-04-16T15:06:46.454",
            "studyId": 154,
            "studyName": "Generic 154"
        },
    "labels": {
        "country":"Country Code",
        "endDate":"End Date",
        "enroll":"Enrollment Target",
        "name":"Site Name",
        "siteId":"Site ID",
        "startDate":"Start Date"
    },
    "results":[{
        ...
        }]
    }
]
Notes

Each report has unique output content. To view the structure of the report output, run the report and save the result to HTML. Examining the HTML, the content is marked as data and embedded in the <script type="application/json" id="data"> tag.

3.7.2.7. Sites

Get site information for an entire study definition

RequestGET /studies/:study_num/sites
Example Response
[
  {
    "name": "Hospital #1",
    "siteId": 10,
    "contact": "Person #1",
    "email": "test@dfnetresearch.com",
    "investigator": "PI #1",
    "investigatorPhone": "",
    "address": "100 Main St., Hamilton, Ontario",
    "telephone": "905-522-3282",
    "subjects": [
      {
        "end": 10999,
        "start": 10001
      }
    ]
  },
  {
    "name": "Hospital #2",
    "siteId": 20,
    "contact": "Person #2",
    "email": "test@dfnetresearch.com",
    "investigator": "PI #2",
    "investigatorPhone": "",
    "address": "15 North St., Hamilton, Ontario",
    "telephone": "905-522-3282",
    "subjects": [
      {
        "end": 20999,
        "start": 20001
      }
    ]
  }
]
Notes Returns sites database with details, including subject ID ranges, for each site. For each such site, the following attributes are provided.
AttributeTypeDescription
namestringName of the site, clinic, hospital or institution
siteIdintegerNumeric value in the range 0-21460 inclusive, which uniquely identifting each clinical site participating in the study
namestringName of the site, clinic, hospital or institution
contactstringName of the primary contact. By default, Query Reports are addressed to the primary contact
emailstringSpace-delimited list of email addresses, used to deliver DFdiscover Query Reports. Each email address must start with the prefix mailto: followed by the complete email address.
investigatorstringThe name of the principal investigator at the site.
enrollTargetintegerNumber of subjects that the site is expected to enroll.
addressstringStreet address
telephonestringTelephone number of the contact person
subjectsarraySubject ID lists or ranges (start-end, inclusive) available at each site. Each subject ID can belong to one and only one site. Is empty for the error monitor site.
countrystring3-character code from the ISO 3166-1 list of approved country codes. Useful for grouping by country
startDatedate in yyyy/mm/dd formatDate when site is expected to start, or has started, to enroll subjects
endDatedate in yyyy/mm/dd formatDate when site is expected to stop, or has stopped, enrolling subjects
effectiveDate[1-5]date in yyyy/mm/dd formatEach Effective Date is the first date on which the matching version is in place at the site. Multiple Effective Date are expected to be in chronological order.
version[1-5]stringA protocol version identifier. Paired with Effective Date, indicates when protocol
errorMonitorbooleanAny data records with subject IDs that do not belong to one of the clinical sites are automatically assigned to the error monitor site.
replyTostringEmail address of the person at this site who is designed to receive replies to Query Reports
testOnlybooleanIs this site present for testing only? Do not include test sites in exports/reports

3.7.2.8. Setup Definition

Get setup information for an entire study definition

RequestGET /studies/:study_num/setup
Example Response
[
  {
    "addPidEnabled": true,
    "autoReason": "per field",
    "dateRounding": "None",
    "level": 1,
    "levels": [],
    "multipleQC": false,
    "name": "Acceptance Test Study",
    "number": 254,
    "pidCount": 5,
    "plates": [
        ...
    ],
    "startYear": 1990,
    "studyHelp": "",
    "uniqueFieldNames": false,
    "viewModeEc": false,
    "yearCutoff": 1920
  }
]

The plates content is an array of 0 or more plates, each of which has a structure defined in Section 3.7.2.9, “Setup Plate”.

3.7.2.9. Setup Plate

Get setup information for a specific plate

RequestGET /studies/:study_num/setup/plates/:plate
Example Response
[
    {
        "arrivalTrigger": "",
        "description": "Blood Pressure Screening Visits",
        "eligibleForSigning": "Final",
        "help": "",
        "icr": "Standard",
        "moduleRefs": [
               ...
        ],
        "number": 1,
        "sequenceCoded": "First Data Field",
        "termPlate": false
    }
]

The moduleRefs content is an array of 0 or more modules, each of which has a structure defined in Section 3.7.2.10, “Setup Module”.

3.7.2.10. Setup Module

Get module reference object for a particular plate

RequestGET /studies/:study_num/setup/plates/:plate/modules/:mid
Example Response
[
    {
        "description": "Blood Pressure Readings",
        "fieldRefs": [
            ...
        ],
        "id": 5030,
        "instance": 2,
        "moduleId": 5022,
        "name": "BloodPressure",
        "number": 4
    }
]

The fieldRefs content is an array of 0 or more fields, each of which has a structure defined in Section 3.7.2.11, “Setup Fields”.

3.7.2.11. Setup Fields

Get collection of field reference objects within a module for a particular plate

RequestGET /studies/:study_num/setup/plates/:plate/modules/:mid/fields/:fid
Example Response
[
    {
        "alias": "S2SBP1",
        "blinded": "No",
        "comment": "",
        "constant": false,
        "constantValue": "",
        "description": "Screen 2: Reading 1 systolic",
        "display": 3,
        "fieldEnter": "",
        "fieldExit": "MissingQC",
        "fieldId": 10159,
        "format": "nnn",
        "help": "Legal values are: $(legal)",
        "id": 10207,
        "legal": "60-300",
        "level": 0,
        "name": "SBP1",
        "number": 21,
        "onCrfRect": true,
        "plateEnter": "",
        "plateExit": "",
        "prompt": "",
        "reasonIfNonBlank": false,
        "rects": [
        {
            "h": 25,
            "w": 26,
            "x": 501,
            "y": 475
        }
        ],
        "required": "Optional",
        "skipCondition": "",
        "skipTo": 0,
        "store": 3,
        "type": "Number",
        "units": "mmHg",
        "use": "Standard"
    }
]

3.7.2.12. Edit Checks

Get edit checks binary (compiled editchecks)

RequestGET /studies/:study_num/editchecks
Example ResponseBinary format

3.8. Study Data

3.8.1. Subject list

Get list of all subjects for the specified site that have records in the database

RequestGET /studies/:study_num/sitesubjects/:site_id

site_id is a required integer, equal to the siteId in the sites database

Example Response
[
  {
    "subjectId": 1001,
    "status": 1
  },
  {
    "subjectId": 1002,
    "status": 2
  },
  {
    "subjectId": 1003,
    "status": 2
  }
]
Notes Returns summary detail, specifically status, for each subject at the requested site. Subjects are included only if they have at least one record in the study database.
AttributeTypeDescription
subjectIdintegerUnique subject identifier
statusintegerSubject status is one of the following values: 1 = final, 2 = incomplete, 3 = pending

3.8.2. Keys for Subject

Get list of all existing record keys (subject, visit, plate, status, and validation level) for a given subject.

RequestGET /studies/:study_num/subjectkeys/:subjectId

The unique subject ID, :subjectId, is required.

Example Response
[
  {
    "subjectId": 99001,
    "plate": 1,
    "status": 1,
    "level": 0,
    "visit": 0
  },
  {
    "subjectId": 99001,
    "visit": 1
    "plate": 2,
    "status": 1,
    "level": 0,
  }
]
NotesThe return result is a JSON array of record key objects with the following attributes.
AttributeTypeDescription
subjectIdintegerUnique subject identifier
plateintegerPlate number
statusintegerSubject status is one of the following values: 1 = final, 2 = incomplete, 3 = pending
levelintegerSave level of record
visitintegerVisit number

3.8.3. Keys Available by Site

Get list of all primary keys that exist for a given site

RequestGET /studies/:study_num/sitekeys/:site_id

site_id is a required integer, equal to the siteId in the sites database

Example Response
[
    {
        "subjectId": 999001,
        "plate": 12,
        "visit": 50
    },
    {
        "subjectId": 999002,
        "plate": 12,
        "visit": 50
    }
]

3.8.4. Status for keys

Get ONE primary key (status: 0, 1, 2, 3) object, and zero or more secondary images keys (status: 4, 5, 6).

RequestGET /studies/:study_num/keysinfo/:subject/:visit/:plate

the :subject, :visit and :plate are all integer values and required

Example Response
[
    {
        "arrival":"",
        "created":"2014-06-25T11:58:10",
        "firstArrival":"2018/09/20 15:14:42",
        "format":"",
        "lastArrival":"2018/09/20 15:14:42",
        "level":1,
        "modified":"2018-08-29T16:03:00",
        "pages":"0",
        "plate":2,
        "raster":"1426R0003008",
        "sender":"",
        "status":5,
        "subjectId":2002,
        "visit":1,
        "visitDate":"02/01/15"
    },
    {
        "arrival":"2018/09/20 15:14:42",
        "created":"2014-06-25T11:58:10",
        "firstArrival":"2018/09/20 15:14:42",
        "format":"png",
        "lastArrival":"2018/09/20 15:14:42",
        "level":1,
        "modified":"2018-09-24T11:16:40",
        "pages":"1",
        "plate":2,
        "raster":"1838/009Z001",
        "sender":"DFws Attach DOC:datafax:asset.PNG%3Fid=7148A4A5-888D-49AC-9781-BC39DA88299E&ext=PNG",
        "status":2,
        "subjectId":2002,
        "visit":1,
        "visitDate":"02/01/15"
    }
]
NotesFor better performance load study's setup, sites, missingmap and visitmap:
  1. /studies/:study_num/setup

  2. /studies/:study_num/sites

  3. /studies/:study_num/missingmap

  4. /studies/:study_num/visitmap

3.8.5. Database Records by filter

Returns a record with filters for subjectId (id) or site. Records can also be filtered by modified_since timestamp to retrieve records modified on or after a given timestamp.

RequestGET /studies/:study_num/records?id={subject_id}&site={site_id}&modified_since={timestamp}

the :subject_id, :site_id are integer values

modified_since is an optional ISO format timestamp (i.e. 2016-06-07, 2016-06-07T10:35:57). If this filter is provided, a site_id or subject_id parameter must be specified. This filter retrieves records that were modified on or after the given timestamp.

Example Response
[
    {
        "created": "2018-09-12T17:32:36",
        "level": 1,
        "modified": "2018-12-11T12:56:20",
        "moduleData": [
            {
                "fieldData": [
                    {
                        "alias": "VISITNUM001",
                        "fid": 11155,
                        "fieldId": 10488,
                        "missingValue": "",
                        "name": "VISITNUM",
                        "value": "001"
                    },
                    {
                        "alias": "SUBJID001",
                        "fid": 11154,
                        "fieldId": 10485,
                        "missingValue": "",
                        "name": "SUBJID",
                        "value": "1001"
                    },
                    {
                        "alias": "VISDAT001",
                        "fid": 11156,
                        "fieldId": 10486,
                        "missingValue": "",
                        "name": "VISDAT",
                        "value": "29-AUG-2018"
                    },
                    {
                        "alias": "MHYN001",
                        "fid": 11159,
                        "fieldId": 11150,
                        "missingValue": "",
                        "name": "MHYN",
                        "value": "2"
                    },
                    {
                        "alias": "MHSPID001",
                        "fid": 11160,
                        "fieldId": 11153,
                        "missingValue": "",
                        "name": "MHSPID",
                        "value": ""
                    },
                    {
                        "alias": "CMYN001",
                        "fid": 11157,
                        "fieldId": 11149,
                        "missingValue": "",
                        "name": "CMYN",
                        "value": "2"
                    },
                    {
                        "alias": "CMSPID001",
                        "fid": 11158,
                        "fieldId": 11152,
                        "missingValue": "",
                        "name": "CMSPID",
                        "value": ""
                    },
                    {
                        "alias": "AEYN001",
                        "fid": 11161,
                        "fieldId": 11148,
                        "missingValue": "",
                        "name": "AEYN",
                        "value": "2"
                    },
                    {
                        "alias": "AESPID001",
                        "fid": 11162,
                        "fieldId": 11151,
                        "missingValue": "",
                        "name": "AESPID",
                        "value": ""
                    },
                    {
                        "alias": "LBYN001",
                        "fid": 11254,
                        "fieldId": 11243,
                        "missingValue": "",
                        "name": "LBYN",
                        "value": "0"
                    }
                ],
                "mid": 5153,
                "moduleId": 5026
            }
        ],
        "permission": {
            "addQuery": true,
            "addReason": true,
            "approveReason": true,
            "attachDoc": true,
            "createData": true,
            "deleteData": true,
            "deleteQuery": true,
            "deleteReason": true,
            "ecAddQuery": true,
            "ecAddReason": true,
            "ecApproveReason": true,
            "ecDeleteQuery": true,
            "ecModifyQuery": true,
            "modifyData": true,
            "modifyQuery": true,
            "modifyReason": true,
            "replyQuery": true,
            "roleName": "unrestricted",
            "showHiddenField": true
        },
        "plate": 1,
        "raster": "1837R0007001",
        "screen": 1,
        "status": 1,
        "studyId": 17,
        "subjectId": 1001,
        "visit": 1
    },
    {
        "created": "2018-09-12T17:32:49",
        "level": 1,
        "modified": "2018-09-12T17:32:49",
        "moduleData": [
            {
                "fieldData": [
                    {
                        "alias": "SUBJID002",
                        "fid": 10617,
                        "fieldId": 10485,
                        "missingValue": "",
                        "name": "SUBJID",
                        "value": "1001"
                    }
                ],
                "mid": 5033,
                "moduleId": 5026
            },
            {
                "fieldData": [
                    {
                        "alias": "IEYN",
                        "fid": 10619,
                        "fieldId": 10382,
                        "missingValue": "",
                        "name": "IEYN",
                        "value": "1"
                    }
                ],
                "mid": 5034,
                "moduleId": 5015
            }
        ],
        "permission": {
            "addQuery": true,
            "addReason": true,
            "approveReason": true,
            "attachDoc": true,
            "createData": true,
            "deleteData": true,
            "deleteQuery": true,
            "deleteReason": true,
            "ecAddQuery": true,
            "ecAddReason": true,
            "ecApproveReason": true,
            "ecDeleteQuery": true,
            "ecModifyQuery": true,
            "modifyData": true,
            "modifyQuery": true,
            "modifyReason": true,
            "replyQuery": true,
            "roleName": "unrestricted",
            "showHiddenField": true
        },
        "plate": 2,
        "raster": "1837R0007002",
        "screen": 2,
        "status": 2,
        "studyId": 17,
        "subjectId": 1001,
        "visit": 1
    }
]

3.8.6. Database record by keys

Get a record with the given set of keys - subject, visit and plate

RequestGET /studies/:study_num/records/:subject/:visit/:plate?allfields

Optional parameter allfields can be specified for new records which retrieves new record with all plate fields.

Example Response
{
    "created": "",
    "level": 0,
    "modified": "",
    "moduleData": [
        {
            "fieldData": [
                {
                    "alias": "VISITNUM001",
                    "fid": 11155,
                    "fieldId": 10488,
                    "missingValue": "",
                    "name": "VISITNUM",
                    "value": "1"
                },
                {
                    "alias": "SUBJID001",
                    "fid": 11154,
                    "fieldId": 10485,
                    "missingValue": "",
                    "name": "SUBJID",
                    "value": "2001"
                },
                {
                    "alias": "VISDAT001",
                    "fid": 11156,
                    "fieldId": 10486,
                    "missingValue": "",
                    "name": "VISDAT",
                    "value": ""
                },
                {
                    "alias": "MHYN001",
                    "fid": 11159,
                    "fieldId": 11150,
                    "missingValue": "",
                    "name": "MHYN",
                    "value": "0"
                },
                {
                    "alias": "MHSPID001",
                    "fid": 11160,
                    "fieldId": 11153,
                    "missingValue": "",
                    "name": "MHSPID",
                    "value": ""
                },
                {
                    "alias": "CMYN001",
                    "fid": 11157,
                    "fieldId": 11149,
                    "missingValue": "",
                    "name": "CMYN",
                    "value": "0"
                },
                {
                    "alias": "CMSPID001",
                    "fid": 11158,
                    "fieldId": 11152,
                    "missingValue": "",
                    "name": "CMSPID",
                    "value": ""
                },
                {
                    "alias": "AEYN001",
                    "fid": 11161,
                    "fieldId": 11148,
                    "missingValue": "",
                    "name": "AEYN",
                    "value": "0"
                },
                {
                    "alias": "AESPID001",
                    "fid": 11162,
                    "fieldId": 11151,
                    "missingValue": "",
                    "name": "AESPID",
                    "value": ""
                },
                {
                    "alias": "LBYN001",
                    "fid": 11254,
                    "fieldId": 11243,
                    "missingValue": "",
                    "name": "LBYN",
                    "value": "0"
                }
            ],
            "mid": 5153,
            "moduleId": 5026
        }
    ],
    "permission": {
        "addQuery": true,
        "addReason": true,
        "approveReason": true,
        "attachDoc": true,
        "createData": true,
        "deleteData": true,
        "deleteQuery": true,
        "deleteReason": true,
        "ecAddQuery": true,
        "ecAddReason": true,
        "ecApproveReason": true,
        "ecDeleteQuery": true,
        "ecModifyQuery": true,
        "modifyData": true,
        "modifyQuery": true,
        "modifyReason": true,
        "replyQuery": true,
        "roleName": "unrestricted",
        "showHiddenField": true
    },
    "plate": 1,
    "raster": "0000/0000000",
    "screen": 0,
    "status": 0,
    "studyId": 17,
    "subjectId": 2001,
    "visit": 1
}

3.8.7. Database record by name

Get a record referenced by field name for the given set of keys - subject, visit and plate

RequestGET /studies/:study_num/recordsbyname/:subject/:visit/:plate?allfields

This request offers a simplified version of JSON record with only fields name and value pair, offering a simplified format to get and update records for only those fields which are modified. Optional parameter allfields can be specified for new records which retrieves new record with all plate fields.

Example Response
{
    "created": "2018-09-12T17:32:36",
    "level": 1,
    "modified": "2018-12-19T22:18:34",
    "moduleData": [
        {
            "fieldData": [
                {
                    "name": "VISITNUM",
                    "value": "001"
                },
                {
                    "name": "SUBJID",
                    "value": "1001"
                },
                {
                    "name": "VISDAT",
                    "reasons": [
                        {
                            "code": "",
                            "created": "2018-12-19T21:46:51",
                            "createdBy": "datafax",
                            "field": 7,
                            "level": 1,
                            "modified": "2018-12-19T21:46:51",
                            "modifiedBy": "datafax",
                            "plate": 1,
                            "raster": "0000/0000000",
                            "status": 1,
                            "studyId": 17,
                            "subjectId": 1001,
                            "text": "Set by DFws Import",
                            "visit": 1
                        }
                    ],
                    "value": ""
                },
                {
                    "name": "MHYN",
                    "value": ""
                },
                {
                    "name": "MHSPID",
                    "value": ""
                },
                {
                    "name": "CMYN",
                    "value": ""
                },
                {
                    "name": "CMSPID",
                    "value": ""
                },
                {
                    "name": "AEYN",
                    "value": ""
                },
                {
                    "name": "AESPID",
                    "value": ""
                },
                {
                    "name": "LBYN",
                    "value": ""
                }
            ],
            "instance": 1,
            "name": "Common"
        }
    ],
    "permission": {
        "addQuery": true,
        "addReason": true,
        "approveReason": true,
        "attachDoc": true,
        "createData": true,
        "deleteData": true,
        "deleteQuery": true,
        "deleteReason": true,
        "ecAddQuery": true,
        "ecAddReason": true,
        "ecApproveReason": true,
        "ecDeleteQuery": true,
        "ecModifyQuery": true,
        "modifyData": true,
        "modifyQuery": true,
        "modifyReason": true,
        "replyQuery": true,
        "roleName": "unrestricted",
        "showHiddenField": true
    },
    "plate": 1,
    "raster": "1837R0007001",
    "screen": 1,
    "status": 1,
    "studyId": 17,
    "subjectId": 1001,
    "visit": 1
}

3.8.8. Unlock

Release lock on data record with the given set of keys - subject, visit and plate

RequestUNLOCK /studies/:studyNum/records/:subject/:visit/:plate or GET /studies/:studyNum/unlockrecord/:subject/:visit/:plate
Example Response
{
    "subjectId": 99002,
    "plate": 1,
    "status": "OK",
    "visit": 0
}

3.8.9. Lock

Acquire lock on data record with the given set of keys - subject, visit and plate

RequestLOCK /studies/:studyNum/records/:subject/:visit/:plate or GET /studies/:studyNum/lockrecord/:subject/:visit/:plate
Example Response
{
    "subjectId": 99002,
    "plate": 1,
    "status": "OK",
    "visit": 0
}

3.8.10. Add/Update Record

Add or update a database record for the given set of keys - subject, visit and plate

RequestPUT /studies/:study_num/records/:subject/:visit/:plate&utcPUT /studies/:study_num/recordsbyname/:subject/:visit/:plate&utc
Notes

For better performance the following requests can be called before GET/POST/PUT records:

  1. GET /studies/:study_num/setup

  2. GET /studies/:study_num/sites

  3. GET /studies/:study_num/missingmap

  4. GET /studies/:study_num/visitmap

in any order. If error occurs in retrieving setup, sites and visit map, records cannot be retrieved, created or modified. Also retrieve missingmap, querycategorymap and lut/reason if specified in setup.

To POST/PUT record updates, first optionally retrieve the record to get the latest record: GET ${PREFIX}/${VERS}/studies/:study_num/records/:subjectId/:visit/:plate or GET ${PREFIX}/${VERS}/studies/:study_num/recordsbyname/:subjectId/:visit/:plate And then to save the record: POST/PUT ${PREFIX}/${VERS}/studies/:study_num/records/:subjectId/:visit/:plate or POST/PUT ${PREFIX}/${VERS}/studies/:study_num/recordsbyname/:subjectId/:visit/:plate

If the optional parameter utc is provided, the timestamps in the submitted data are interpreted as being in UTC. The database server will then update the time to server time.

3.8.10.1. Record Object

AttributeTypePOST Body ArgumentPUT Body ArgumentDescription
createdstringGeneratedGeneratedThe ISO timestamp at which the record was created
modifiedstringGeneratedGeneratedThe ISO timestamp at which the record was modified
moduleDataarrayOptionalOptionalContains an array of moduleData objects (see Section 3.8.10.2, “moduleData Object”)
subjectIdstringRequiredRequiredSubject identifier
permissionobjectIgnoredIgnoredData and metadata permissions for this record
plateintegerRequiredRequiredPlate number
rasterstringGeneratedGeneratedUnique image identifier for the record
rasterlistarrayIgnoredIgnoredAll images attached to this record
screenintegerGeneratedGeneratedRecord status from the coded values: 1=final, 2=incomplete, 3=pending. This record status repeats the status, excluding 7=delete.
statusintegerRequiredRequiredRecord status from the coded values: 1=final, 2=incomplete, 3=pending, 7=delete.
studyIdintegerRequiredRequiredStudy number
levelintegerGeneratedGeneratedValidation level of record. New records submitted via API are assigned a level of 1, otherwise, their previous value is not changed.
studyIdintegerRequiredRequiredStudy number
visitintegerRequiredRequiredVisit number

3.8.10.2. moduleData Object

AttributeTypePOST Body ArgumentPUT Body ArgumentDescription
fieldDataarrayOptionalOptionalContains an array of fieldData objects (see Section 3.8.10.3, “fieldData Object”)
midintegerRequiredRequiredUnique numeric identifier for a module
moduleIdintegerRequiredRequiredThe ID property of the root module that is referenced by the moduleRef. Provides a link between module references and the original module

3.8.10.3. fieldData Object

AttributeTypePOST Body ArgumentPUT Body ArgumentDescription
aliasstringRequiredRequiredUnique string that identifies the field across the entire study
fidintegerRequiredRequiredUnique numeric identifier for the field
fieldIdintegerRequiredRequiredThe ID property of the parent field that is referenced by the fieldRef. Provides a link between field references and the parent field.
queriesarrayOptionalOptionalJSON array of queries on a particular field. Contains an array of query objects (see Section 3.8.10.4, “query Object”)
reasonsarrayOptionalOptionalJSON array of reasons on a particular field. Contains an array of reason objects (see Section 3.8.10.5, “reason Object”). Any reasons beyond the first are ignored/discarded
valuestringRequiredRequiredValue of field. Can be set to an empty string if no value is available.
missingValuestringOptionalOptionalMissing value for field

3.8.10.4. query Object

AttributeTypePOST Body ArgumentPUT Body ArgumentDescription
categoryintegerRequiredRequiredQuery category code. Legal values are: 1=missing value, 2=illegal value, 3=inconsistent value, 4=illegible value, 5=fax noise, 6=other problem, 21=missing plate, 22=overdue visit, 23=EC missing plate, 30-99=user-defined category
createdstringGeneratedGeneratedISO timestamp indicating when query was created
createdBystringGeneratedGeneratedDFdiscover username of query creator
fieldintegerGeneratedGeneratedThe data field to which the query is attached. This is the data field number - 3
levelintegerGeneratedGeneratedValidation level at which the query was created or last modified
modifiedstringGeneratedGeneratedISO timestamp indicating when query was modified
modifiedBystringGeneratedGeneratedDFdiscover username of query modifier
namestringGeneratedGeneratedDescription of the data field referenced by the query
notestringOptionalOptionalAny additional text needed to describe the problem when it is resolved. Set to blank for a new query
pagestringGeneratedGeneratedPage number of the Query report, on which the query appears, or 0 if it has not yet been written to a report
querystringOptionalOptionalAny additional text needed to clarify the issue to the person who receives the Query report. This is often set to the query category label
repliedstringGeneratedGeneratedISO timestamp indicating when query was replied to
repliedBystringGeneratedGeneratedDFdiscover username who replied to the query
replystringOptionalOptionalThe reply to a query. Should be blank when a new query is created, or when an old query is reset to new
reportstringGeneratedGeneratedThe Query report number that the query was written to. The Query report number is always in the format yymmdd for the year, month, and day the report was created. If the query has not yet been written to a report, the value is 000000
resolvedstringGeneratedGeneratedISO timestamp indicating when query was resolved
repliedBystringGeneratedGeneratedDFdiscover username who resolved the query
siteIdintegerGeneratedGeneratedStudy site identifier
statusintegerRequiredRequiredQuery status from the list of codes: 0=Pending (review), 1=New Query, 2=In report but not sent, 3=Resolved NA, 4=Resolved irrelevant, 5=Resolved corrected, 6=In report and sent, 7=Pending delete
studyIdintegerGeneratedGeneratedStudy number
subjectIdintegerGeneratedGeneratedSubject identifier
typeintegerRequiredRequiredQuery type from the list of codes: 1=Clarification, 2=Correction
useintegerRequiredRequiredQuery usage from the list of codes: 1=external use (these queries are formatted into a Query report and sent to the study site), 2=internal use only
valuestringRequiredRequiredValue of the data field when the query was created
visitintegerGeneratedGeneratedVisit number

3.8.10.5. reason Object

AttributeTypePOST Body ArgumentPUT Body ArgumentDescription
codeintegerOptionalOptionalCoding of the reason for data change
createdstringGeneratedGeneratedISO timestamp indicating when reason was created
createdBystringGeneratedGeneratedDFdiscover username of reason creator
fieldintegerGeneratedGeneratedThe data field to which the reason is attached. This is the data field number - 3
levelintegerGeneratedGeneratedValidation level at which the reason was created or last modified
modifiedstringGeneratedGeneratedISO timestamp indicating when query was modified
modifiedBystringGeneratedGeneratedDFdiscover username of query modifier
plateintegerGeneratedGeneratedPlate number
rasterstringGeneratedGeneratedRaster name is always set to "0000/0000000"
statusintegerRequiredRequiredReason status from the list of codes: 0=Pending (review), 1=approved, 2=rejected, 3=pending (default for new reason), 7=deleted
studyIdintegerGeneratedGeneratedStudy number
textstringRequiredRequiredText that provides the reason for data change
subjectIdintegerGeneratedGeneratedSubject identifier
visitintegerGeneratedGeneratedVisit number

Example 3.4. Example POST Request Body

Content-Type: application/json
{
          "subjectId": 1234,
       "visit": 50,
          "plate": 10,
       "status": 1,
          "moduleData": [
        {
           "mid": "111",
           "instance": "4",
                  "moduleId": "124",
                  "fieldData": [
                      {
                         "fid": "1245",
                         "fieldId": 1482,
                         "alias": "helloworld",
                         "value": "myanswer",
                         "queries": [
                             {
                                        "status": 1,
                                 "category": "22",
                                 "query": "this is a query",
                                 "use": 1,
                                        "type": 1,
                                        "value": "myanswer"
                             }
                         ],
                         "reasons": [
                             {
                                 "status": 3,
                                 "text": "this is a reason for data change"
                             }
                         ]
                      }
                  ]
        }
    ]
}

Example 3.5. Example POST/PUT Response

{
  "created": "2009-04-15T15:08:58",
  "modified": "2016-08-25T21:13:55",
  "subjectId": 1234,
  "plate": 10,
  "status": 1,
  "study": 254,
  "level": 1,
  "visit": 50,
  "problemFields": [
        {
            "fid": 10196,
            "problem": "Query discarded: invalid  query 'type'",
            "valueToSave": "0"
        },
        {
            "fid": 10197,
            "problem": "Invalid Check/Choice code",
            "valueSaved": "0",
            "valueToSave": "9"
        },
        {
            "fid": 10200,
            "problem": "Decimal dropped",
            "valueSaved": "060",
            "valueToSave": "060.999"
        },
        {
            "fid": 10204,
            "problem": "Value too large",
            "valueSaved": "",
            "valueToSave": "0987654"
        },
        {
            "fid": 10213,
            "problem": "Invalid format",
            "valueSaved": "",
            "valueToSave": "05/03"
        }
    ]
}

Example 3.6. Example GET Response

{
  "created": "2016-07-20T15:15:03",
  "modified": "2016-07-20T15:15:03",
  "moduleData": [
    {
      "fieldData": [
        {
          "alias": "SBP1",
          "fid": 10382,
          "fieldId": 10159,
          "queries": [
            {
              "siteId": 99,
              "created": "2016-07-20T15:15:03",
              "createdBy": "datafax",
              "field": 9,
              "modified": "2016-07-20T15:21:55",
              "modifiedBy": "datafax",
              "name": "",
              "note": "",
              "page": "0",
              "subjectId": 99001,
              "plate": 5,
              "category": 1,
              "query": "",
              "raster": "0000/0000000",
              "replied": "",
              "repliedBy": "",
              "reply": "",
              "report": "000000",
              "resolved": "",
              "resolvedBy": "",
              "status": 1,
              "study": 254,
              "type": 1,
              "use": 1,
              "level": 1,
              "value": "",
              "visit": 21
            }
          ],
          "reasons": [
            {
              "code": "",
              "created": "2016-07-20T15:04:50",
              "createdBy": "datafax",
              "field": 9,
              "modified": "2016-07-20T15:04:50",
              "modifiedBy": "datafax",
              "subjectId": 99001,
              "plate": 5,
              "raster": "0000/0000000",
              "status": 1,
              "study": 254,
              "text": "This is another test.",
              "level": 1,
              "visit": 21
            }
          ],
          "missingValue": "",
          "value": "169"
        }
],
  "subjectId": 99001,
  "plate": 5,
  "raster": "1703/0001001",
  "rasterList": [
        {
            "fileName": "",
            "format": "png",
            "page": "1/1",
            "raster": "1526/0001001",
            "arrival": "2015-06-30T18:00:12",
            "sender": "iDataFax Import PDF:datafax",
            "status": "secondary"
        },
        {
            "fileName": "",
            "format": "mp4",
            "page": "1/1",
            "raster": "1633/0001001",
            "arrival": "2016-08-12T18:03:37",
            "sender": "iDataFax Attach DOC:datafax",
            "status": "secondary"
        },
        {
            "fileName": "dicom_dict.pdf",
            "format": "png",
            "page": "1/2",
            "raster": "1703/0001001",
            "arrival": "2017-01-19T19:22:33",
            "sender": "iDataFax Submit PDF:datafax",
            "status": "primary"
        },
        {
            "fileName": "dicom_dict.pdf",
            "format": "png",
            "page": "2/2",
            "raster": "1703/0001002",
            "arrival": "2017-01-19T19:22:33",
            "sender": "iDataFax Submit PDF:datafax",
            "status": "secondary"
        }
    ],
  "screen": 2,
  "status": 2,
  "study": 254,
  "level": 0,
  "visit": 21,
  "permission": {
        "addQuery": true,
        "addReason": true,
        "attachDoc": true,
        "createData": true,
        "deleteData": true,
        "deleteQuery": true,
        "deleteReason": true,
        "modifyData": true,
        "modifyQuery": true,
        "modifyReason": true,
        "replyQuery": true,
        "roleName": "wide open",
        "showHiddenField", true
    }
}

Example 3.7. Example POST/PUT Request Body for recordsbyname (records by field name)

{
  "moduleData": [
        {
            "fieldData": [
                   {
                    "name": "VISDAT",
                    "value": "12-DEC-2018"
                }
                  ],
            "instance": 1,
            "name": "Common"
        }
    ],
    "plate": 1,
    "status": 1,
    "studyId": 17,
    "subjectId": 1001,
    "visit": 1
}

Example 3.8. Example POST/PUT Response for recordsbyname (records by field name)

{
    "created": "2018-09-12T17:32:36",
    "level": 1,
    "modified": "2019-01-04T12:13:40",
    "plate": 1,
    "problemFields": [
        {
            "fid": 11156,
            "mid": 5153,
            "name": "VISDAT",
            "problem": "Value altered",
            "valueSaved": "12-DEC-2018",
            "valueToSave": "12-Dec-2018"
        }
    ],
    "status": 1,
    "studyId": 17,
    "subjectId": 1001,
    "visit": 1
}

Example 3.9. Example GET Response for recordsbyname (records by field name)

{
    "created": "2018-09-12T17:32:36",
    "level": 1,
    "modified": "2019-01-02T12:44:43",
    "moduleData": [
        {
            "fieldData": [
                {
                    "name": "VISITNUM",
                    "value": "001"
                },
                {
                    "name": "SUBJID",
                    "value": "1001"
                },
                {
                    "name": "VISDAT",
                    "reasons": [
                        {
                            "code": "",
                            "created": "2018-12-19T21:46:51",
                            "createdBy": "datafax",
                            "field": 7,
                            "level": 1,
                            "modified": "2018-12-19T21:46:51",
                            "modifiedBy": "datafax",
                            "plate": 1,
                            "raster": "0000/0000000",
                            "status": 1,
                            "studyId": 17,
                            "subjectId": 1001,
                            "text": "Set by DFws Import",
                            "visit": 1
                        }
                    ],
                    "value": "12-DEC-2018"
                },
                {
                    "name": "MHYN",
                    "value": ""
                },
                {
                    "name": "MHSPID",
                    "value": ""
                },
                {
                    "name": "CMYN",
                    "value": ""
                },
                {
                    "name": "CMSPID",
                    "value": ""
                },
                {
                    "name": "AEYN",
                    "value": ""
                },
                {
                    "name": "AESPID",
                    "value": ""
                },
                {
                    "name": "LBYN",
                    "value": ""
                }
            ],
            "instance": 1,
            "name": "Common"
        }
    ],
    "permission": {
        "addQuery": true,
        "addReason": true,
        "approveReason": true,
        "attachDoc": true,
        "createData": true,
        "deleteData": true,
        "deleteQuery": true,
        "deleteReason": true,
        "ecAddQuery": true,
        "ecAddReason": true,
        "ecApproveReason": true,
        "ecDeleteQuery": true,
        "ecModifyQuery": true,
        "modifyData": true,
        "modifyQuery": true,
        "modifyReason": true,
        "replyQuery": true,
        "roleName": "unrestricted",
        "showHiddenField": true
    },
    "plate": 1,
    "raster": "1837R0007001",
    "screen": 1,
    "status": 1,
    "studyId": 17,
    "subjectId": 1001,
    "visit": 1
}

3.9. Document Management

For better performance load study's setup, sites, missingmap and visitmap:

  1. /studies/:study_num/setup

  2. /studies/:study_num/sites

  3. /studies/:study_num/missingmap

  4. /studies/:study_num/visitmap

3.9.1. Get Document

Get the details and data for the requested document having identifier image_id. Note that since the image_id can contain / it must be encoded in the request using %2F. The image stored in data is base64 encoded.

RequestGET /studies/:study_num/documents/:image_id
Example Response
[
    {
    "data": "base64 encoding string...",
    "fileName": "DFlogin.png",
    "format": "png",
    "page": "1/1",
    "raster": "1704/000D001",
    "arrival": "2017-01-22T20:12:36",
    "sender": "DFweb Attach DOC:datafax"
    }
]

3.9.2. Add Document

Upload the document and add it to the record with the specified keys.

RequestPUT /studies/:study_num/documents/:subject/:visit/:plate
PUT body
{
    "fileName": "DFlogin.png",
    "format": "png",
    "page": "1/1",
    "raster": "1704/000G001",
    "arrival": "2017-01-23T10:49:26",
    "sender": "DFweb Attach DOC:datafax",
    "status": "primary"
}

3.10. User / Permission / Role Management

3.10.1. User Profile

Change current user's profile. The user profile information is a subset of the information known for a user account. The profile information can be changed by the user - other information requires admin privileges.

RequestPOST /contactinfo/:user_name
POST body
ArgumentTypeDescription
affiliationstringAffiliation
streetAddressstringStreet Address
citystringCity
statestringState, Province or Region
postalCodestringZip or Postal Code
countrystringCountry
phonestringTelephone Number
faxstringFax Number
Example Response
{
    "message": "OK",
    "status": 200
}

3.10.2. Change Password

Change user's password. Must be the currently logged-in user, or administrator.

RequestPOST /password/:user_name
POST body
ArgumentTypeDescription
passwordstringNew password for the user, base64-url encoded
passExpiryDayaintegerNumber of days until password expiry
Example Response
{
    "passExpiryDays": 180,
    "status": "OK"
}

3.10.3. User Account

Get the details of one or all user account(s). If the ":user_name" modifier is omitted, all user accounts are retrieved.

RequestGET /users/:user_name
Example Response
[
    {
        "administrator": "",
        "affiliation": "DF/Net Research Inc",
        "city": "",
        "country": "",
        "email": "",
        "fax": "",
        "fullName": "Ann Smith",
        "language": 0,
        "passwordExpiry": "2019-06-28",
        "phone": "",
        "postalCode": "",
        "receipt": 2,
        "routerAccess": false,
        "state": "",
        "status": 2,
        "streetAddress": "",
        "userName": "ann"
    }
]

3.10.4. User Roles

Get the roles assigned to a user.

RequestGET /users/:user_name/userroles
Example Response
[
    {
        "instance": 1,
        "subjects": 0,
        "roleId": 6,
        "sites": "*",
        "status": 2,
        "userName": "ann"
    }
]

3.10.5. Study Roles

Get the roles defined for a study.

RequestGET /roles?study=:study_num
Example Response
[
    {
        "DFdiscoverReports": "*",
        "autoLogoutDefault": 0,
        "autoLogoutMaximum": 0,
        "description": "",
        "DFexploreViews": "*",
        "roleId": 1,
        "status": 2,
        "study": 154,
        "studyReports": "*",
        "tasks": "",
        "tools": "*"
    }
]

3.10.6. Role Permissions

Get the role permissions for a role identifier.

RequestGET /roles/:role_id/roleperms
Example Response
[
    {
        "data": "1,2,3,4",
        "getLevels": "*",
        "instance": 1,
        "modifyLevels": "*",
        "plates": "*",
        "query": "1,2,3,4,5",
        "reason": "1,2,3,4",
        "roleId": 1,
        "showBlindedFields": true,
        "showInternalQueries": true,
        "status": 2,
        "visits": "*",
        "writeLevels": "*"
    }
]

3.11. Metrics

3.11.1. License Metrics

Get license usage information for the server.

RequestGET /licensemetrics
Example Response
[
    {
        "adminInUse": 5,
        "adminMaxUsed": 5,
        "adminReserved": 5,
        "purchased": 30,
        "regularInUse": 6,
        "regularMaxUsed": 19,
        "rejected": 0,
        "startSince": "2017-07-07T09:33:40"
    }
]

3.11.2. Feature Metrics

Get feature metrics information for the server.

RequestGET /featuremetrics
Example Response
[
    {
        "feature": "DFWS",
        "inUse": 1,
        "limit": 999,
        "maxUsed": 1,
        "rejected": 0
    },
    {
        "feature": "LS",
        "inUse": 0,
        "limit": 0,
        "maxUsed": 0,
        "rejected": 0
    }
]

Chapter 4. Administering DFws

This chapter guides a system administrator through the process of installing and starting the DFdiscover API server, DFws. The system administrator is expected to have ogood knowledge of administering a UNIX system.

4.1. Installing DFws

DFws is supported on Novell openSUSE version 13.2 and newer, Leap 42.1 and newer, SUSE Tumbleweed and Redhat Enterprise Linux up to version 7.2 or newer. DFws is a 64-bit server application - it installs on the 64-bit versions of any of these Linux distributions. It will not run on 32-bit systems. Other Linux distributions may work, but are unsupported. Debian distributions such as Ubuntu will not work at this time. CentOS and Oracle Linux are clones of RHEL and will work as expected.

Before installing DFws, comnfirm that the file descriptor limit is set to at least 65535. Confirm the current setting with the command:

# ulimit -a

The output will include a setting for open files. Update this value to 65535, by editing the system file, /etc/sysctl.conf. The setting in the file must be set to

fs.file-max=65535

If the setting is not present in the file, add it as a newline to the bottom of the file. If the setting is already defined and set to a higher value, do not change it. Otherwise, update it as indicated. If the file is changed, advise the system of the change with the command:

# sysctl -p

A complete installation requires approximately 370 Mb of free disk space for the software and documentation. The software is installed in /opt/dfws.

To install:

  1. The DFws rpm is available from the DF/Net Research website, www.dfnetresearch.com, specificially software releases support website.

    Download the installation rpm, dfws-5.1-0.x86_64.rpm, to a suitable location on the local server.

  2. Install the downloaded rpm. Change directories to the location where the rpm was downloaded. Assuming that you have downloaded the rpm to the /tmp directory,

    # cd /tmp

    followed by the appropriate command for your server OS type.

    On a RHEL/CentOS server:

    # yum --nogpgcheck install dfws-5.1-0.x86_64.rpm

    On openSUSE, use:

    # zypper --no-gpg-checks install dfws-5.1-0.x86_64.rpm

The software is installed in the /opt/dfws directory.

4.2. Configuration File (dfws.cf)

DFws is configured via properties in the /opt/dfws/dfws.cf file. The file location is fixed. In most cases, the contents will not need to be changed.

A semi-colon at the beginning of a line indicates that the line is a comment and is ignored as a configuration property. The configuration file includes the following:

;DFWS_PORT=4433
;DFWS_SSL_KEY=/opt/dfws/private.key
;DFWS_SSL_CERT=/opt/dfws/local.crt
;DFWS_DATABASE=/opt/dfws/dfws.db
DFWS_LOG_THRESHOLD=3  
DFWS_MAX_SOCKET_THREADS=200
DFWS_MAX_PENDING_CONN=99
DFWS_SESSION_EXPIRY_CHECK=30

The configurable properties are as follows:

Configurable PropertyDescription
DFWS_PORTPort number used to listen for requests. Default value = 4433. If DFws is installed on the same system as your DFdiscover server, do not use 443 as the DFWS_PORT port - this will disrupt the existing client / server communication.
DFWS_SSL_KEYServer SSL private key file path. This should be set once and not changed. Default value is /opt/dfws/private.key.
DFWS_SSL_CERTSSL certificate file path. This should be set once and not changed. Default value is /opt/dfws/local.crt.
DFWS_DATABASESQLite database file path. This should be set once and not changed. Default value is /opt/dfws/dfws.db.
DFWS_LOG_THRESHOLDHow much logging is performed? Options are 1=Critical (attempting to access API using valid API call but using invalid authorization credentials. Or attempting to steal session of another client), 2=Warning (critical errors and warnings that are in result of valid API call (such as Invalid JWT, or if session was forced closed by Admin), 3=Verbose (critical errors, warnings and problems including those where HTTP header or URI or API call are incorrect), 4=Info (all messages). Default is 3.
DFWS_MAX_SOCKET_THREADSThe maximum number of threads that can be allocated to process requests. Increasing the number of threads increases the ability to process more requests in parallel, but each for a shorter time. Suggested range is 20 - 200. Setting this value above the maximum suggested range may cause system instability. Default is 200.
DFWS_MAX_PENDING_CONNWhen the system has allocated the maximum DFWS_MAX_SOCKET_THREADS, pending connections can be held by the operating system. Clients may still be able to connect after the DFws server has reached the maximum. Although DFws will stop accepting new connections, the operating system may still keep them in queue. Suggested range is 30 - 99. Default is 99.
DFWS_SESSION_EXPIRY_CHECK For sessions that do not terminate normally, DFws will recover them after they expire. This value tells DFws how often to check. A shorter interval will recover expired sessions quicker but at the expense of spending more resources checking. Suggested range is 30 - 120 seconds. Default is 30.

If the configuration file is modified while DFws is running, send signal SIGHUP to the running DFws process - the signal is interpreted by DFws as a request to reload the configuration file. This will also reload the DF_DEVELOPERS table records.

To reload the configuration file after it is changed:

  1. determine the process id, pid, of DFws:

    # ps -ax | grep DFws

  2. Send the SIGHUP signal to DFws:

    # kill -HUP pid

4.3. DFws System Database (dfws.db)

While DFws is operational, it manages two tables in its system database. If not already present, the SQLite database DFWS_DATABASE is created with the required tables and default accounts. The database has two tables: one for API client accounts, DF_DEVELOPERS, and one for message logging, DF_LOG.

4.3.1. DF_DEVELOPERS (Table Definition)

API clients must be provided with login credentials (CLIENT_ID, CLIENT_PASS, CLIENT_SECRET and API server Base URI) to use the API.

The DF_DEVELOPERS table contains the following information:

FieldType / SizeDescription
DFDEVIDIntegerNumeric ID (Primary Key)
DFLOGINString (16)Unique login name CLIENT_ID
DFPASSWDString (50)Password CLIENT_PASS
DFSECRETKEYString (50)Secret passcode CLIENT_SECRET
DFADMINIntegerAccount privileges (0=client, 1=admin)
DFSTATUSIntegerAccount status (0 = disabled, 1=enabled)
DFEXPIRYYYYYMMDDHHMMSSTimestamp of account expiry
DFLASTACCESSYYYYMMDDHHMMSSTimestamp of last successful login

The DFws admin must create an account for each new API client by adding records to the DF_DEVELOPERS table. This is done using DFwsadmin. Typically, API clients are defined for one year. After creation, the DFws admin must also maintain the validity of each client by refreshing the expiry date.

The default datafax:passwd account is created by DFws on first launch, and is valid for 24 hours.

4.3.2. DF_LOG (Table Definition)

Configured by the value of the DFWS_LOG_THRESHOLD parameter, DFws logs key events such as unauthorized requests, invalid tokens or invalid requests to the DF_LOG table. The value is a code from the list: 0=Fatal, 1=Critical, 2=Warning, 3=Verbose, 4=Info. The specified value is cumulative so that each number includes itself and all lower numbers.

The DF_LOG table contains the following information:

FieldType / SizeDescription
DFTIMESTAMPYYYYMMDDHHMMSSTimestamp of log entry
DFTYPEIntegerType of log message reported (0=Fatal, 1=Critical, 2=Warning, 3=Verbose, 4=Info)
DFMESSAGEString (150)Text message
DFPEERString (100)IP address of the client system that sent the request
DFURIString (150)URI of the API request
DFMETHODString(10)HTTP Method of the request (GET, POST, LOCK, UNLOCK, DELETE)
DFDEVLOGINString(16)Client ID of the client that made the request
DFUSERString(16)DFdiscover username used to authorize the session
DFSTATUSIntegerHTTP Response status code

DFwsadmin can be used to examine the contents of the table. There is also an API request available, see Log.

4.4. Starting and Stopping DFws

DFws is configured as a systemd service. Use systemctl to start and stop DFws and to enable the daemon to automatically restart on a system reboot. To start DFws:

# systemctl start dfws.service

To stop DFws:

# systemctl stop dfws.service

To enable automated start of DFws on reboot:

# systemctl enable dfws.service

To disable automated start of DFws on reboot:

# systemctl disable dfws.service

To determine the current status of DFws:

# systemctl status dfws.service

A running DFws server will process requests, encrypted using SSL, over the specified DFWS_PORT port. For DFws developers, the base URI to send requests is:

https://{SERVER_HOSTNAME}:{DFWS_PORT}/dfws/v5

4.5. Monitoring DFws Activities

Once DFws is available, your developers will expect that they can access it 24x7. While there is very little that requires active attention, it is important to monitor it on a regular basis. To most effective solition for monitoring DFws is the companion, command-line executable, DFwsadmin.

4.5.1. Using DFwsadmin

DFwsadmin is a command-line application that is installed with DFws. It is available for use by the system super-user on the DFws server.

DFwsadmin offers 3 broad types of interaction and information:

  • Client account addition/deletion/update/review

  • Log review and deletion

  • DFws status

4.5.2. API Client Account Management

API client accounts are managed with the following commands:

usage: DFwsadmin add -client id -pass password -secret key
                   [-status 1|0] [-admin Y|N] [-expiry days]
       DFwsadmin modify id [-client id] [-pass password] [-secret key]
                   [-status 1|0] [-admin Y|N] [-expiry days]
       DFwsadmin delete id
       DFwsadmin show [-decode] [id]

4.5.2.1. Account Format

The API client accounts output has the following format:

CLIENTID|PASSWORD|SECRET|ADMIN|STATUS|EXPIRYDATE|LASTACCESSED
php_client|******|******|Y|Enable|20200102101541|20181231000000
nodejs_client|******|******|N|Disable|20200102092239|20181231000000
testapi|******|******|N|Disable|20200104092321|20181231000000
collectapp|******|******|N|Enable|20200111160239|20190111160239
webapp|******|******|N|Enable|20200111160336|20190111160336 

  • CLIENTID is unique login name for the API client

  • PASSWORD is password for the API client

  • SECRET is secret passcode for the API client to encode JWT tokens

  • ADMIN is administrative privileges setting for the API client

  • STATUS is client account status of being enabled or disabled

  • EXPIRYDATE is the client account expiry date (YYYYMMDDHHMMSS)

  • LASTACCESSED is the timestamp of last successful client log-in (YYYYMMDDHHMMSS)

4.5.3. Log Management

Activity on the DFws server is monitored with these commands:

usage: DFwsadmin showlog [-oldest|newest #] [-peer peer] [-client id]
                   [-status status] [-contain message] [-type log_type]
                   [-from date] [-to date] [-user username]]
       DFwsadmin clearlog [-oldest|newest #] [-peer peer] [-client id]
                   [-status status] [-contain message] [-type log_type]
                   [-from date] [-to date] [-user username]]

4.5.3.1. Log Format

The log output has the following format:

LOGDATE|TYPE|MESSAGE|PEER|URI|METHOD|CLIENTID|USER|STATUS
20190116153756300|3|Invalid API call|::ffff:192.168.4.223|/dfws/v5/logs|GET|||503
20190116153028603|1|Attempt to access session owned by another api-client: dfphp|::ffff:192.168.4.223|/dfws/v5/studies/154/records/1001/0/1|GET|DFweb||401
20190116150951215|1|Invalid authorization token|::ffff:192.168.4.223|/dfws/v5/authorize|POST|dfphp||401

  • LOGDATE format is YYYMMDDHHMMSSZZZ, where ZZZ is milliseconds (zero padded)

  • TYPE is the type of log message reported, from the list 0=Fatal, 1=Critical, 2=Warning, 3=Verbose, 4=Info

  • PEER is the IP address of the client machine that sent the request

  • URI is the request sent by the client

  • METHOD is the HTTP method of the request from the list: GET, POST, LOCK, UNLOCK, or DELETE

  • CLIENTID is the ID of client sending the request

  • USER is DFdiscover username used to authorize the session associated with current request

  • STATUS is HTTP response status code (generally an HTTP error code) returned by API server for the request

4.5.4. System Status

To determine the current status of DFws, use the command:

usage: DFwsadmin apistatus

Output is one of:

DFws API server is not running.

or

DFws API server is running.

Additionally, information about the number of active client sessions is written to the system log in the following format:

Jan 16 10:52:40 dfws dfws.sh[108576]: INFO: Serving 10 active sessions.

Appendix A. Copyrights - Acknowledgments

A.1. External Software Copyrights

DFdiscover software uses several third-party software components as part of its server side and/or client tools.

The copyright information for each is provided below. If you would like to receive source codes of these third-party components, please send us your request at .

A.1.1. DCMTK software package

Copyright Copyright © 1994-2011, OFFIS e.V. All rights reserved.

This software and supporting documentation were developed by

OFFIS e.V.
      R&D Division Health
      Eschereg 2
      26121 OldenburgGermany

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of OFFIS nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

A.1.2. Jansson License

Copyright Copyright © 2009-2014 Petri Lehtinen <petri&digip.org>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

A.1.3. HylaFAX Facsimile Software

Copyright Copyright © 1990-1996 Sam Leffler Copyright Copyright © 1991-1996 Silicon Graphics, Inc. HylaFAX is a trademark of Silicon Graphics, Inc.

Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that (i) the above copyright notices and this permission notice appear in all copies of the software and related documentation, and (ii) the names of Sam Leffler and Silicon Graphics may not be used in any advertising or publicity relating to the software without the specific, prior written permission of Sam Leffler and Silicon Graphics.

THE SOFTWARE IS PROVIDED AS-IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

A.1.4. Mimencode

Copyright Copyright © 1991 Bell Communications Research, Inc. (Bellcore)

Permission to use, copy, modify, and distribute this material for any purpose and without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies, and that the name of Bellcore not be used in advertising or publicity pertaining to this material without the specific, prior written permission of an authorized representative of Bellcore. BELLCORE MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED AS IS, WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.

A.1.5. RSA Data Security, Inc., MD5 message-digest algorithm

Copyright Copyright © 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the RSA Data Security, Inc. MD5 Message-Digest Algorithm in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided as is without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software.

A.1.6. mpack/munpack

Copyright © Copyright 1993,1994 by Carnegie Mellon University All Rights Reserved.

Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Carnegie Mellon University not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Carnegie Mellon University makes no representations about the suitability of this software for any purpose. It is provided as is without express or implied warranty.

CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

A.1.7. TIFF

Copyright Copyright © 1988-1997 Sam Leffler Copyright Copyright © 1991-1997 Silicon Graphics, Inc.

Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that (i) the above copyright notices and this permission notice appear in all copies of the software and related documentation, and (ii) the names of Sam Leffler and Silicon Graphics may not be used in any advertising or publicity relating to the software without the specific, prior written permission of Sam Leffler and Silicon Graphics.

THE SOFTWARE IS PROVIDED AS-IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

A.1.8. PostgreSQL

Copyright © 1996-2014 by the PostgreSQL Global Development Group and is distributed under the terms of the license of the University of California below.

Postgres95 is Copyright © 1994-5 by the Regents of the University of California.

Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.

IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN AS-IS BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

A.1.9. OpenSSL License

Copyright Copyright © 1998-2016 The OpenSSL Project. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  3. All advertising materials mentioning features or use of this software must display the following acknowledgment: This product includes software developed by the OpenSSL Project for use in .the OpenSSL Toolkit. (http://www.openssl.org/)

  4. The names OpenSSL Toolkit and "OpenSSL Project" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact openssl-core@openssl.org.

  5. Products derived from this software may not be called OpenSSL nor may OpenSSL appear in their names without prior written permission of the OpenSSL Project.

  6. Redistributions of any form whatsoever must retain the following acknowledgment: This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org)

THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT AS IS AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This product includes cryptographic software written by Eric Young (). This product includes software written by Tim Hudson ().

A.1.10. Original SSLeay License

Copyright Copyright © 1995-1998 Eric Young () All rights reserved.

This package is an SSL implementation written by Eric Young (). The implementation was written so as to conform with Netscapes SSL.

This library is free for commercial and non-commercial use as long as the following conditions are aheared to. The following conditions apply to all code found in this distribution, be it the RC4, RSA, lhash, DES, etc., code; not just the SSL code. The SSL documentation included with this distribution is covered by the same copyright terms except that the holder is Tim Hudson ().

Copyright remains Eric Young's, and as such any Copyright notices in the code are not to be removed. If this package is used in a product, Eric Young should be given attribution as the author of the parts of the library used. This can be in the form of a textual message at program startup or in documentation (online or textual) provided with the package.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes cryptographic software written by Eric Young () The word cryptographic can be left out if the rouines from the library being used are not cryptographic related :-).

  4. If you include any Windows specific code (or a derivative thereof) from the apps directory (application code) you must include an acknowledgement: This product includes software written by Tim Hudson ()

THIS SOFTWARE IS PROVIDED BY ERIC YOUNG AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The licence and distribution terms for any publically available version or derivative of this code cannot be changed. i.e. this code cannot simply be copied and put under another distribution licence [including the GNU Public Licence.]

A.1.11. gawk

GNU GENERAL PUBLIC LICENSE Version 2, June 1991

http://www.gnu.org/licenses/gpl-2.0.html

Copyright Copyright © 1989, 1991 Free Software Foundation, Inc.


        51 Franklin Street, Fifth Floor
        BostonMA  02110-1301USA

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and modification follow.

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  1. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The Program, below, refers to any such program or work, and a work based on the Program means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term modification.) Each licensee is addressed as you.

    Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

  2. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

    You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

  3. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

    1. You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.

    2. You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.

    3. If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

      Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

      In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

  4. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

    1. Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

    2. Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

    3. Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

      If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

  5. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

  6. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

  7. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

  8. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

    If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

    It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

    This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

  9. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

  10. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

    Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

  11. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY

  12. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  13. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

A.1.12. Ghostscript

The files in the base, psi, lib, toolbin, examples, doc and man directories (folders) and any subdirectories (sub-folders) thereof are part of GPL Ghostscript.

The files in the Resource directory and any subdirectories thereof are also part of GPL Ghostscript, with the explicit exception of the files in the CMap subdirectory (except Identity-UTF16-H, which is part of GPL Ghostscript). The CMap files are copyright Adobe Systems Incorporated and covered by a separate, GPL compatible license.

The files under the jpegxr directory and any subdirectories thereof are distributed under a no cost, open source license granted by the ITU/ISO/IEC but it is not GPL compatible - see jpegxr/COPYRIGHT.txt for details.

GPL Ghostscript is free software; you can redistribute it and/or modify it under the terms the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

GPL Ghostscript is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program so you can know your rights and responsibilities. It should be in a file named doc/COPYING. If not, write to the


    Free Software Foundation, Inc., 59 Temple Place Suite 330BostonMA
    02111-1307USA.
    

GPL Ghostscript contains an implementation of techniques covered by US Patents 5,055,942 and 5,917,614, and corresponding international patents. These patents are licensed for use with GPL Ghostscript under the following grant:

Whereas, Raph Levien (hereinafter Inventor) has obtained patent protection for related technology (hereinafter Patented Technology), Inventor wishes to aid the the GNU free software project in achieving its goals, and Inventor also wishes to increase public awareness of Patented Technology, Inventor hereby grants a fully paid up, nonexclusive, royalty free license to practice the patents listed below (the Patents) if and only if practiced in conjunction with software distributed under the terms of any version of the GNU General Public License as published by the

Free Software Foundation, 59 Temple Place, Suite
        330
BostonMA 02111

Inventor reserves all other rights, including without limitation, licensing for software not distributed under the GNU General Public License.

5055942 Photographic image reproduction device using digital halftoning to para images allowing adjustable coarseness 5917614 Method and apparatus for error diffusion paraing of images with improved smoothness in highlight and shadow regions

A.1.13. MariaDB and FreeTDS

GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 http://www.gnu.org/licenses/lgpl-2.1.html

Copyright Copyright © 1991, 1999


    Free Software Foundation, Inc.
    51 Franklin Street, Fifth FloorBostonMA  02110-1301  USA

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.]

Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.

This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.

When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.

To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.

For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.

We protect your rights with a two-step method:

  1. we copyright the library, and

  2. we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.

To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.

Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.

Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.

When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.

We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.

For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.

In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.

Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.

The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a work based on the library and a work that uses the library. The former contains code derived from the library, whereas the latter must be combined with the library in order to run.

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  1. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called this License). Each licensee is addressed as you.

    A library means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.

    The Library, below, refers to any such software library or work which has been distributed under these terms. A work based on the Library means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term modification.)

    Source code for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.

    Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.

  2. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.

    You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

  3. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

    1. The modified work must itself be a software library.

    2. You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.

    3. You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.

    4. If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)

      These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

      Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.

      In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

  4. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.

    Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.

    This option is useful when you wish to copy part of the code of the Library into a program that is not a library.

  5. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.

    If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.

  6. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.

    However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a work that uses the library. The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.

    When a work that uses the Library uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.

    If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)

    Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.

  7. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.

    You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License.

    Also, you must do one of these things:

    1. Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)

    2. Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that

      1. uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and

      2. will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.

    3. Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.

    4. If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.

    5. Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the work that uses the Library must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

      It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.

    6. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:

      1. Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.

      2. Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.

    7. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

    8. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.

    9. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.

    10. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.

      If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.

      It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

      This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

    11. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

    12. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

      Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.

    13. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

      NO WARRANTY

    14. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

    15. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

A.1.14. QtAV

Copyright © Wang Bin Shanghai University->S3 Graphics->Deepin, Shanghai, China 2013-01-21

**QtAV is free software licensed under the term of LGPL v2.1. The player example is licensed under GPL v3. If you use QtAV or its constituent libraries, you must adhere to the terms of the license in question.**

Rather than repeating the text of the LGPL v2.1, the original text can be found in GNU LESSER GENERAL PUBLIC LICENSE, Version 2.1.

A.1.15. FFmpeg

Most files in FFmpeg are under the GNU Lesser General Public License version 2.1 or later (LGPL v2.1+). Read the file `COPYING.LGPLv2.1` for details. Some other files have MIT/X11/BSD-style licenses. In combination the LGPL v2.1+ applies to FFmpeg.

Rather than repeating the text of the LGPL v2.1, the original text can be found in GNU LESSER GENERAL PUBLIC LICENSE, Version 2.1.

A.1.16. c3.js

The MIT License (MIT) Copyright © 2013 Masayuki Tanaka

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

A.1.17. d3.js

Copyright 2010-2017 Mike Bostock All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.