You can print labels for Collected Specimens, Containers, and Distributed Specimens. This is achieved using the Print Rules features under the “Extras” tab.
Print Rule
A Print Rule defines the conditions under which a label is printed. For example:
DNA label for 1 ml tube
DNA label for 10 ml tube
Frozen tissue labels
You can configure multiple rules, and the system will print using the first matching rule.
Printers Supported
There is no restriction on the type of printer used as long as the printer software supports it. OpenSpecimen interfaces with the printers via external software like BarTender, NiceLabel, etc. OpenSpecimen will pass the data needed for printing, and printing software will automatically pick files and print the labels.
Choice of Printer in Print Rule
From V.9.x, we have made an important update that will add the printer's name to the generated CSV file. Admins can set the default printer on two levels, viz—user profile and within the print rule. The user profile setting takes precedence over the print rule specified printer name i.e. when the user profile setting is empty, the print rule printer will be used. Otherwise, it is always the user profile setting printer.
How to Print?
Log in as a Super Administrator user.
Click on ‘Extras’ → ‘Print Rules’.
You can create print rules for 'Specimen', 'Distribution', and 'Container'. Click on the ‘Create’ button from the print rules list page.
Print Rule Common Fields
Field
Description
Example Values
Field
Description
Example Values
Users
Login name of OpenSpecimen user who will be printing labels.
The default value is *, meaning any user.
John Doe, Mary Thomas, etc.
IP Range
Specifies IP address range, using CIDR notation, of workstations of users who will be issuing print label requests.
The default value is *, meaning any workstation
Example 1: 192.168.2.0/24 matches IPv4 addresses in the range 192.168.2.0 to 192.168.2.255
Example 2: 2001:db8::/48 matches IPv6 addresses in range 2001:db8:0:0:0:0:0:0 to 2001:db8:ffff:ffff:ffff:ffff:ffff:ffff
Label Type
Type of label depending on how and where it will be used, e.g., Cap, Slide. If specified, the value of this field is written to both the database table and the cmd file. The printer software can read this type and print labels accordingly.
The default value is *, meaning don't care.
Cap, Slide, or any other value that is used to denote the type of printing the printer software needs to carry out
Label Design
The name of the design template to use for printing labels. This value is of interest to printer software in deciding how to label content should be arranged and printed.
The default value is *, meaning don't care
Example: Cryovial Cap Label
Name of design template configured in the printer software. In this instance, the name specifies label design suitable for printing labels to be used for cryovial caps
Label Tokens
Specifies a list of attribute names of participants, visits, or specimens records that need to be printed on labels. For a detailed list of available tokens, please refer below table
'Label, Specimen Type, Created on' will instruct OpenSpecimen to output values of the following attributes of specimen record - label, specimen type, and created on the date
Printer
Name of the printer. The printer name and their network addresses are configured in printer software to direct the label printing to the appropriate printer
rosy, daisy
rosy and daisy are symbolic names that can be configured in printer software to send requests to printers configured at IP address 192.168.2.110 and 192.168.2.220, respectively
Output Directory
The absolute path of directory on the local filesystem that OpenSpecimen uses to generate cmd files. This should be a shared directory that is accessible to OpenSpecimen as well as printer software (like Bartender or Nice Label)
The default value is * indicating do not generate cmd files
E:/Printer/OpenSpecimenPrintedFiles/
File Format
The format of the data contained in the printed file. Supported values are "CMD", CMD (Quoted Values), and "CSV".
Current command-line formats are tested with Bartender and Nice Label software. If you use some other software and face any issue, please let us know.
File Line Ending
Check LF and CRLF if the file contains the selected character at the end of the line.
File extension
The file is created with a selected extension.
txt/cmd
Advanced Print Rules
You can configure any field as a print token, including custom fields. Previously, you could only select specific tokens to choose from the dropdown.
Here you can use the new ‘eval(…)’ method to create custom print-tokens.
Syntax:
eval(displayLabel, expr);
For usage of the “eval” function, refer to examples on the below pages:
Download Labels Print File
Sometimes you might be unable to integrate OpenSpecimen with the printer due to network issues. E.g., in a multi-site study where the printers are in a collection site outside the VPN. In such cases, you can download the labels print file and upload it manually to the printing software like Bartender.
This is also useful to check that the print rules are correctly configured during testing. This avoids having the testers log in to the server VM to check the content of the print files.
At System Level
Log in as a Super Admin.
Navigate to 'Settings'.
Search for the property 'Download Labels Print File' under 'Administrative'.
Select the option 'Enabled' for the 'New Value' field and click on 'Update'.
Navigate to participant/visit/specimen overview pages and click on 'Print'. The print integration file will be downloaded in CSV format.
A downloaded print CSV file will have one row per specimen, and each row will contain the data to be printed on the specimen labels/stickers based on the print rule set. See attached example:
If the setting is enabled at the system level, it will apply to all CPs across the system, and all users will be able to download the print files CSV.
At User Level
Navigate to the 'Users' module.
Select a user → Edit.
Enable the 'Download Labels Print File' setting for that user:
If the setting is disabled at the system level and enabled at the user level, only that user can download the print files CSV.
Download Generated Labels for Specific Print Rule
From V.9.x, you have the option to download the generated print files from within UI.
Admin users can clear/download all the files from the print rule without accessing the server VM separately.
FAQs
In what order are the print rules applied?
The order of probing rules is the reverse order of their creation. The first matching rule is picked up for printing the label.