Displaying Files From an Earlier Step
Last updated
Last updated
This article explains how to make files that were produced by / attached to the LIMS in an earlier step, visible in a subsequent step.
Consider a simplified workflow / protocol containing just two steps: Produce Files and Display Files.
The first step, Produce Files, will take in analytes (derived samples), and generate individual result files (one per input).
The subsequent Display Files step will allow us to view the files associated with the analytes from the previous step.
After the files have been generated by and attached to the Produce Files step, the Record Details screen of the step displays the files.
The key to displaying these files in any subsequent step involves producing a hyperlink to the file and displaying it as a user-defined field (UDF)/custom field in subsequent steps.
You may be familiar with creating and using text, numeric, and checkbox UDFs/custom fields. However, you may be less familiar with the hyperlink option. Fields of this type are used less frequently, but they are perfect for this solution.
NOTE: As of Clarity LIMS v5.0, the term user-defined field (UDF) has been replaced with custom field in the user interface. However, the API resource is still called UDF.
This solution involves a script that runs on the Record Details screen on the subsequent Display Files step and populates the fields. See the following figure.
As you can see, the structure of the hyperlink is straightforward and includes:
The IP address / hostname of the server.
The port.
A link to the LIMS ID of the file to be linked to.
To populate these fields, there are numerous methods available within an API-based script. The method discussed here works for the two-step protocol described earlier (namely that we want the files displayed in the next step of the protocol). It also works when the steps in which the files are uploaded and displayed are separated by several intermediate steps.
Assuming that the script will run just as the Record Details screen of the Display Files step is being displayed, use pseudocode to produce the hyperlinks.
For each output:
Determine the LIMS Unique ID (LUID) of the output artifact.
Determine the LUID of the submitted sample associated with the output artifact.
Determine the LUID of the resultfile artifact produced by the earlier process, derived from the common submitted sample.
Determine the LUID of the file associated with the resultfile artifact.
Update the hyperlink UDF / custom field on the output artifact (from step 1) with the specific hyperlink value.
To illustrate these pseudocode steps, XML from a demo system is provided.
From the XML representation of the Display Files process/step. we see that we have three output artifact LUIDS: 2-81806, 2-81805 and 2-81804.
By examining the XML representation of the first output artifact (2-81806), we see the LUID of the associated submitted sample is ADM1301A2:
After the common ancestor is found, ask Clarity LIMS for the output artifacts produced by our step of interest (Produce Files) directly.
For example:
Yields the following XML:
The resultfile with LUID 92-81803 is associated with the current output artifact (2-81806), even though these entities may be separated by several steps.
If the process/step produces multiple resultfiles, you may need to further constrain the search using the name= parameter. For example:
By gathering the XML representation of artifact 92-81803, the associated file has LUID 40-3652:
Now that you know the LUID of the file associated with output artifact 2-81803, set the value of its hyperlink field in the following form:
When constructing the value for the hyperlink, the 40- prefix should be removed from the LUID of the file.