Standardizing Sample Naming via the API
A lab may receive samples submitted from various sources. This can pose a problem with regards to sample names.There may be duplicate sample names, and/or various name formats, all of which make it hard for lab scientists to recognize a sample.
Clarity LIMS programmers often rename all incoming samples to a certain naming convention.
This section provides an example to address this problem.
Recommendations
|
•
|
When accepting a project and its samples, the receiving lab scientist runs a Clarity LIMS step named Receive Samples. |
|
•
|
The underlying Receive Samples process type/master step is configured with analyte (sample) inputs and no analyte outputs. |
|
•
|
A shared result file output is configured to capture logging from the script. |
|
•
|
The sample name could be a derivative of the Sample LIMSID with a prefix: |
|
–
|
Because the LIMSID is guaranteed to be unique, this approach mitigates any need to maintain an external sequence of numbers. |
|
–
|
The Sample LIMSID is derived from the Project LIMSID, which is configurable. |
Proposed Solution
|
•
|
The Receive Samples process is configured to trigger a script that renames the samples that are input to the process. |
|
•
|
This trigger also passes the OriginatingProcessURI to the script. This example assumes that the original submitted sample name must be preserved, so it is saved in a sample UDF. |
The following pseudocode shows how one might implement the sample renaming script:
|
1.
|
Connect to the API, using the OriginatingProcessURI. |
|
2.
|
Retrieve the OriginatingProcessXML and store it in a variable. |
|
3.
|
Iterate through the inputoutput map of the OriginatingProcessXML and for each InputArtifact: |
|
•
|
GET the InputArtifactURI and store the input ArtifactXML in a variable. |
|
•
|
From this ArtifactXML, GET the SourceSampleXML and store it in another variable. |
|
•
|
Modify the SourceSampleXML. To do this modification, copy the original SampleName to an OriginalSampleNameUDF. |
|
•
|
Rename the SampleName to a desired name (see Recommendations). |
|
•
|
Finally, PUT the Sample XML back. |