Summary

This article covers automated imports.


Curl must be available on the users path. Type the command:

whereis curl


It should return a result like:


curl: /usr/bin/curl


Note: curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. You can download it here: http://curl.haxx.se/download.html 



Script

Click here to download the following script. You can also copy-paste it directly into a text editor.

#!/bin/bash
FILENAME=$1
STORE_COOKIES_OPTIONS="-o /dev/null -c cookies.txt"
READ_STORE_COOKIES_OPTIONS="-o /dev/null -b cookies.txt -c cookies.txt"
WEB_HOST_URL=https://secure.datatrak.net/clickFind/
WEB_USERNAME=usernameHere
WEB_PASSWORD=passwordHere
TOOLID=toolIdHere
curl $STORE_COOKIES_OPTIONS -d "textUserName=${WEB_USERNAME}&textPassword=${WEB_PASSWORD}&loginButton=Sign In" $WEB_HOST_URL'LoginPage'
curl $READ_STORE_COOKIES_OPTIONS "${WEB_HOST_URL}Desktop"
curl $READ_STORE_COOKIES_OPTIONS -d "toolID=${TOOLID}" "${WEB_HOST_URL}DataCollectorServlet"
curl $READ_STORE_COOKIES_OPTIONS -F "action=importData" -F "file=@${FILENAME}" "${WEB_HOST_URL}DataCollectorServlet"


The shell script must be edited to provide correct credentials/environment before it can be used.
The variable WEB_HOST_URL must be set to the correct web address for the environment you wish to use. Here are some possible options:

The variables WEB_USERNAME and WEB_PASSWORD must be set with the username and password credentials for the login doing the importing.

Currently the login must have only access to only the import role for the particular site used.

The variable TOOLID must be set to the tool id for the site where the import should occur. This can be found looking at the link to the site from the eClinical desktop. The link will be of the form

Where XXXXX is the tool id needed.

Setup

The cron job must be scheduled to call the script passing in the import file as the first parameter.

A sample cron tab would look like this:

0 0 * * * eclin /home/eclin/bin/submitLabImport.sh /mnt/dataStore/labFile.csv



Need more help?

Please visit the Fountayn Contact Information page.