Moving Reagent Kits & Lots to New Clarity LIMS Server

Whereas config slicer is a useful tool for moving configuration data from one server to another and, strictly speaking, reagent lot data is not considered configuration, there is a need for an easy way to transfer reagent lot data to a new Clarity LIMSserver.

Solution

The preventative solution is to not create production reagent kits on the development server. However, if you're reading this it might be too late for that.

This example demonstrates how to use the Clarity LIMS API to extract reagent kit and reagent lot data from one server, transfer the data as an XML file and create the equivalent reagent kits and/or lots on the new server.

This example contains two scripts which can be run on the CLI, one which exports data from the dev server and generates a txt file. The second which uses the exported data to create the kits/ lots on the prod server.

Export

The first script accepts the following parameters:

-s

The hostname of the clarity server API and version from which to export (Required)

-u

The username of the current user (Required)

-p

The password of the current user (Required)

-d

The directory to write the txt file to (Optional, default will write to current working directory)

--skipLots

The script will not export reagent lot data (Optional)

--skipKits

The script will not export reagent kit data (Optional)

-k

A list of reagent kits to limit the export to, only reagent lots for these kits will be exported (Optional, by default will export all reagent kits)

An example of the full syntax to invoke the first script is as follows:

python reagents_export.py -s https://demo-4-1.claritylims.com/api/v2 -u apiuser -p ***** -d /Users/dcrawford/Documents --skipKits -k "AMPure XP Beads, Covaris Snap-cap microTUBE" 

Import

The second script accepts the following parameters:

-s

The hostname of the clarity server API and version to import into (Required)

-u

The username of the current user (Required)

-p

The password of the current user (Required)

-d

The directory to read the txt file from. (Optional, default will expect file to be in current working directory)

--checkforKits

The script will check the clarity server for existing kits of the same name. (Optional, Recommended) If this parameter is used, the script will not create duplicate reagent kits.

An example of the full syntax to invoke the first script is as follows:

python reagents_import.py -s https://demo-4-1.claritylims.com/api/v2 -u apiuser -p ***** -d /Users/dcrawford/Documents --checkforKits 

About the Code

reagents_export.py

The main method in the script searches the reagent kits and reagent lots endpoints for all the kits and lots or, if the -k parameter is used, for the kits and lots belonging to kits specified in the -k parameter.

The script writes the XML data for each kit and lot to the XML data file.

reagents_import.py

The main method of this script creates the reagent kits and reagent lots in CClarity LIMS. In the case of duplicate reagent kits, the reagent lots are associated with the newly created kits. If the --checkforKits parameter is included, the script does not create kits with duplicate names, and associates the reagent lots with the preexisting kits with the matching reagent lot name.

Assumptions and Notes

  • You are running a version of Python that is supported by Clarity LIMS, as documented in the Clarity LIMS Technical Requirements.

  • The example code is provided for illustrative purposes only. It does not contain sufficient exception handling for use 'as is' in a production environment.Attachments

  • Script Updates

    Jan 2018: reagents_export_jan2018.py and reagents_import_jan2018.py

    • Script updated to enable import/export of reagent kits with special characters.

    Aug 2018: reagents_import_Aug2018.py

    • Script checks for preexisting reagent lots.

    • --checkforkits prevents duplicate reagent lots. Lots with non-matching status are considered to already exist (if duplicate kit, name & number).

Attachments

reagents_import.py:

reagents_export.py:

reagents_import_jan2018.py:

reagents_export_jan2018.py:

reagents_import_Aug2018.py:

Last updated