Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

Autogenerate specimens barcode

Introduction

From v5.0, specimen barcodes can be auto-generated.

How to auto-generate specimen barcodes?

OpenSpecimen will auto-generate barcodes if the format is configured at either the system or CP level. There are two barcode tokens to generate the barcode.

Note: The value for the field 'Specimen Barcoding' should be set to 'Enabled' to display the barcode field on the user interface. For more details refer to the 'Enable Barcoding' section of the wiki page.

Token

Description

Example

Token

Description

Example

CP_UID(n)

Unique barcode within the CP.

(n): Optionally specify the number of digits. 

E.g. %CP_UID(8)% will generate 000000001, 000000002, etc.

SYS_UID(n)

Unique identifier across all CP.

(n): Optionally specify the number of digits. 

e.g. %SYS_UID(4)% Barcodes - 0001, 0002, 0003 ...Irrespective of CP.

EVAL(Expr)

User can use any specimen fields in EVAL token to generate Barcodes

Eg: %EVAL(#specimen.label)% – This will create the barcode as label field. You can refer “Advance Token“ wiki page to know which label token you can use in Barcode auto-generation.

 

Configure format at CP level

  1. Navigate to the 'Label Format and Print' settings of the CP

  2. Under 'Show advanced settings', enable specimen barcoding under miscellaneous settings

  3. Specify the format in the 'Barcode Format' field

Configure format at the system level

  1. Go to the home page and click on 'Settings' card

  2. Click on the ‘BioSpecimen’ module and select property ‘Specimen Barcode Format’

  3. Enter the specimen barcode under the 'New Value' field and click on the 'Update' button

 

 

How to auto-generate barcode when Label is manually entered?

This use-case needed when Biobank uses the Pre-Labeled tubes, but they want to generate the barcode autautomatically OpenSpecimen. The same can be achieve using below steps.

Pre-Requisite : System Level Barcoding shoule be enabled

  1. Enabled System Level Barcoding (System → Specimen Barcoding → Enabled)

  2. Go to CP Overview → Label Formats and Print Setting

  3. Edit → Enter Bacoding Format (Keep - Disabled Specimen Barcoding at CP level)

     

How to reset barcode sequences?

When a new centre starts using OpenSpecimen, the legacy data might be in other sources like Excel, different DB etc. Once the legacy data is imported, the sequences of new specimen barcodes need to start from the last number of legacy data. This is achieved using SQLs.

Token

SQL to reset the sequence

 

Token

SQL to reset the sequence

 

SYS_UID(n)

insert into key_seq_generator
  (key_value, key_sequence_id, key_type)
values
('SYS_UID', <max_number>,'SPMN_BARCODE');


Note: If in the table, a record already exists for 'SYS_ID' and 'SPMN_BARCODE' then update the row with key_sequence_id using below SQL.

update 
  key_seq_generator 
set 
  key_sequence_id = <new_value>
where 
  key_type = 'SPMN_BARCODE' and 
  key_value = ‘SYS_UID’;

 

CP_UID(n)

insert into key_seq_generator
(key_value, key_sequence_id, key_type)
values
('CP_UID_<CP_ID>', <max_number>,'SPMN_BARCODE');

Note: If in the table, a record already exists for 'SYS_ID' and 'SPMN_BARCODE' then update the row with key_sequence_id using the below SQL.

update 
  key_seq_generator 
set 
  key_sequence_id = <new_value>
where 
  key_type = 'SPMN_BARCODE' and 
  key_value = 'CP_UID_<CP_ID>';

 

 

Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com