Process of Applying a QC Mask to a Sample Group
This topic explains the Add QC To Sample Group algorithm used to apply a QC mask to a sample group.
Examples of Applying a QC Mask to a Sample Group with one Common QC Mask
This algorithm is used when appending or overwriting QC samples for a production or creating QC samples when creating a laboratory/subcontract batch job.
The same algorithm is used to test a QC mask during QC mask configuration: Preview a QC Mask. Although, of course when a QC mask is tested, it only does it for one sample stream, but when a QC mask is used to add QC samples to a job, it iterates through all the job schemes that require QC samples to be created and performs propagation of QC samples to sequel job schemes and images linked job schemes.
The process can essentially be broken down thus:
- Process the sample group by applying cross-rack QC mask members, to add QC samples to the sample group, and produce one rack of output samples.
- Using the one rack of output samples from step 1 as the sample group now, process the sample group by applying in-rack QC mask members, to add QC samples to the sample group, obeying rack boundaries based upon the applied rack size, to output multiple racks of output samples (as many as are required).
Cross-rack and in-rack processing use the same algorithm to build the racks of output samples, however, whilst in-rack processing obeys rack boundaries based upon the applied rack size, cross-rack processing presumes a very large rack size (9999) so that rack boundaries never come into play.
- Start with no output rack/s of samples.
- Whilst there are samples in the input sample stream to be placed in a rack:
- Create a new rack if this is the first time through or if the current rack is full (for cross-rack it is never full).
- The rack size is determined from the container type's Default Number of Containers for the container type denoted by the QC mask's Container Type Code, and if none is defined then 50 is used.
- First place standard and blank QC samples in the rack:
Process each cross-rack/in-rack blank and standard placement, in relative QC mask member sequence, where the QC mask member's Selection is greater than 0, that is, its position within the rack is fixed. Assign rack slot/s to place the required the QC mask member's Number to Apply blank/standard QC sample/s, but do not place any that attempt to be placed after the end of the rack. The QC mask member's Per Block is used to loop through the cyclic placement, up to the size of the rack.
Process each cross-rack/in-rack blank and standard placement, in relative QC mask member sequence, where the QC Mask member's Selection is 0, that is, its position in the rack is randomly selected from those rack slots that do not already contain a fixed or random blank or standard placement, ensuring that a rack slot is selected such that the required number of duplicate, replicate or spike QC samples, denoted by the QC mask member's Number to Apply, fit onto the rack. The QC mask member's Per Block is used to loop through the cyclic placement, up to the size of the rack.
The unknown, duplicate, replicate and spike QC samples are flowed into the rack around the blanks and standards already placed in the rack, ensuring that all duplicates, replicates and spike QC samples are in the same rack as the sample from which they were created. The 'Whilst there are Rack slots available' step ensures this.
- Determine the number of rack slots taken up by blank and standard QC samples.
- Determine the number of available rack slots that can be taken up by unknown, duplicate, replicate and spike QC samples.
- For each cross-rack/in-rack duplicate, replicate and spike selection:
Definition: A block, of size denoted by the QC mask member's Per Block, is comprised of samples from the input sample stream that have their sample's Primary Analytical Type matching the QC mask member's Selection Type.
Reset the block counter to keep track of the number of samples in the current block so that when the QC mask member's Minimum is reached, if there is room on the rack, then a rack slot can be assigned to place the required number of duplicate, replicate or spike QC samples, denoted by the QC mask member's Number to Apply, and once all samples in the block are known, then the actual sample to be duplicated, replicated or spiked can be selected from the samples within the block.
- Whilst there are rack slots available:
- Place the next sample from the input sample stream in the rack and reduce the number of available rack slots by one.
- For each cross-rack/in-rack duplicate, replicate and spike selection, add one to the block counter if the sample's Analytical Type matches the QC mask member's Selection Type.
- Process each cross-rack/in-rack duplicate, replicate and spike selection, in relative QC mask member sequence, to determine whether requirements are met to assign duplicate, replicate and spike QC sample/s to the rack:
If the block counter matches the QC mask member's Minimum, or we have placed the last sample from the input sample stream in the rack, and there is room in the rack, then assign rack slot/s to place the required duplicate, replicate or spike QC samples, denoted by the QC mask member's Number to Apply. If QC mask member's Placement is Immediately After, then assign the next rack slot/s to new duplicate, replicate or spike QC sample/s, and reduce the number of available rack slots by the QC mask member's Number to Apply.
If QC Mask member's Placement is End, then assign a rack slot at the end of the rack—though the actual rack slot at the end is not known yet as there may be other duplicate, replicate or spike QC sample/s to be placed on the end of the rack after these ones.
If the block counter matches the QC mask member's Per Block, then the actual sample to be duplicated, replicated or spiked is selected from the samples within the current block. If the QC mask member's Selection is greater than 0, then select that sample from the specific position in the block. If the QC mask member's Selection is 0, then select a sample at random from the block. Note that the same sample may be randomly selected when processing another QC mask member placement.
- Create a new rack if this is the first time through or if the current rack is full (for cross-rack it is never full).
- Repeat step 2: Whilst there are samples in the input sample stream to be placed in a rack.
- For the last rack:
- For each cross-rack/in-rack blank and standard placement:
In the last placement block, if the number of unknown, duplicate, replicate or spike QC samples is less than the QC mask member's Minimum, then remove those blank or standard QC samples.
- If there are any empty rack slots and filled rack slots after them, then shuffle the samples back to remove any gaps.
- For each cross-rack/in-rack blank and standard placement:
