Attachment Handlers |
Content |
|||||||||||||||||||
|
Introduction |
|
|
An Attachment Handler provides a simple means to allow files that are included as attachments to be parsed and processed. As an example, Attachment Handlers act upon files collected during a data capture when using the SDMS module. The first step in creating an Attachment Handler is deciding how you will compile your code. One option to extract, transform, and load your data is to use Talend®. Talend offers an open source graphical tool for building and compiling your code. Almost no programming knowledge is required. A second option is to write your own Handler Class in Java extending LabVantage's BaseAttachmentHandler public class using the tool of your choice. You will need to make sure you compile your code before adding it to LabVantage. Once your code is compiled either through Talend or through some other means, you can add it to the classpath of your server's Java virtual machine. If your Handler class or Talend job are outside of LIMS (not included in the classpath) then you can choose to attach the JAR file and its related library JARs to the Attachment Handler. These Java libraries will be dynamically loaded at run time and cached internally using a specialized class loader. This class loader is spawned from our main class loader. This means it has access to the entire public and private API. It is built as a top down class loader which means it puts priority on the library files loaded more recently. For example, if your handler requires a different POI package than what is in the LabVantage classpath, you can load that POI here and your Handler will use that while the rest of the application will continue using another version. This prevents collisions within the code library. As of LabVantage 8.5, our development team recommends Talend Open Studio version 7.2 for Data Integration. Please see: https://www.talend.com/products/data-integration/data-integration-open-studio/ A Handler takes one or more attachments and can:
|
The Attachment Handlers List Page |
|
|
Navigate to Lab Admin > SDMS > Attachment Handlers
Use the list page to add or edit your Handlers.
Button | Description |
Add | Add an Attachment Handler |
Edit | Edit the selected record to include viewing attachments, executions and other operations described below. |
List Control | Allows a selected Attachment Handler to be deleted, viewed or copied. |
Other Tasks | Export, show, or hide records. |
When an Attachment Handler is processed it creates an execution record. You can view these executions on either the data capture by the data capture maintenance page or the data capture dashboard.
Adding or Editing an Attachment Handler |
|
|
On the Attachment Handler Maintenance you can configure a new handler. The Type drop down allows you to pick between a Handler Class (a class built in Java which extends BaseAttachmentHandler) or a Talend Job (a class sitting inside a Talend library file). The Handler Class input field is the full package name to the class whether it is the Talend Job main run class or the Handler class. Uploading your class files to the Handler Library tab will dynamically load your code into the Attachment Handler. To attach files of this type may require that you adjust your security settings in the Security Policy. The default value for "Enable On Attachment Handlers" is No. In such a case, the Handler Libraries tab will not be visible.
You can upload example files on the Example Files detail tab which are the typical files your handler will process. Once you have examples defined, you can then use the Test Handler button which will take the example file, create an ad-hoc data capture, attach the example file to it and process it with your Handler. It will then update the data capture with any run information and execution details.
Setup Variables for Attachment Operations |
In the attachment Handler, you can define setup variables with default values. These will be used during the processing. In the Attachment Handler main page, under Setup Variables tab, use add/delete/move up/down buttons to manage setup variables as shown below.
Implementing an Attachment Handler |
|
|
Attachment Handlers are linked to Instrument Models. Navigate to Lab Admin > Certifications & Resources > Instrument Models. Edit your Instrument Model. You can add your Attachment Handler using the Attachment Operations detail tab. Any operations and any set up variables defined at the model can be over-ridden or added to when the model is linked to an Instrument.
Click the ellipsis under Properties to adjust the Setup Variables for this model as needed.
The Reset button in this dialog allows us to reset the variable back to either
Asynchronous Processing Groups |
Included in the configuration of an Attachment Operation is the option to execute the Handler in asynchronous mode. In this mode, you can also elect to group items. Let's consider an example. If the system is processing a large PDF data file into an XLS document and then parsing that XLS document into LIMS, I will want it to run asynchronously. I need to have the XLS document creation done before it can be parsed into LIMS. Therefore I would add both operations into the same processing group and have the PDF parsing first. In other words, if step two does not wait until step one is complete, you are likely to encounter errors.
Asynchronous indicates that the Operation is to be added to the Automation Service todo list. It will be processed the next time the service processes items on the list. Asynchronous Group allows the system to execute a set of operations in series. The operations in the same group will be processed on the todo list in the order that you have them listed in the operations (usersequence). By default, this will be unchecked (syncronousflag will be Y). The operation will start immediately as soon as the data capture state is either "Captured" or "Ready". See Data Captures for an explaination of these statuses.
Talend is a trademark of Talend, Inc.