Determining the Workflow(s) to Which a Sample is Assigned
Within a script, you may sometimes need to know to which workflow the current sample is assigned.
However, in Clarity LIMS, the XML payload that relates to the sample does not provide information about the workflow associations of the sample.
For example, consider a sample (artifact), picked at random, from a demo system:
It is evident that this XML payload does not provide the workflow information.
This following solution shows how to use the Clarity LIMS API to determine the association of a sample to one or more workflows.
Solution
The XML payload that corresponds to each sample artifact contains a link to the related submitted sample (or samples, if it is a pooled artifact).
Follow that link to see what it yields:
The XML corresponding to the submitted sample has a link to an artifact. This artifact is special for several reasons:
It is known as the 'root artifact'.
It has an unusual LIMS ID for an artifact. LIMS IDs start with '2-' for Analytes, and '92-' for ResultFiles. This one appears to be derived from the LIMS ID of the sample: KUZ407A145PA1
A root artifact is created 'behind the scenes' whenever a submitted sample is created in the system.
The sample history in Clarity LIMS makes it appear as if the first step in the workflow is run on the submitted sample. However, it is actually the root artifact that is the input to the first process.
When a submitted sample is assigned to the workflow, it is the root artifact that is assigned to that workflow.
Therefore, if gathering the XML payload corresponding to the root artifact, you should see the workflow assignment:
The key element is as follows.
The name of the artifact-group (Sanger Sequencing) should match the name of the workflow in which the root artifact (and by inference, artifacts derived from the root artifact) is assigned.
Troubleshooting
If you find that the artifact-group node is missing from some of the root artifacts, there are several potential reasons:
The workflow has been completed, causing the root artifact to be unassigned from the workflow.
The derived samples / artifacts have been removed from the workflow intentionally, because of a sample processing issue.
An API script has intentionally removed the derived samples / artifacts from the workflow.
The assigned workflow has been marked as 'Archived'.
Last updated