General concepts:
Flows - You can create as many flows as needed to run on your account. Each flow starts with a trigger (either a webhook or a triggerless trigger). When a flow is activated, it uses its own temporary database of variables as defined by the steps in it. The flow communicates (pull or push data) with the account's database with API.
Webhook - Activity by users in the Labguru account can be used as triggers to activate workflows. Each flow will have its own webhook, with a unique id (multiple flows can have the same trigger, and each will be a different webhook) All existing webhooks can be viewed from the Labguru app by adding "/admin/webhooks" to the URL.
Triggerless triggers - Flow triggers that do not depend on user activity in the Labguru application. Currently, there are 3 types:
Manual (can be activated from a button in the 'Logs' tab in the flow page)
Periodic (set a time cycle for the flow to be activated automatically)
External - Trigger by creating a POST request to a specific API endpoint. You can send parameters/files and they will be available as variables. To access the parameter you sent, add a scripter step and add this variable
request_param = variable('item')
Runs - Each time the flow is activated it counts as a single run. All runs are documented in the flow 'Logs' tab. Runs can be archived, re-run, or deleted from the log.
Steps - Flows are built from steps that mark the chronological progression of the flow (one step at a time). Flows can also branch out, allowing multiple steps to run in parallel. Steps can also be conditions that help specify when the flow needs to be activated, continued, or stopped.
Lab scripter - Specific steps that allow the addition of Python or Ruby code blocks (or upload code files). Using Lab scripter gives the ability to create very specific flows and to achieve exact results
Variables - Variables can be anything from a number, a string, or JSON files of Labguru pages (experiment, project, etc.). Variables can be created in steps (for example a 'Get experiment' or a 'Create report' step) and in Lab scripters. Once a variable is created, it can be used in the following steps. Variables only exist inside the flow "space", changes made on variables inside the flow will not affect pages in Labguru unless specified differently in a step. Every flow starts with one variable which is the trigger variable (except in flows with triggerless triggers). All variables available in a flow can be seen in the 'Variables' box at the top right corner of the 'Editor' tab.
Creating a new flow:
Click on the "+" button on the index page.
Name the new workflow (by clicking on the default name and typing a new one).
Choose a trigger from the list of possible triggers (The trigger can be edited at any time).
Adding steps
To add a new step, click on the 'Arrow down' icon at the bottom right corner of the step that is supposed to come before the new step.
To branch out, click on the diagonal arrow icon. This option is available only after the step already has a proceeding step.
The steps:
Conditions - Can be performed on text (strings) or numbers (integers). Users can choose whether the flow continues or stops when the condition is met. The option to archive stopped runs can help reduce the number of irrelevant runs in the 'Logs' tab.
For strings - Can be done on any text field in a variable. i.e. {{experiment_1.name}} or {{trigger_stock.type}}.
For integer - Can be done on any numerical field in a variable. i.e. {{experiment_2.id}} or {{equipment_1.owner_id}}.
Between numbers - Check if the value is within range of any numerical field.
Exist - Check if an object has an internal value.
Get - Store a page as a variable in the flow database as a JSON file format. Pages can be called either by name ( i.e. {{trigger_experiment.name}}) or by id (i.e. {{experiment_1.project_id}} - pay attention! this call is actually for a project, that you know its ID from an associated experiment that was already stored as a variable).
Find -
Find Section - Finds a section in an experiment stored as a variable by its name and stores it as a variable.
Find Element by Name - Finds an element in an experiment stored as a variable by its name and type and stores it as a variable.
Find Element by Section - Finds an element in an experiment stored as a variable by its section name and type and stores it as a variable.
Report -
Create Report Basic - This creates an empty report in the account. Users can choose how to title it. The report is also added as a variable in the editor.
Copy form data to report - Create a new section in a report that is stored as a variable. The section will be based on a text template taken from a document that is stored as a variable, and inject data from a Form Element input fields that are stored as a variable. Adding values from a Form Element can be done by adding double curly brackets with form input fields name in the document (i.e. {{performed _by}} ).
Update Report - Add a new section to a report stored as a variable, the section will include a text box with a template described in the step. Users can inject into the text, data from a Form Element that is stored as a variable. Adding values from a Form Element can be done using the double curly brackets with the form input fields name in it (i.e. {{performed _by}} )
Datasets -
Create dataset - Creates a new dataset in Labguru from an Excel attachment.
Update dataset - Adds a vector to an existing dataset.
Excel Calculation - Read data from a sheet in an Excel attachment that is stored as a variable and perform calculations on data in that sheet. The result is added as a new section, in the experiment where the attachment is located. To add calculations, Use the double curly brackets when adding a calculation to text (e.i {{=average(A1:A10}} )
Create Task - Creates a task in Labguru, set a due date, and assigns it to a member.
Link Objects - Link to pages that are available as variables.
Send email to - Sends an email to a member by email or user number (e.i. {{experiment_01.user}} ). The email can be linked to a page that is stored as a variable and can have content predefined in the step.
Downloader - Downloads the actual file from an 'attachment' variable to the temp folder in the editor (for calculation or analysis).
When using this step the attachment should be defined as a variable in order to access it and use it for further parsing and analysis:Upload attachment - Add an attachment to a page in Labguru that is stored as a variable in the editor.
Flow delegator - Sends the flow to trigger another flow. Useful in situations where a flow needs to be activated by two different triggers (for example, update a plasmid name when the plasmid is created or edited).
Variables logger - Adds details on all variables in flow to the log.
Extract images from Word Document - Extract all images from a doc/docx file and store them as variables.
Lab scripter - see the following.
Using the Lab scripter step:
General use:
Use either Python or Ruby code inside the Lab scripter. You can alternatively upload a code file.
Name the step by using the 'Explanation' field. The name will appear in the log and will help orientation.
You can use inside the Lab scripter step Labguru-related functions that are listed on the methods page (accessible by clicking on the "i" icon in the menu on the top right corner of each step).
Use the 'Output variables' field to "export" variables to be used in the following steps in the flow.
Useful commands:
Log - Use the Log function to add comments in the logs of the runs. i.e. log(x) or log("Yay") or log("Experiment Id is #{variable_name}") (in Ruby) - useful for debugging and for having more informative logs. The print function is also available in Python
log(x)
print(x) *IN PYTHON*Using Variables - To use a variable that was defined in preceding steps in the Lab scripter, use the function:
X = variable('variable_name')
Store Variables - In order to use objects created in the Lab scripter in the following steps use the function:
store_variable("new_name_of_variable", name_used_in_Lab_scripter)
and then add the new variable name in the 'Output variables' field at the bottom of the step. You can add multiple variables by using the store_variable function for each one and then naming all of them in 'Output variables' separated by a comma.
Using the API
To make GET, POST, and PUT requests in Lab scripter, use the get_api, post_api, and put_api methods that can be found in the list of methods. For more information on Labguru API
Code template
Code Templates are methods injected into the Lab Scripter, to all its instances before the code runs. Those methods can be written in the Code Templates tab and they can be implemented in Ruby or Python.
Please be careful updating Production and use Tester for validation. In each Lab Scripter step unit, you may choose which code template version to use.
Cacheable
Each scripter step now has a cache option. Selecting the cache option will allow you to accelerate the step. The step cache is available only for 1000 seconds.
"Fast" Workflows:
Flows run in chronological order by default, but we recommend that if your workflow does not depend on another workflow, toggle the button on the top left screen to 'Fast', which will run your workflow faster.
Debugging tips:
While creating a new step (or updating an existing one), there are a few useful tips that can help the process:
Use the "Re-run" buttons to quickly reactivate the trigger without going back to Labguru and reproduce the trigger. Re-runs are available in the corner of any log - either in the 'Editor' or 'Logs' tabs.
Turn "When stopped archive?" in all condition steps to False to avoid logs being missed due to being wrongly archived. Once a condition was verified to be written properly, turn "When stopped archive?" to True if needed (to reduce the "noise" of irrelevant runs from the log).
Add Variables logger steps to verify variables were stored properly.
Use the log function in Lab scripters that are not working to better locate the problematic line.
Click here for a detailed automation use case