Git Product home page Git Product logo

clarity-ext's Introduction

clarity-ext

Build Status Code Climate

Provides a library for extending Clarity LIMS in a more developer-friendly way.

Problem

Any LIMS system needs to be scripted (extended), as any lab has its own workflows. One extension could be to create a driver file for a robot when the user presses a button in a workflow step.

The Clarity LIMS server provides extensibility in the form of so called EPPs. These are basically shell commands that can be run on certain events in the system.

To develop and validate these steps, the developer would need to change the configuration entry for the script in the LIMS and then run the script manually through the LIMS.

This method is cumbersome and doesn't provide an acceptable feedback loop for the developer.

Solution

With clarity-ext, the developer can instead:

  • Set a step up as usual
  • Write an extension that should run in this step
  • Extensions have access to extension contexts, which do most of the work. This way, the readability and simplicity of the extensions increase, allowing non-developers to review and alter the code.

Components

Runner

The first component of the system is the clarity-ext command line tool. All extensions are run through this tool.

For example, we have an extension that generates an input file for a Fragment Analyzer. The Process Types EPP is set up like this in that case:

clarity-ext extension --args 'pid={processLuid}' clarity_ext_scripts.fragment_analyzer.create_fa_input_file exec

However, when developing, the developer runs this instead:

clarity-ext extension clarity_ext_scripts.fragment_analyzer.create_fa_input_file test

These are the differences between the commands:

  • The latter one uses a cache for requests/responses
  • The first one needs to provide the pid as an argument, while the second uses the test data defined in the extension

The end result is that the user will get feedback directly in the IDE or terminal when running. It's faster because of caching, but the tool will also output the file to stdout.

Extensions

The developer creates an extension by subclassing one of the extension base classes and implementing or overriding one or more method.

Currently, there are two extension base classes:

  • GeneralExtension: The extensions's execute method will be run on execution
  • DriverFileExtension: Provides methods that describe how a driver file looks, rather than explicitly saying how it's generated.

All extensions have access to the ExtensionContext. This object provides a higher level view on the data available from the Clarity REST API. The extension can also import generic helper classes. All of the properties on this object are generated lazily (on request), and an exception is thrown if they can't be used in the particular context for some reason.

Extensions have been created for the SNP&SEQ platform at Uppsala University. These are in a private repo for now, but examples showing how they work will be added to this repo.

All of these extensions follow the design principle of leaving all non-trivial or boilerplate code to the framework. The idea is that they can be understood by non-developers configuring or validating the system.

Helper modules

  • clarity_ext.domain: Provides classes that help with work directly related to labs, such as a Container object that can enumerate wells in different ways.
  • clarity_ext.pdf: Provides ways to work with pdf files in a high level way, such as splitting them

clarity-ext's People

Contributors

aratz avatar b97pla avatar gitedvard avatar johandahlberg avatar karnair avatar kleppari avatar matrulda avatar perlundmark avatar slohse avatar withrocks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clarity-ext's Issues

Refactor ExtensionService.execute()

When reviewing https://github.com/Molmed/clarity-snpseq/pull/29 I tried to get a quick and brief overview of the clarity-ext validate to get a sense of what it would do.

I stumbled across the ExtensionService.execute() method (

def execute(self, module, mode, run_arguments_list=None, config=None, artifacts_to_stdout=True,
) that seems to clock in at an awful lot of lines of code, with lots of nested for loops and if statements.

It would be nice to have this method re-factored somehow at some stage to make it easier to understand (and to extend/test/etc).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.