Humans Can't Read Barcodes: a simple tool for managing shipment of COVID-19 vaccine clinical trial samples
Tags: javascript, covid
Published: 2020-12-09 21:19:15

The clinical research laboratory I currently work in is serving as an intermediary in the AstraZeneca/Oxford COVID-19 vaccine trial. As participants are enrolled and throughout the trial, samples are collected to monitor their health and determine the efficacy of the vaccine. My lab is the first stop these samples make in their journey to a central laboratory where they are tested. In the case of my lab and this study, that central lab is Covance Central Laboratory. 

In order to maintain participant confidentiality and the blinded nature of such a study, the samples are basically only labeled with a barcode (and some tiny numbers and letters).

Sample Tube Barcode:
![Sample Tube Barcode](https://astrazeneca-covid19-shipping-manifest.s3.amazonaws.com/img/az-c-m_tube.PNG)

This barcode corresponds to an accompanying requisition (which is basically an order or request for testing) which has test information and a corresponding barcode (and 10 digit number). 

Requisition Paperwork Barcode:
![Requisition Barcode](https://astrazeneca-covid19-shipping-manifest.s3.amazonaws.com/img/az-c-m_req.PNG)
*note that the pictured sample and requisition don't match. Don't @ me.  


There can be multiple samples connected to a requisition such that requisition `1234567890` might have samples with barcodes `123456789001`, `12345678902`, etc. 

Once the samples arrive in the lab they need to be processed and stored in various locations based on the sample tube sizes and storage temperatures (thus separated from their requisitions) until they are shipped based on the shipping schedule. We often have upwards of 20 participants per day with multiple samples. 

Because there is NO room for error in clinical trials, we do a LOT of work making sure that a shipment contains all the expected samples with matched requisitions and NO unmatched samples or requisitions. This is complicated by the sample tubes being labeled with barcodes (which humans don’t typically read) and long strings of numbers (which I find equally hard to read). 

To facilitate the speed and accuracy of setting up these shipments, I built a simple web application using just HTML and JavaScript to offload this work. After all, computers (when paired with a barcode reader) are excellent at reading barcodes and are equally excellent at comparing long strings of numbers. 

---

### Basic Application Requirements

- Parse inputs to remove non-numbers (some (my) barcode readers can add characters to the number strings)
- Parse inputs to determine whether item being scanned is a requisition (10-digits) or a sample (12-digits).
- Match samples and requisitions that belong together. 
- Allow user to identify un-matched samples and requisitions. 
- Allow user to remove samples and requisitions.

### The Result

The live site can be found [HERE](https://jakobondrey.com/projects/AstraZeneca-Covance-Manifest/index.html)
![Whole page](https://jakobondrey.com/projects/AstraZeneca-Covance-Manifest/img/az-c-m_main.PNG)

The application is broken down into two main parts: input and output. 

#### Input 

![Input](https://jakobondrey.com/projects/AstraZeneca-Covance-Manifest/img/az-c-m_input.PNG)

The input section allows the user to enter their shipment information in the top fields in the event they want to save a copy of the manifest for their records. Nothing is done with the data entered in those boxes. 

Underneath the shipment fields are a box to ADD or REMOVE whatever item is being scanned. It removes all non-numeric characters from the input using `string = string.replace(/\D+/g, '');` and then checks the length to determine whether it is the barcode from the requisition paperwork (10), the specimen tube(12), or invalid. 

It then attempts to find a match and populates the output based on whether there is a match. 

#### Output

When valid samples are scanned in they are added to one of two dictionaries and those dictionaries are displayed in the different columns. 

![Example Output](https://jakobondrey.com/projects/AstraZeneca-Covance-Manifest/img/az-c-m_output1.PNG)

In the example above, there have been three requisitions scanned and three samples scanned. Two of the samples have matched up with their requisitions, and one sample has not been matched to a requisition. The un-matched sample (`999999999999`) was placed in the 'Unmatched Specs' column while it waits for its paperwork to be found and scanned in. There is also a requisition (`2345678901`) that doesn't have a matched sample. (someone better go digging in the -80 freezer..)

If the user discovers their missing paperwork for sample `999999999999` and scans it in, it will be matched with the sample, added to the matched column, and removed from the unmatched column as shown below.
![Whole page](https://jakobondrey.com/projects/AstraZeneca-Covance-Manifest/img/az-c-m_output2.PNG)

Additionally, if the user finds they scanned a requisition in error (they shipped that one last week and made an extra copy of the paperwork) they can scan the extra paperwork in the REMOVE box and remove it from the lists. 

Tada!
![Whole page](https://jakobondrey.com/projects/AstraZeneca-Covance-Manifest/img/az-c-m_output3.PNG)

This will result in a perfectly matched manifest that is ready to print, and the user will know that everything they have scanned in is ready to ship. 

### Conclusion

This little project was originally written by me in VBA and running on Excel sheets for use in my lab. That setup had the benefit of being able to save the details of each shipment in a single log. However, Because of the time it saved our lab on a weekly basis (from 2 people for 1-2 hours to 1 person for 15 minutes) I wanted to rebuild it to share with anyone else who would like to save time. 

If you know anyone who you think could use it please share it with them. If you use it and would like a feature added, open up an [issue](https://github.com/misterjacko/AstraZeneca-Covance-Manifest-Gen/issues) in the [github repo](https://github.com/misterjacko/AstraZeneca-Covance-Manifest-Gen).