Validating Process/Step Level UDFs

In this example, the protocol step is configured to invoke a script that is triggered when the user exits the step's Record Details screen.

Parameters

The EPP command is configured to pass the following parameters to the script:

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

/usr/bin/python /opt/gls/clarity/customextensions/checkprocessFields.py -l 122-7953 -u admin -p securepassword -f 'field Name 1, field Name 2, field Name N' 

User Interaction

When the lab scientist attempts to exit the Record Details screen, the script is invoked and the UDF names specified in the -f parameter will be checked to see that they have been populated. If they ALL have been, the script issues no message, and the process will continue as normal. If however, SOME of the UDFs have not been populated, a message will be displayed to the user indicating which mandatory fields need to be populated, and the user will be unable to move forward until all the specified fields have been populated.

About the Code

The method of central interest in the script is checkFields(). The method in turn carries out several operations:

  1. The list of fields passed to the script via the -f parameter is broken into its component UDF names

  2. For each UDF name in the list, the corresponding value is checked via the API, and if the value is empty, the UDF name is noted as absent

  3. If any UDF names are noted as being absent, an error dialog will be displayed to the user.

Assumptions and Notes

  • Both of the attached files are placed on the LIMS server, in the /opt/gls/clarity/customextensions folder.

  • The HOSTNAME global variable needs to be updated so that it points to your Clarity LIMS server.

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

  • If required, this script could be enhanced so that it not only checked to see that the UDFs had been populated, but that their values also matches a regexp pattern for additional validation.

Attachments

checkprocessFields.py:

Last updated