Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

Expand

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

TokenDescriptionExample
CP_UID(n)

Unique barcode within the CP.

(n): Optionally specify the number of digits. 

E.g. CP%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%SYS_UID(4) Barcodes % Barcodes - 0001, 0002, 0003 ...Irrespective of CP.


...

How to reset barcode sequences?

When a new center 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.

Expand
titleClick here to view SQLs...


TokenSQL to reset 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 below sql.

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


...