In OpenSpecimen, we have features like auto-allocation, data validation (edit checks), etc. Some of these are also supported in workflows.
Container Auto-allocation
You must choose between the two allocation strategies and set them at the protocol level to use auto allocation in workflows. Refer to the wiki page for more details.
Once the auto-allocation is set up at the CP level, you need to add the below code in your workflow JSON:
enableAutoContainerAllocation: true,
Below is a JS file for reference:
Group assigner
You can add a group assigner within your workflow for respective tasks.
Example 1: User scans a total number of 4 specimen tubes (1 is SST, and 3 are EDTA). EDTA tubes should go for ficoll isolation, and SST should go for clotting.
Code to be added within workflow JSON:
{
"type" : "group-assigner",
"name" : "task-assigner-1",
"title" : "Select Next Task",
"shortDescription" : "Assign tubes for next tasks",
"activityStatus" : "Active",
"longDescription" : "Points to consider when receiving specimens: <ul> <li> Send SST tubes for clotting </li> </ul><ul> <li> Send EDTA tubes for ficoll isolation </li> </ul><ul> <li> Send Citrate tubes for seperating out plasma and buffy coat </li> </ul>",
"jsonConfig" : false,
"starterTask" : false,
"optional" : false,
"inputs" : [ {
"sourceTask" : {
"type" : "update-specimens",
"name" : "receive-specimens",
"title" : "Receive Specimens",
"shortDescription" : "Receive the whole blood tubes that have to be processed",
"activityStatus" : "Active"
},
"sourceKey" : null
} ],
"userGroups" : [ ]
}
Below is the JS file:
Example 2: If the anatomic site of fresh tissue is the ‘Thyroid gland', it should go for the pool specimens step, and if the anatomic site is the 'Parathyroid gland’, it should go for the fixation step.
Code to be added within workflow JSON:
{
"type" : "group-assigner",
"name" : "task-assigner",
"title" : "Next Task Assigner",
"shortDescription" : "Assign next task to tissue samples",
"activityStatus" : "Active",
"longDescription" : "Decide if you want to pool the fresh tissue specimens and then process them further or directly start processing the samples as is.",
"jsonConfig" : false,
"starterTask" : false,
"optional" : false,
"inputs" : [ {
"sourceTask" : {
"type" : "update-specimens",
"name" : "receive-specimens",
"title" : "Obtain a fresh specimen",
"shortDescription" : "Obtaining fresh specimens from collection centers",
"activityStatus" : "Active"
},
"sourceKey" : null
} ],
"userGroups" : [ ]
}
Below is the JS file:
Edit Checks (Data Validation)
Data validation is used to enter high-quality data. This ensures that the user does not violate any data entry rules while entering the data. Refer to the wiki page for more details.
Use cases Part 1:
Specimen received quality should be acceptable.
Derived plasma specimens should be at least 10 ml.
Example Code 1:
If you proceed without fixing the deviations, the system adds a deviation event for the specimens.
You need to specify the code within the CP workflow. No need to change anything in the workflow JSON file.
Below is the example CP workflow:
Use cases Part 2:
Centrifugation is performed on the parent specimen multiple times, and the conditions should be as follows:
1st Centrifugation: Duration should be 10, and gForce should be 2000
2nd Centrifugation: Duration should be 20, and gForce should be 1000
3rd Centrifugation: Duration should be 20, and gForce should be 250
Example Code 2:
#SpunEvent['recordId'] != #$inputFormRecordId ensures that the existing spun event on parent specimen does not clash with the new spun events. Ensure to add this code from the 2nd spun event onwards.
Pool Specimens Task
Pooling is the process of merging one or more specimens of the same patient or multiple patients into a single specimen. Refer to the wiki page for more details.
There can be two use cases for pooling of specimens at labs:
Use case 1: If there are 4 tubes (A, B, C, D), they are pooled together, and the original tubes are discarded. For this use case, add the below code in your JS file:
Use case 2: If there are 4 tubes (A, B, C, D), tubes A and B are pooled together, some part of B is pooled with tube C, some part of C is pooled with tube D, and so on. In this case, a specimen from a single tube is used in more than one pool. For this use case, add the below code in your JS file:
To add a pool specimens task in your workflow, add the below code in your workflow.json file:
Below is the JS file for this task:
Default specimens in pool step (v10.0)
Based on your lab requirements, you can default which specimens are to be pooled by configuring some rules. Manually selecting the specimens every time can introduce errors.
Use case 1: Four Na-Heparin tubes are collected per participant, always. In this task, you pool the first two tubes and last two tubes together.
Example JSON:
Use case 2: Two Na-Heparin tubes are collected per participant, always. In this task, you pool the tubes of the same participant together.
Example JSON:
Workflow Manifest
Manifests are PDF files that can be downloaded or printed while processing specimens or after specimen collection. Refer to the wiki page for more details.
Create an HTML template based on your requirements in terms of which fields you want to display, the width of the columns, font size, etc.
Navigate to 'Workflows'.
On the workflows list view page, click on the inverted arrow as shown below:
Click on 'Import Manifest Template' and import the HTML file:
Example HTML template:
Example Workflow Manifest:
Configure participant fields within tasks (v10.0)
Use case: Within a batch, there can be specimens from multiple participants. Just having a PPID for each task is not helpful, as it is just a unique identifier that the lab users do not understand. Having PHI data like D.O.B and Participant’s Name on each task will help them in distinguishing which patient's specimen they are dealing with and help in the reduction of errors. To configure participant fields in your workflow, refer to the JavaScript files of the tasks on this wiki page (Example 6).
Form View Mode (v10.1)
When you start a batch, all the specimens in the batch might have the same values for certain fields within the form or update tasks. For example, if you have four whole blood tubes that undergo a wash step, the dilution volume and the date and time for all tubes will be constant. In such cases, it is easier if you can do it in a form mode where you need to enter the data only once, which will then copy the same values on all specimens within the task.
Screenshot of the task in table mode:
Screenshot of the task in form mode:
To configure the form mode, you need to add one of the below codes in your JS files:
By default, only editable fields are displayed in the form view. However, if you wish to view any fields that are in the “span“ type within the form, you have to add the below code for such fields:
"showInForm": true
Example JS file (refer to specimenLabel field):
Remove Queued Specimens
If you have a similar set of rules for multiple workflows, a specimen gets added to the waiting queue multiple times for each workflow. When you pick the specimen from the waiting queue to start a new batch, you would want that specimen to be removed from the queue and no longer be used for other workflows.