OpenClinica User Manual/ACRFWithAFile

From Wikibooks, open books for an open world
< OpenClinica User Manual
Jump to: navigation, search

A CRF with a file[edit]

One of the neat things of OpenClinica is the option to "attach" a file to a CRF. This can be useful if in your study X-rays are used. Another example could be pdf's of letters of specialists, etc.

Setting up[edit]

Setting up this facility is very straight-forward: in your CRF-XLS file you add an item for the file. Give ITEM_NAME etc. as appropriate. For both RESPONSE_TYPE (N) and RESPONSE_LABEL (O) fill in "file"; for DATA_TYPE (T) "FILE".


XL of CRF with file


You can upload this XL-file in the normal way and assign it to one or more of your events. When data-entry opens it, a button "Click to upload file" is displayed and the user can browse in the normal way to the file, confirm the upload and that's it.


empty CRF with file



Once the file is uploaded, the CRF changes: now two buttons appear: "Replace" and "Remove". Clicking on the file will open it in the application, associated with this type of file.


complete CRF with file


Where are these files stored?[edit]

All the "normal" data of your study are stored in your PostgreSQL or Oracle database, but not so the uploaded files. They are renamed uniquely and stored in the directory that also contains XL-s, XML-files, etc. This directory is (for Linux) /usr/local/tomcat/openclinica.data/attached_files. If you browse to that directory, you'll see subdirectories with the names of your studies, i.e. the Unique Protocol ID. The consequence of this is that you must not change the Unique Protocol ID after you have uploaded one or more files, because then OpenClinica can not retrieve them anymore! And this is one more reason for including this directory in your backup-procedures.

Limitations and how to get around them[edit]

OpenClinica's code limits the size of a file to upload to a max of 10 MB. The Apache Commons code is used and documentation about how to change the max file size can be found at http://commons.apache.org/fileupload/using.html This would involve editing the source code, more specifically the file FileUploadHelper.java, located under the src/main/java/org/akaza/openclinica/bean/rule directory. Before you do this, always make a backup of the original files. And document your changes, so you can easily repeat them in case you want to install a newer version of OpenClinica (which will overwrite the changed code).