QBench Report Template Documentation
Overview
QBench templates use the Jinja templating engine to organize and format all of your data. Jinja combines HTML and Python-like expressions to read and display variables from QBench. Important fields that you will want to display in your templates include core fields, user-created fields, and worksheet variables.
QBench provides an easy way to manage your templates under Configuration > Application > Templates. You can edit your template within the app or use your own code editor and paste it into QBench. The preview button will let you check the current design of the template so you can easily see your changes. Once you are done configuring the template, you will be able to use it to generate reports.
Referencing QBench Variables - Core Fields
Basic Syntax:
Jinja references QBench variables by surrounding the variable with double curly brackets. It is important to note that these variables are CASE SENSITIVE. For example, if we wanted to display the results field of a test we would write:
{{ test.results }}
Referencing a DATETIME field:
QBench stores date fields as DATETIME objects. You can format the DATETIME object however you like by using the strftime() function and following the format code found here. All QBench DATETIME objects are stored in UTC and can be converted to local time using the custom local_time jinja filter.
{{ test.start_date.strftime('%m/%d/%Y') }} is the start date in UTC
{{ test.start_date|local_time }} is the start date in my local timezone
Referencing a custom ID field:
Custom IDs can be referenced using a function called get_display_id(). This function attempts to retrieve a custom ID only if custom IDs are enabled and the object has a custom ID. If not, the function will return the internal QBench ID. get_display_id() takes one argument that is already created for you in the report template: enabled_custom_ids. If you want to retrieve a sub sample ID, an additional argument needs to be passed in called sub_sample_increment_id
<p>This order has an ID of
{{ test.sample.order.get_display_id(enabled_custom_ids) }}.</p>
<p>This sample has an ID of
{{ test.sample.get_display_id(enabled_custom_ids, enabled_sub_sample_increment_id) }}.
</p>
Referencing QBench Variables - Related QBench Objects
Basic Syntax:
Some QBench objects are interrelated and can be referenced from one another. For example, you may want to display the assay title of a test.
{{ test.assay.title }}
Lists of Related Objects:
Sometimes a QBench object can have a variable that is a list of other objects e.g. orders can have many samples and samples can have many tests. To iterate through these lists, we use Jinja’s for loop syntax. Iterating through all tests of a sample would look something like this:
{% for test in sample.tests %}
<p>Test result is {{ test.results }}</p>
{% endfor %}
Referencing QBench Variables - Additional Fields
Basic Syntax:
Because of the way QBench is designed, user-created fields must be referenced in a slightly different way than core fields because they are stored like a python dictionary. If we have a sample additional field named “my_custom_field” we can reference it by writing
{{ sample['my_custom_field'] }}
Checkbox Fields:
Additional fields that are of type BOOL are stored as a 0 or 1. Since Python will interpret 0 as False and 1 as True, these types of fields can be treated as a regular boolean value. However, if you would like to explicitly print “True” of “False” within the template you would need to use an if statement.
{% if test['is_paid'] %}
<span>True</span>
{% else %}
<span>False</span>
{% endif %}
Datetime Fields:
Additional fields that are of type DATE or DATETIME are a special case. They have an extra field called date_value and datetime_value that can only be accessed by the additional_fields variable of an object. It is designed this way so the fields can be manipulated as a DATE or DATETIME object instead of a plain string object. Here is an example of localizing a DATETIME additional field:
{% if sample.additional_fields['my_custom_field'] and sample.additional_fields
['my_custom_field'].datetime_value %}
{{ sample.additional_fields[‘my_custom_field’].datetime_value|local_time }}
{% endif %}
Referencing QBench Variables - Additional Object Fields
QBench allows for Additional Fields to reference another QBench Object (e.g. a User). In order to access the related object, you must reference the “addiitonal_fields” attribute and utilize an Additional Field’s “get_referenced_obj” method. For example:
{% set user_obj = test.additional_fields['second_technician'].get_referenced_obj() %}
{{ user_obj.first_name + ' ' + user_obj.last_name }}
For Multi-Select Additional Fields that reference another QBench Object, a different method called “get_referenced_obj_dict” will return a dictionary where the Key is the Object ID and the Value is the actual Object. For example, if a Test had an Additional Field called “technician_list” with values “4 - John Doe, 9 - Sally Smithers”, the following code can be used to display their names:
{% set user_objs = test.additional_fields['technician_list']
.get_referenced_obj_dict() %}
{% for key, value in user_objs.items() %}
<div>ID: {{ key }}</div>
<div>Name: {{ value.first_name + ' ' + value.last_name }}</div>
<div>Email: {{ value.email }}</div>
{% endfor %}
The resulting value “user_objs” would look like the following dictionary:
{
4: <User 'John Doe'>,
9: <User 'Sally Smith'>
}
Referencing QBench Variables - Worksheet Data
To reference variables from a worksheet, the report template is passed a dictionary containing all worksheet information. For Test Level reports, there is only one worksheet so the variable worksheet_data is used. For Order/Sample Level reports, it is possible to have more than one worksheet so the variable worksheet_data_list_test_id_map is used. These dictionaries may look something like this:
Test Level Reports:
Worksheet:
First Input: __(input, first_input)__
Second Input: __(input, second_input)__
Average: __(calculation, average, ((first_input + second_input) / 2))__
worksheet_data (template variable):
{
first_input': {'value': '10'},
second_input': {'value': '20'},
average': {
'formula': '((first_input + second_input) / 2)',
'value': '15'
}
}
worksheet_data (template variable):
{
first_input': {'value': '10'},
second_input': {'value': '20'},
average': {
'formula': '((first_input + second_input) / 2)',
'value': '15'
}
}
You can retrieve the calculation value from the worksheet using Python’s dictionary syntax. To be safe, it is a good idea to use if statements before calling the dictionary value in case the key does not exist
{{ worksheet_data['average']['value'] }} {# Unsafe and may result in error #}
{# Safe and prevents errors #}
{% if worksheet_data.get('average') and worksheet_data['average'].get('value') %}
<p>Average is {{ worksheet_data['average']['value'] }}
{% endif %}
Order/Sample Level Reports:
The variable worksheet_data_list_test_id_map is a nested dictionary mapping test IDs to their worksheet values. This is similar to worksheet_data except it adds one more layer to the dictionary.
{% for test in sample.tests %}
<p>First Input: {{ worksheet_data_list_test_id_map[test.id]
[‘first_input’][‘value’] }}</p>
<p>Second Input: {{ worksheet_data_list_test_id_map[test.id]
[‘second_input’][‘value’] }}</p>
<p>Average: {{ worksheet_data_list_test_id_map[test.id]
[‘average’][‘value’] }}</p>
{% endfor %}
Referencing Attachments (Images)
Attachments are stored as a map with the file name as the key. You can access attachments for report configs, orders, samples, and tests. You must use a jinja filter to download the attachment. Refer to the following examples:
<img src="file://{{ report_config_attachments['header.png']
.asset_id|download_file_to_local_tmp }}">
<img src="file://{{ order_attachments['order_photo.jpg'].asset_id|download_file_to_local_tmp }}">
<img src="file://{{ sample_attachments['sample_photo.png']
.asset_id|download_file_to_local_tmp }}">
<img src="file://{{ test_attachments['test_photo.png']
.asset_id|download_file_to_local_tmp }}">
Since an Order Level Report can have many samples and tests, a sample or test ID must be included when accessing their attachments.
Sample Attachments in an Order Level Report:
Sample attachments in Order Level Reports are stored as a 2D dictionary with the first key being the sample ID and the second key being the attachment name. The following is an example of displaying a sample attachment with an ID of 123 and an attachment name of sample_photo.png:
<img src="file://{{ sample_attachments[123]['sample_photo.png']
.asset_id|download_file_to_local_tmp }}">
Test Attachments in an Order or Sample Level Report:
Test attachments are also stored as a 2D dictionary in Order and Sample Level Reports. You can access test attachments in a similar fashion by passing in the test ID as the first key and the attachment name as the second key. Here is an example of displaying a test attachment named “test_picture.jpg” for test ID 456:
<img src="file://{{ test_attachments[456]
['test_picture.jpg'].asset_id|download_file_to_local_tmp }}">
PDF Attachments:
If you upload a PDF attachment to an Order, you can choose to append it to your report. Marking the “Include In Report” checkbox will add it to the end, sorting by name if you have multiple PDFs to attach.
Image Attachments:
If you upload image attachments with an extension including JPG, JPEG, and PNG, you can choose to include that to your report by marking the “Include In Report” checkbox before uploading. Keep in mind that, when configuring a template, you will need to reference those attachments to be displayed on the report. Below is an example of how you can reference those images in your test report template:
{% for attachment in test.get_included_report_attachments() %}
<img src=”{{attachment.asset_id|get_asset_file_download_url()}}” />
{% endfor %}
Global settings: There is a setting in the General Settings page called “Automatically include attachments in a Report upon upload.” that will always include attachments uploaded in the report.
Report Template Variables
Template Variable |
Description |
Type |
Order Level |
Sample Level |
Test Level |
completed_date_string |
String of date test was complete |
STRING |
Yes |
Yes |
Yes |
control_set_controls |
Dictionary of controls |
DICTIONARY |
Yes |
Yes |
Yes |
control_set_controls_sorted_keys |
List of sorted keys for control_set_controls variable |
ARRAY |
Yes |
Yes |
Yes |
customer |
The customer who is on the order |
QBENCH OBJECT |
Yes |
Yes |
Yes |
date_generated |
The date the report was generated |
DATETIME |
Yes |
Yes |
Yes |
enabled_custom_ids |
List of enabled custom IDs |
ARRAY |
Yes |
Yes |
Yes |
enabled_sub_sample_increment_id |
Boolean for sub sample incremented IDs |
BOOLEAN |
Yes |
Yes |
Yes |
end_date |
Date the test was completed |
DATETIME |
Yes |
Yes |
Yes |
generated_date_string |
String of when report was generated |
STRING |
Yes |
Yes |
Yes |
logo_path |
Path to your logo image |
STRING |
Yes |
Yes |
Yes |
order |
The order you are reporting on |
QBENCH OBJECT |
Yes |
Yes |
Yes |
order_attachments |
Dictionary of order attachments with the file name as the key |
DICTIONARY |
Yes |
Yes |
Yes |
report_config_attachments |
Dictionary of report config attachments with the file name as the key |
DICTIONARY |
Yes |
Yes |
Yes |
report_page_count |
Number of pages in the uploaded PDF (used when uploading a report) |
INTEGER |
Yes |
Yes |
Yes |
sample |
The sample you are reporting on |
QBENCH OBJECT |
No |
Yes |
Yes |
sample_attachments |
Dictionary of sample attachments with the file name as the key |
DICTIONARY |
Yes |
Yes |
Yes |
signature |
The selected signature object |
QBENCH OBJECT |
Yes |
Yes |
Yes |
start_date |
Date the test was started |
DATETIME |
Yes |
Yes |
Yes |
test |
The test you are reporting on |
QBENCH OBJECT |
No |
No |
Yes |
test_attachments |
Dictionary of test attachments with the file name as the key |
DICTIONARY |
Yes |
Yes |
Yes |
testing_date_string |
String of date test was started |
STRING |
Yes |
Yes |
Yes |
tests |
List of tests you are reporting on |
ARRAY |
Yes |
Yes |
No |
worksheet_data |
Dictionary of worksheet data |
DICTIONARY |
No |
No |
Yes |
worksheet_data_list_test_id_map |
Dictionary of worksheet data |
DICTIONARY |
Yes |
Yes |
No |
template_revision_number |
Integer value of how many reports have been generated for this object |
INTEGER |
Yes |
Yes |
Yes |
Invoice Template Variables
Template Variable |
Description |
Type |
assay_ids |
List of assay ids that are associated with the invoice |
ARRAY |
customer |
The customer associated with the invoice |
QBENCH OBJECT |
date_generated |
The date the invoice was generated |
DATETIME |
discounts |
List of discount items on the invoice |
ARRAY |
enabled_custom_ids |
List of enabled custom IDs |
ARRAY |
enabled_sub_sample_increment_id |
Boolean for sub sample incremented IDs |
BOOLEAN |
invoice |
The invoice you are printing |
QBENCH OBJECT |
invoice_config_attachments |
Dictionary of invoice attachments with the file name as the key |
DICTIONARY |
invoice_items |
List of invoice items on the invoice |
ARRAY |
logo_path |
Path to your logo image |
STRING |
order |
The order associated with the invoice |
QBENCH OBJECT |
order_attachments |
Dictionary of order attachments with the file name as the key |
DICTIONARY |
sample_attachments |
2D Dictionary of sample attachments with the sample ID as the first key and file name as the second key |
DICTIONARY |
test_attachments |
2D Dictionary of test attachments with the test ID as the first key and the file name as the second key |
DICTIONARY |
subtotals |
List of subtotals on the invoice |
ARRAY |
surcharges |
List of surcharges on the invoice |
ARRAY |
Payment Template Variables
Template Variable |
Description |
Type |
customer |
The customer associated with the payment |
QBENCH OBJECT |
date_generated |
The date the payment was generated |
DATETIME |
payment |
The payment you are printing |
QBENCH OBJECT |
invoice_payments |
List of InvoicePayment items on the payment |
ARRAY |
payment_config_attachments |
Attachments stored in payment template |
DICTIONARY |
user |
Current user |
QBENCH OBJECT |
PrintDoc Template Variables
Template Variable |
Description |
Type |
Order Level |
Sample Level |
Test Level |
Batch Level |
batch |
The selected batch for the current PrintDoc |
QBENCH OBJECT |
Yes |
|||
batch_attachments |
Dictionary of attachments uploaded to the Batch |
DICTIONARY |
Yes |
|||
batches |
A list of child Batches for the selected Batch |
ARRAY |
Yes |
|||
date_generated |
DateTime object of the date this PrintDoc was generated |
DATETIME |
Yes |
Yes |
Yes |
Yes |
generated_date_string |
String representation of when this PrintDoc was generated |
STRING |
Yes |
Yes |
Yes |
Yes |
order |
The selected Order for the current PrintDoc |
QBENCH OBJECT |
Yes |
|||
printdoc_config_attachments |
Dictionary of attachments uploaded to the Order |
DICTIONARY |
Yes |
Yes |
Yes |
Yes |
sample |
The selected Sample for the current PrintDoc |
QBENCH OBJECT |
Yes |
|||
sample_attachments |
Dictionary of attachments uploaded to the Sample |
DICTIONARY |
Yes |
|||
test |
The selected Test for the current PrintDoc |
QBENCH QBENCH OBJECT |
Yes |
|||
test_attachments |
Dictionary of attachments uploaded to the Test |
DICTIONARY |
Yes |
|||
tests |
List of tests for the current PrintDoc |
DICTIONARY |
Yes |
Jinja Filters
Jinja filters act as a function you can call within a template. Jinja provides a number of built-in filters you can use to further customize your reports. There are some custom filters you can use within the report template that are specific to QBench.
local_time(date, fmt) - returns a string of the date in local time with the format provided. Default format is “%m/%d/%Y %I:%M %p”
{{ test.start_date|local_time('%m/%d/%Y') }}
{{ test.end_date|local_time }}
download_file_to_local_tmp(asset_id) - downloads a QBench asset to local tmp and returns the file path. This can be used to display an image (i.e. a signature) on the report template
<img
src="{{test.tech.report_signatures[0].image_asset_id|download_file_to_local_tmp }}">
{% for filename, attachment in report_config_attachments.items() if filename.endswith('.json') %}
<div>
<label>{{filename}}</label><br />
{% set json = attachment.asset_id | get_json_from_asset %}
<pre>{{json|pprint}}</pre>
{{json.get('myJsonKey')}}
</div>
{% endfor %}
{% for filename, attachment in report_config_attachments.items() if filename.endswith('.yaml') %}
<div>
<label>{{filename}}</label><br />
{% set yaml = attachment.asset_id | get_yaml_from_asset %}
<pre>{{yaml|pprint}}</pre>
{{yaml.get('myYamlKey')}}
</div>
{% endfor %}
verify_worksheet_value(worksheet_dict, key, check_against) - checks if a worksheet identifier exists in a test’s worksheet data. Will return True or False depending on whether or not the identifier exists in a Test’s worksheet data. The function accepts an optional parameter called check_against, which is a list of values to check against to evaluate the function to False. The example below checks the worksheet data for a worksheet identifier titled “finding” if it exists and if its value doesn’t equal the text “ND”.
{% set worksheet_data = test.get(“worksheet_data”) %}
{% if worksheet_data|verify_worksheet_value(“finding”, [“ND”]) %}
{{ worksheet_data|extract_worksheet_value(“finding”) }}
{% else %}
No findings
{% endif %}
extract_worksheet_value(worksheet_dict, key, check_against, default_value) - utilizes the verify_worksheet_value function to check whether the provided key exists in the worksheet data (utilizing the same parameters as well). There is also a parameter to set a default value if the verify_worksheet_value function returns False. This example below shows displays the worksheet value for “finding” if it exists and “No findings” if there isn’t a value or the value equals the text “ND”
{% set worksheet_data = test.get(“worksheet_data”) %}
{{ worksheet_data|extract_worksheet_value(“finding”, [“ND”], “No findings”) }}
round_to_sig_fig(value, significant_figures) - attempts to convert a value to a numeric decimal value. All trailing 0’s after a non-zero integer is significant. All leading 0’s before a non-zero integer is NOT significant. If the return value is 0, the method will return 0.0* where trailing 0’s equate the length of significant figures.
{% set x = 1000 %}
<div>Normal Val: {{ x }} Formatted: {{ x|round_to_sig_fig(2) }}</div>
{% set x = "ND" %}
<div>Normal Val: {{ x }} Formatted: {{ x|round_to_sig_fig(3) }}</div>
{% set x = 1.2546 %}
<div>Normal Val: {{ x }} Formatted: {{ x|round_to_sig_fig(4) }}</div>
numeric_comparison(x, y, operator) - attempts to evaluate a comparison of [“>”, “<”, or “=”] using the parameters X and Y. X is the leading value and Y is used as the comparator.
{% set x = '3.5' %}
{% set y = '3.5' %}
<div>Greater Than: {{ x|numeric_comparison(y, ">") }}</div>
<div>Less Than: {{ x|numeric_comparison(y, "<") }} </div>
<div>Equal To: {{ x|numeric_comparison(y, "=") }}</div>
string_comparison(x, y) - attempts to evaluate if string x and y are similar strings despite whitespaces and case conditions
{% set x = 'H eL L o' %}
{% set y = 'h E l Lo' %}
<div>String Compare: {{ x|string_comparison(y) }}</div>
call_numpy_func(func, *args, **kwargs) - utilize python library numpy. Func is the name of the function to use from the numpy library. *args are required parameters for the specified function. **kwargs are optional parameters that utilize a key/value pair value to be passed as a parameter. https://docs.scipy.org/doc/numpy-1.11.0/reference/
{% set mean = [1, 2, 3, 4, 5] %}
{% set variance = [[1,2], [3,4]] %}
{% set std = [[1,2], [3,4]] %}
<div>Mean: {{ 'mean'|call_numpy_func(mean) }}</div>
<div>Variance: {{ 'var'|call_numpy_func(variance) }}</div>
<div>Standard Deviation: {{ 'std'|call_numpy_func(std) }}</div>
call_scipy_func(func, *args, **kwargs) - utilize python library scipy. Func is the name of the function to use from the scipy library. *args are required parameters for the specified function. **kwargs are optional parameters that utilize a key/value pair value to be passed as a parameter.
https://docs.scipy.org/doc/scipy-1.2.1/reference/
call_stats_func(func, *args, **kwargs) - utilize python library scipy’s stats. Func is the name of the function to use from the stats library. *args are required parameters for the specified function. **kwargs are optional parameters that utilize a key/value pair value to be passed as a parameter.
https://docs.scipy.org/doc/scipy-1.2.1/reference/tutorial/stats.html
{% set r_x = [10, 16, 20, 50, 100, 400] %}
{% set r_y = [100, 106, 112, 118, 124, 130] %}
{% set results = 'linregress'|call_stats_func(r_x, r_y) %}
<div>Results: {{ results }}</div>
<div>Slope: {{ results['slope'] }}</div>
<div>Intercept: {{ results['intercept'] }}</div>
<div>R Value: {{ results['rvalue'] }}</div>
<div>R Squared: {{ results['rvalue']**2 }}</div>
<div>P Value: {{ results['pvalue'] }}</div>
call_pyplot_func(func, *args, **kwargs) - utilize python library matplotlib’s pyplot. Func is the name of the function to use from the pyplot library. *args are required parameters for the specified function. **kwargs are optional parameters that utilize a key/value pair value to be passed as a parameter.
{% set r_x = [1, 3, 4, 5, 8, 9] %}
{% set r_y = [1, 1, 2, 2, 5, 8] %}
<div>Plot Graph</div>
{% set fig = 'figure'|call_pyplot_func %}
{% set ax = fig|call_object_func('add_subplot', 111) %}
{% set _x = ax|call_object_func('plot', r_x, r_y, 'ro') %}
{% set _x = ax|call_object_func('axis', [0, 10, 0, 10]) %}
{% set _x = fig|call_object_func('savefig', '/tmp/fig-{}.png'.format(sample.id) %}
<img style="width:300px; height:300px;" src="file:///tmp/fig-{{sample.id}}.png">
call_object_func(lib_object, func, *args, **kwargs) - utilizes an object created in the report and invokes a method from the referenced object. Func is the name of the function to use from the object. *args are required parameters for the specified function. **kwargs are optional parameters that utilize a key/value pair value to be passed as a parameter.
evaluate_specification(spec, test_result) - compares a specification object to a test_result to evaluate if the test_result meets the specification criteria.
{{ spec|evaluate_specification(test.results }}
parse_json(json_string) - converts a JSON string to a JSON object. Will return None if json_string is not formatted properly for conversion.
{% set json_string = '{"bad":"grade", "good":"dog"}' %}
{% set json_object = json_string|parse_json %}
<div>Json Object Bad: {{ json_object.get('bad') }}</div>
qr_code_base64(string) - Generates a base64 encoded string to be used as the src
attribute for an <img>
tag.
Example Usage:
<img src="{{'https://qbench.net'|qr_code_base64}}" />
barcode_base64(string) - Generates a base64 encoded string to be used as the src
attribute for an <img>
tag. write_text
can be True
or False
.
Example Usage:
<img src="{{'https://qbench.net'|barcode_base64(write_text=False)}}" />
b64encode(string) - Generates a base64 encoded string.
Example Usage:
<div>{{ "b64encode"|b64encode }}</div>
Output:
YjY0ZW5jb2Rl
b64decode(string) - Decodes a base64 encoded string.
Example Usage:
<div>{{ "YjY0ZW5jb2Rl"|b64decode }}</div>
Output:
b64encode
id_range(entities) - Loops over a list of entities and returns the range.
Example Usage:
{# assume 3 tests with IDs 150, 151, and 152 #}
<div>{{ sample.tests|id_range }}</div>
Output:
150 - 152
add_days_to_date(date, days) - Adds specified number of days to a date object.
Example Usage:
{# assume sample.date_received is "2023-08-11 18:16:00" #}
<div>{{ sample.date_received|add_days_to_date(3) }}</div>
Output:
2023-08-14 18:16:00
subtract_days_to_date(date, days) - Subtract specified number of days from a date object.
Example Usage:
{# assume sample.date_received is "2023-08-11 18:16:00" #}
<div>{{ sample.date_received|subtract_days_to_date(3) }}</div>
Output:
2023-08-08 18:16:00
get_date_range(range) - Takes a date range and returns the first and last dates of that range. Possible values for range
are "this_week", "last_week", "this_month", "last_month".
Example Usage:
{# assume the current date is 12/05/2023 #}
<div>{{ "last_month"|get_date_range }}</div>
Output:
(datetime.date(2023, 11, 1), datetime.date(2023, 11, 30))
date_parse(date_string) - Takes a date string and returns a datetime object.
Example Usage:
{# assume the field is an additional field of type "datetime" with value "12/05/2023" #}
<div>{{ sample.date_additional_field|date_parse }}</div>
Output:
2023-12-05 00:00:00
dropbox_sign_input(field_type, required=True, signer_number=1, size_large=False) - Generates a text tag to be parsed by Dropbox Sign during a signature request process. The inputs to this filter are as follows:
- field_type: The UI component that will be displayed on the Dropbox Sign document signing page. Must be one of sig, initial, text, check or date. Find the full list of types here. Note that QBench currently does not support these fields: text-merge and checkbox-merge.
- required: Indicates if the field is required or not. We recommend requiring sig and initial fields.
- signer_number: Associate this field_type to a particular signer. You can create a variety of UI components that can be completed only by the designated signer. Must be a positive integer.
- size_large: To display a wider signature box, set this to True.
Example Usage:
<div>Signed By:</div>
<div>{{ 'sig' | dropbox_sign_input(True,1) }}</div>
Here are some example Jinja filters as well as their result on the Dropbox Sign signing page.
Standard Deviation Calculations for Worksheets
In the worksheet, you are able to calculate Standard Deviation by using the following function
{{worksheet | calc_std ([ ‘ input_1’ , ‘input_2’ , ‘input_3’ ] , ddof = 0}}
In order to setup the Standard Deviation Worksheet, the following would need to be implemented:
Once the Worksheet Configuration has been saved and “Set as Active”, the Worksheet can be added to any Test(s) or Batch(es). Below depicts the rendered Worksheet that can calculate for the Standard Deviation.
Referencing Batch Plate Maps
Referencing a Sample(s) in the Batch(es) Plate Map is also available for configurations through the Worksheet. Using the {% set plate = batch.platemap if batch.platemap%} function, you are able to retrieve and reference the different Samples in the Plate Map with {{plate}}.
Below depicts the Samples that are referenced in the Plate Map by Worksheet.
Below is a list of QBench objects and their internal field names. Fields between ‘< >’ brackets are references to other QBench objects.
Order:
Order Fields |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Custom ID |
custom_formatted_id |
STRING |
Date Received |
date_received |
DATETIME |
Due Date |
date_required |
DATETIME |
Special Instructions |
special_instructions |
STRING |
Status |
state |
STRING |
customer_account |
QBENCH OBJECT |
|
samples |
LIST<Sample> |
|
project |
QBENCH OBJECT |
|
invoices |
LIST<Invoice> |
|
tags |
LIST<Tag> |
|
Order Model Helper Functions |
||
Get Display ID (Custom ID if exists, else ID) |
get_display_id() |
STRING | INTEGER |
Get Total Sample Count |
get_total_samples() |
INTEGER |
Get Total Test Count |
get_total_tests() |
INTEGER |
Get Comments |
get_comments() |
LIST<Comment> |
Get Attachments |
get_attachments() |
LIST<Attachment> |
Get All Invoices |
get_all_invoices() |
LIST<Invoice> |
Sample:
Sample Fields |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Custom ID |
custom_formatted_id |
STRING |
Lab ID |
lab_id |
STRING |
Sample Type |
sample_type |
STRING |
Description |
description |
STRING |
Time of Collection |
time_of_collection |
DATETIME |
Point of Collection |
point_of_collection |
DATETIME |
accessioning_type |
QBENCH_OBJECT |
|
parent_sample |
QBENCH OBJECT |
|
sub_samples |
LIST<Sample> |
|
order |
QBENCH OBJECT |
|
tests |
LIST<Test> |
|
source |
QBENCH OBJECT |
|
project |
QBENCH OBJECT |
|
location |
QBENCH OBJECT |
|
tags |
LIST<Tag> |
|
Sample Model Helper Functions |
||
Get Display ID (Custom ID if exists, else ID) |
get_display_id() |
STRING | INTEGER |
Get Sample |
get_original_sample() |
QBENCH OBJECT |
Get Sub Sample Count |
get_sub_sample_count() |
INTEGER |
Get Sub Sample LIST |
get_sub_sample_id_list |
LIST<String | Integer> |
Get Total Test Count |
get_total_tests() |
INTEGER |
Get Days in Current Location |
get_days_in_current_location() |
INTEGER |
Get Comments |
get_comments() |
LIST<Comment> |
Get Attachments |
get_attachments() |
LIST<Attachment> |
Get Worksheet Configurations |
get_worksheet_config() |
STRING |
Get Worksheet Data |
get_worksheet_data() |
DICTIONARY |
Test:
Test Fields |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Status |
state |
STRING |
Estimated Start Date |
estimated_start_date |
DATETIME |
Estimated Complete Date |
estimated_complete_date |
DATETIME |
Start Date |
start_date |
DATETIME |
Complete Date |
complete_date |
DATETIME |
Results |
results |
STRING |
Comments |
comments |
STRING |
<Technician> |
tech |
QBENCH OBJECT |
assay |
QBENCH OBJECT |
|
panel |
QBENCH OBJECT |
|
sample |
QBENCH OBJECT |
|
tags |
LIST<Tag> |
|
control |
QBENCH OBJECT |
|
turnaround |
QBENCH OBJECT |
|
<QC Data> |
control_set |
QBENCH OBJECT |
Test Model Helper Functions |
||
Get Order ID |
get_order_id() |
STRING | INTEGER |
Get Worksheet Configuration |
get_worksheet_config() |
STRING |
Get All Test Specification |
get_all_test_specifications() |
LIST<Specification> |
Get Worksheet Data |
get_worksheet_data() |
DICTIONARY |
Get Comments |
get_comments() |
LIST<Comment> |
Get Attachments |
get_attachments() |
LIST<Attachment> |
Assay:
Assay Fields |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Title |
title |
STRING |
Duration |
duration |
INTEGER |
Method |
method |
STRING |
Method Detection Limit |
method_detection_limit |
FLOAT |
Units |
units |
STRING |
Reporting Limit |
reporting_limit |
FLOAT |
Spike Level |
spike_level |
FLOAT |
Percent Recovery Lower Limit |
percent_recovery_lower_limit |
FLOAT |
Percent Recovery Upper Limit |
percent_recovery_upper_limit |
FLOAT |
Relative Percent Difference Limit |
relative_percent_difference_limit |
FLOAT |
Sort Order |
sort_order |
INTEGER |
Base Price |
base_price |
DECIMAL(19,2) |
tags |
LIST<Tag> |
|
<Team> |
team |
QBENCH OBJECT |
<Category> |
category |
QBENCH OBJECT |
<Default Technician> |
default_technician |
QBENCH OBJECT |
assay_turnarounds |
LIST<Turnaround> |
|
Assay Model Helper Functions |
||
Get Comments |
get_comments() |
LIST<Comment> |
Get Attachments |
get_attachments() |
LIST<Attachment> |
Panel:
Panel Fields |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Title |
title |
STRING |
Description |
description |
STRING |
Panel Model Helper Functions |
||
Get Comments |
get_comments() |
LIST<Comment> |
Get Attachments |
get_attachments() |
LIST<Attachment> |
Customer:
Customer Fields |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Name |
customer_name |
STRING |
Address |
address |
STRING |
City |
city_name |
STRING |
State |
state_name |
STRING |
Zip/Postal |
zip_postal_code |
STRING |
Country |
country_name |
STRING |
Phone |
phone |
STRING |
Fax |
fax |
STRING |
Special Instructions |
special_instructions |
STRING |
Comments |
comments |
STRING |
Company Discount |
company_discount |
FLOAT |
tags |
LIST<Tag> |
|
contacts |
LIST<Contact> |
|
contact_customers |
||
Customer Model Helper Functions |
||
Get Comments |
get_comments() |
LIST<Comment> |
Get Attachments |
get_attachments() |
LIST<Attachment> |
Contact:
Contact Fields |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
First Name |
first_name |
STRING |
Last Name |
last_name |
STRING |
|
|
STRING |
Address |
address |
STRING |
Phone |
phone |
STRING |
Fax |
fax |
STRING |
Mobile |
mobile |
STRING |
tags |
LIST<Tag> |
|
Contact Model Helper Functions |
||
Get Comments |
get_comments() |
LIST<Comment> |
Get Attachments |
get_attachments() |
LIST<Attachment> |
Source:
Source Fields |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Custom ID |
custom_formatted_id |
STRING |
Lab ID |
lab_id |
STRING |
Display Name |
display_name |
STRING |
Identifier |
identifier |
STRING |
First Name |
first_name |
STRING |
Last Name |
last_name |
STRING |
Date of Birth |
date_of_birth |
DATETIME |
Description |
description |
STRING |
Longitude |
longitude |
FLOAT |
Latitude |
latitude |
FLOAT |
customer |
QBENCH OBJECT |
|
project |
QBENCH OBJECT |
|
tags |
LIST<Tag> |
|
Source Model Helper Functions |
||
Get Display ID (Custom ID if exists, else ID) |
get_display_id() |
STRING | INTEGER |
Get Comments |
get_comments() |
LIST<Comment> |
Get Attachments |
get_attachments() |
LIST<Attachment> |
Tags:
Tag Fields |
||
Field |
Internal Field Name |
Data Type |
Value |
value |
STRING |
Project:
Project Fields |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Custom ID |
custom_formatted_id |
STRING |
Date Created |
date_created |
DATETIME |
Title |
title |
STRING |
Estimated Complete Date |
estimated_complete_date |
DATETIME |
Date Started |
date_started |
DATETIME |
Date Completed |
date_completed |
DATETIME |
Percent Completion |
percent_completion |
INTEGER |
Days Until Due |
days_until_due |
INTEGER |
Result |
result |
STRING |
<Tech> |
tech |
QBENCH OBJECT |
tags |
LIST<Tag> |
|
orders |
LIST<Order> |
|
samples |
LIST<Sample> |
|
sources |
LIST<Source> |
Control:
Control Fields |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Result |
result |
STRING |
Notes |
notes |
STRING |
Test ID |
test_id |
INTEGER |
Invoice:
Invoice Fields |
||
QBench Object Relationship |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Invoice Date |
invoice_date |
DATETIME |
Due Date |
due_date |
DATETIME |
Notes |
notes |
STRING |
Paid |
paid |
BOOLEAN |
Date Paid |
date_paid |
DATETIME |
Status |
status |
STRING |
Total |
total |
DECIMAL(19,2) |
invoice_items |
LIST<InvoiceItem> |
|
order |
QBENCH OBJECT |
|
Invoice Model Helper Functions |
||
Get Display ID (Custom ID if exists, else ID) |
get_display_id() |
STRING | INTEGER |
Get Comments |
get_comments() |
LIST<Comment> |
Get Attachments |
get_attachments() |
LIST<Attachment> |
Get Customer |
get_customer() |
OBJECT |
Invoice Item:
Invoice Item Fields |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Name |
name |
STRING |
Rate |
base_price |
DECIMAL(19,2) |
Quantity |
quantity |
INTEGER |
Discount |
discount |
FLOAT |
Surcharge |
surcharge |
FLOAT |
Amount |
amount |
DECIMAL(19,2) |
Invoice Item Type |
invoice_item_type |
STRING |
assay |
QBENCH OBJECT |
|
panel |
QBENCH OBJECT |
|
invoice |
QBENCH OBJECT |
|
turnaround |
QBENCH OBJECT |
|
Invoice Items Model Helper Functions |
||
Get Expiring Stock By Date Range |
get_expiring_stock_by_date_range() |
LIST<InventoryStock> |
Payment:
Payment Fields |
||
QBench Object Relationship |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Date Created |
date_created |
DATETIME |
Payment Date |
payment_date |
DATETIME |
Last Updated |
last_updated |
DATETIME |
Customer ID |
customer_id |
INTEGER |
Amount |
amount |
DECIMAL(19,2) |
Unapplied Amount |
unapplied_amount |
DECIMAL(19,2) |
Check Number |
check_number |
STRING |
Template ID |
template_id |
INTEGER |
customer |
QBENCH OBJECT |
Quotation:
Quotation Fields |
||
QBench Object Relationship |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
UUID |
uuid
|
STRING |
Date Created |
date_created |
DATETIME |
Status |
status
|
STRING |
Quotation Date |
quotation_date
|
DATETIME |
Payment Term |
payment_term
|
STRING |
Payment Term Days |
payment_term_days
|
INTEGER |
Description |
description
|
STRING |
Expiration Date
|
expiration_date
|
DATETIME |
customer |
QBENCH OBJECT |
|
Title |
title |
STRING |
Discount |
discount |
FLOAT |
Sub Total |
sub_total |
DECIMAL(19,2) |
Total |
total |
DECIMAL(19,2) |
Email To |
email_to |
STRING |
Date Emailed |
date_emailed |
DATETIME |
Notes |
notes |
STRING |
First Name |
first_name |
STRING |
Last Name |
last_name |
STRING |
Email Address |
email_address |
STRING |
Company Name |
company_name |
STRING |
Location:
Location Fields |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Name |
name |
STRING |
Description |
description |
STRING |
Tags |
tags |
LIST |
Location Model Helper Functions |
||
Get Total Samples |
get_total_samples() |
INTEGER |
Get Sub Location IDs |
get_sub_location_ids() |
LIST<Integer> |
Get Parent Locations |
get_parents() |
LIST<Location> |
Get Comments |
get_comments() |
LIST<Comment> |
Get Attachments |
get_attachments() |
LIST<Attachment> |
Inventory Stock:
Inventory Stock |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Item ID |
item_id |
INTEGER |
item |
QBENCH OBJECT |
|
Lot Number |
lot_number |
STRING |
Location ID |
location_id |
INTEGER |
location |
QBENCH OBJECT |
|
Expiration Date |
expiration_date |
DATE |
Received Date |
received_date |
DATE |
Quantity |
quantity |
INTEGER |
Notes |
notes |
STRING |
Consumed |
consumed |
BOOLEAN |
Date Consumed |
date_consumed |
DATE |
Quantity Used |
quantity_used |
INTEGER |
Quantity Available |
quantity_available |
INTEGER |
Supplier:
Supplier Fields |
||
Fields |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Supplier Name |
supplier_name |
STRING |
Phone |
phone |
STRING |
Fax |
fax |
STRING |
Address |
address |
STRING |
Comments |
comments |
STRING |
tags |
LIST<Tag> |
|
contacts |
LIST<Contact> |
Inventory Item:
Inventory Item |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Name |
name |
STRING |
Description |
description |
STRING |
Category ID |
category_id |
INTEGER |
<Category> |
category |
QBENCH OBJECT |
Supplier ID |
supplier_id |
INTEGER |
supplier |
QBENCH OBJECT |
|
Catalog Number |
catalog_number |
STRING |
Units |
units |
STRING |
Size |
size |
STRING |
available_stock |
LIST<InventoryStock> |
|
consumed_stock |
LIST<InventoryStock> |
|
tags |
LIST<Tag> |
|
Inventory Items Model Helper Functions |
||
Gets Inventory Stock Expiring By Date Range |
get_expiring_stock_by_date_range(start_date, end_date) |
LIST<InventoryStock> |
Equipment:
Equipment |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Name |
name |
STRING |
Description |
description |
STRING |
Model Number |
model_number |
STRING |
Manufacturer |
manufacturer |
STRING |
Serial Number |
serial_number |
STRING |
Date Purchased |
date_purchased |
DATE |
In Use Date |
in_use_date |
DATE |
Disposal Date |
disposal_date |
DATE |
Date Disposed |
date_disposed |
DATE |
State |
state |
STRING |
No Maintenance Required |
no_maintenance_required |
BOOLEAN |
Location ID |
location_id |
INTEGER |
location |
QBENCH OBJECT |
|
Supplier ID |
supplier_id |
INTEGER |
supplier |
QBENCH OBJECT |
|
Asset ID of Equipment Image (Internal Use) |
image_asset_id |
INTEGER |
tags |
LIST<Tag> |
|
records |
LIST<Record> |
|
schedules |
LIST<Schedule> |
|
Equipment Model Helper Functions |
||
Get Next Due Date Schedule |
get_next_due_date_schedule() |
QBENCH OBJECT |
Get Equipment Next Due Date Record |
get_next_due_date_record() |
QBENCH OBJECT |
Get Sorted Schedules |
get_sorted_schedules() |
LIST<Schedule> |
Get Sorted Schedules Without Records |
get_sorted_schedules_without_records() |
LIST<Schedule> |
Get Equipment Comments |
get_comments() |
LIST<Comment> |
Get Attachments |
get_attachments() |
LIST<Attachment> |
Batch:
Batch |
||
Field |
Internal Field Name |
Type |
ID |
id |
INTEGER |
Custom ID |
custom_formatted_id |
STRING |
Display Name |
display_name |
STRING |
Date Created |
date_created |
DATETIME |
Assay ID |
assay_id |
INTEGER |
assay |
QBENCH OBJECT |
|
tags |
LIST<Tag> |
|
Platemap Format |
platemap_format |
STRING |
Parent <Batch> LIST |
parents |
LIST<Batch> |
Child <Batch> LIST |
children |
LIST<Batch> |
Associated <Sample> LIST |
samples |
LIST<Sample> |
Associated <Test> LIST |
tests |
LIST<Test> |
Associated <Equipment> LIST |
equipment_list |
LIST<Equipment> |
Associated <Inventory Stock> LIST |
inventory_stocks |
LIST<InventoryStock> |
Protocol ID |
protocol_id |
INTEGER |
protocol |
QBENCH OBJECT |
|
Protocol Step ID |
current_batch_protocol_step_id |
INTEGER |
current_batch_protocol_step |
QBENCH OBJECT |
|
Worksheet ID |
worksheet_id |
INTEGER |
worksheet |
QBENCH OBJECT |
|
Platemap |
platemap |
DICTIONARY |
Batch Model Helper Functions |
||
Get Worksheet Configurations |
get_worksheet_config() |
STRING |
Get Worksheet Data |
get_worksheet_data() |
DICTIONARY |
Get Batches With Other Batches |
get_all_batch_batches() |
LIST<Batch> |
Get Sample Batches |
get_all_batch_samples() |
LIST<Sample> |
Get Test Batches |
get_all_batch_tests() |
LIST<Test> |
Get Equipment By Batches |
get_all_batch_equipment() |
LIST<Equipment> |
Get Batch Equipment Usage |
get_all_batch_equipment_usage() |
LIST<EquipmentUsage> |
Get Batch Inventory Stock |
get_all_batch_inventory_stocks() |
LIST<InventoryStock> |
Get Batch Inventory Stock Usage |
get_all_batch_inventory_stocks_usage() |
|
Get Display ID (Custom ID if exists, else ID) |
get_display_id() |
STRING | INTEGER |
Get Batch Comments |
get_comments() |
LIST<Comment> |
Get Batch Attachments |
get_attachments() |
LIST<Attachment> |
Accessioning Type: |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Value |
value |
STRING |
Active |
active |
BOOLEAN |
Comment: |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
User |
user |
<USER OBJECT> |
Contact |
contact |
|
Message |
message |
STRING |
Date Created |
date_created |
DATETIME |
Turnaround Fields |
||
Field |
Internal Field Name |
Data Type |
ID |
id |
INTEGER |
Name |
name |
STRING |
Default Duration |
default_duration |
INTEGER |
Default Percentage Surcharge |
default_percentage_surcharge |
FLOAT |
Default Flat Surcharge |
default_flat_surcharge |
FLOAT |
Comments
0 comments
Article is closed for comments.