Entities

class pyclarity_lims.entities.Artifact(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Any process input or output; analyte or file.

concentration

_

container

The container where the artifact is located, or None

files

List of files associated with the artifact.

get_state()[source]

Parse out the state value from the URI.

input_artifact_list()[source]

Returns the input artifact ids of the parent process.

location

The Artifact’s location in a container.

name

The name of the artifact.

output_type

The output-type of the Artifact

parent_process

The parent process that generated this artfact.

qc_flag

The qc-flag applied to the Artifact.

reagent_labels

List of Reagent labels associated with the artifact.

samples

List of Samples associated with this artifact.

state

Parse out the state value from the URI.

stateless

Return the artifact independently of its state

type

The type of the artifact: Analyte, ResultFile or SharedResultFile.

udf

Dictionary of UDFs associated with the artifact.

volume

_

workflow_stages

List of workflow stage Steps that this artifact ran through.

workflow_stages_and_statuses

List of tuples containing three elements (A, B, C) where:

  • A is a Step this artifact has run through.
  • B is the status of said Step.
  • C the name of the Step.
working_flag

The working-flag of the Artifact.

class pyclarity_lims.entities.Container(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Container for analyte artifacts.

get_placements()[source]

Get the dictionary of locations and artifacts using the more efficient batch call.

name

Name of the container

occupied_wells

Number of wells occupied in the container.

placements

Dictionary of placements in a Container. The key is the location such as “A:1” and the value is the artifact in that well/tube.

state

State of the container. e.g. Populated

type

Type of the container.

udf

Dictionary of UDFs associated with the container.

udt

Dictionary of UDTs associated with the container.

class pyclarity_lims.entities.Containertype(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Type of container for analyte artifacts.

calibrant_wells

If there are any wells on this container that are use for calibration. They would be defined here.

name

Name of the type of container (Tube, 96 well plates, …)

unavailable_wells

If there are any well on this container that should not be used. They would be defined here.

x_dimension

Number of position on the x axis

y_dimension

Number of position on the y axis

class pyclarity_lims.entities.Entity(lims, uri=None, id=None, _create_new=False)[source]

Bases: object

Base abstract class for every entity in the LIMS database. An Entity corresponds to an XML document and as such it should have at least a uri or an id.

classmethod create(lims, **kwargs)[source]

Create an instance from attributes then post it to the LIMS

get(force=False)[source]

Get the XML data for this instance.

id

Return the LIMS id; obtained from the URI.

post()[source]

Save this instance with POST

put()[source]

Save this instance by doing PUT of its serialized XML.

uri
class pyclarity_lims.entities.File(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

File attached to a project or a sample.

attached_to

The uri of the Entity this file is attached to

content_location

The location of the file on the server

is_published

Whether the file is published or not

original_location

The original location of the file when it was uploaded

class pyclarity_lims.entities.Lab(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

A lab is a list of researchers.

billing_address

Billing address of the lab

externalids

List of external identifiers associated with the lab

name

Name of the lab

shipping_address

Shipping address of the lab

udf

Dictionary of UDFs associated with the Lab

udt

Dictionary of UDTs associated with the Lab

website

URL to the lab website

class pyclarity_lims.entities.Note(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Note attached to a project or a sample.

content

The content of the note

class pyclarity_lims.entities.Process(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Process (instance of Processtype) executed producing ouputs from inputs.

all_inputs(unique=True, resolve=False)[source]

Retrieving all input artifacts from input_output_maps. If unique is true, no duplicates are returned.

Parameters:
  • unique – boolean specifying if the list of artifacts should be uniqued
  • resolve – boolean specifying if the artifacts entities should be resolved through a batch query.
Returns:

list of input artifacts.

all_outputs(unique=True, resolve=False)[source]

Retrieving all output artifacts from input_output_maps. If unique is true, no duplicates are returned.

Parameters:
  • unique – boolean specifying if the list of artifacts should be uniqued
  • resolve – boolean specifying if the artifact entities should be resolved through a batch query.
Returns:

list of output artifacts.

analytes()[source]

Retrieving the output Analytes of the process, if existing. If the process is not producing any output analytes, the input analytes are returned. Input/Output is returned as an information string. Makes aggregate processes and normal processes look the same.

date_run

The date at which the process was finished in format Year-Month-Day i.e. 2016-12-05.

files

List of files associated with the sample.

input_output_maps

List of tuples (input, output) where input and output item are dictionaries representing the input/output. Keys of the dict can be:

  • for the input:

    • post-process-uri: input Artifact
    • uri: input Artifact
    • limsid: lims id of the input artifact
    • parent-process: Process that generated this input
  • for the output:

    • uri: output Artifact
    • limsid: id of the Artifact generated
    • output-generation-type: type of output generation (example: PerInput)
    • output-type: type of artifact generated (Analyte, or ResultFile)
input_per_sample(sample)[source]

Getting all the input artifacts derived from the specified sample

Parameters:sample – the sample name to check against
Returns:list of input artifacts matching the sample name
output_containers()[source]

Retrieve all unique output containers

outputs_per_input(inart, ResultFile=False, SharedResultFile=False, Analyte=False)[source]

Getting all the output artifacts related to a particular input artifact

Parameters:
  • inart – input artifact id or artifact entity use to select the output
  • ResultFile – boolean specifying to only return ResultFiles.
  • SharedResultFile – boolean specifying to only return SharedResultFiles.
  • Analyte – boolean specifying to only return Analytes.
Returns:

output artifact corresponding to the input artifact provided

parent_processes()[source]

Retrieving all parent processes through the input artifacts

process_parameter

Parameter for the process

protocol_name

The name of the protocol

result_files(output_generation_type=None)[source]

Retrieve all output artifacts where output-type is ResultFile.

Parameters:output_generation_type – string specifying the output-generation-type (PerAllInputs or PerInput)
Returns:list of output artifacts.
shared_result_files(output_generation_type=None)[source]

Retrieve all output artifacts where output-type is SharedResultFile.

Parameters:output_generation_type – string specifying the output-generation-type (PerAllInputs or PerInput)
Returns:list of output artifacts.
step

Retrieve the Step corresponding to this process. They share the same id

technician

The researcher that started the step.

type

The type of the process

udf

Dictionary of UDFs associated with the process.

Note that the UDFs cannot be modify in Process. Use Step details to modify UDFs instead. You can access them with process.step.details.udf

udt

Dictionary of UDTs associated with the process.

class pyclarity_lims.entities.Processtype(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

name

Name of the process type.

class pyclarity_lims.entities.Project(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Project concerning a number of samples; associated with a researcher.

close_date

The date at which the project was closed in format Year-Month-Day i.e. 2016-12-05.

externalids

List of external identifiers associated with the project

files

List of files attached to the project

invoice_date

The date at which the project was invoiced in format Year-Month-Day i.e. 2016-12-05.

name

The name of the project.

open_date

The date at which the project was opened in format Year-Month-Day i.e. 2016-12-05.

researcher

The researcher associated with the project.

udf

Dictionary of UDFs associated with the project

udt

Dictionary of UDTs associated with the project

class pyclarity_lims.entities.Protocol(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Protocol, holding ProtocolSteps and protocol-properties

properties

List of dicts describing the protocol’s property.

steps

List of steps

class pyclarity_lims.entities.ProtocolStep(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Steps key in the Protocol object

epp_triggers

List of dicts describing the EPP trigger attached to this step.

name

Name of the step

permitted_containers

List of names for the permitted container type in that step.

queue

The queue associated with this protocol step. The link is possible because they share the same id.

queue_fields

List of dicts describing the fields available in that step’s queue.

sample_fields

List of dicts describing the field available in that step’s sample view.

step_fields

List of dicts describing the fields available in that step’s UDF.

step_properties

List of dicts describing the properties of this step.

type

Processtype associated with this step.

class pyclarity_lims.entities.Queue(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Queue of a given workflow stage

artifacts

List of artifacts associated with this workflow stage.

queued_artifacts

List of artifacts associated with this workflow stage alongside the time they’ve been added to that queue and the container they’re in. The list contains tuples organised in the form (A, B, (C, D)), where:

  • A is an artifact
  • B is a datetime object,
  • C is a container
  • D is a string specifying the location such as “1:1”
class pyclarity_lims.entities.ReagentKit(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Type of Reagent with information about the provider

archived

Whether the reagent kit is archived or not

name

Name of the reagent kit

supplier

Supplier for the reagent kit

website

Website associated with the reagent kit

class pyclarity_lims.entities.ReagentLot(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Information about a particular regaent lot used in a step

created_by

Researcher that created that lot.

created_date

The date at which the lot was created in format Year-Month-Day i.e. 2016-12-05.

expiry_date

The date at which the lot expires in format Year-Month-Day i.e. 2016-12-05.

last_modified_by

Researcher that last modified this lot.

last_modified_date

The date at which the lot was last modified in format Year-Month-Day i.e. 2016-12-05.

lot_number

Lot number

name

Name of the reagent lot

reagent_kit

Reagent kit associated with this lot.

status

Status of the lot.

usage_count

Number of times the lot was used.

class pyclarity_lims.entities.ReagentType(lims, uri=None, id=None)[source]

Bases: pyclarity_lims.entities.Entity

Reagent Type, usually indexes for sequencing

category

Reagent category associated with the type

name

Name of the reagent type.

class pyclarity_lims.entities.Reagent_label(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Reagent label element

reagent_label

The reagent label

class pyclarity_lims.entities.Researcher(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Person; client scientist or lab personnel. Associated with a lab.

email

Email of the researcher

externalids

List of external identifiers associated with the researcher

fax

Fax number of the researcher

first_name

First name of the researcher

initials

Initials of the researcher

lab

Lab associated with the researcher

last_name

Last name of the researcher

name

Complete name of the researcher

phone

Phone number of the researcher

udf

Dictionary of UDFs associated with the researcher

udt

Dictionary of UDTs associated with the researcher

class pyclarity_lims.entities.Sample(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Customer’s sample to be analyzed; associated with a project.

artifact

Initial Artifact associated with the sample.

classmethod create(lims, container, position, **kwargs)[source]

Create an instance of Sample from attributes then post it to the LIMS

date_completed

The date at which the sample was completed in format Year-Month-Day i.e. 2016-12-05.

date_received

The date at which the sample was received in format Year-Month-Day i.e. 2016-12-05.

externalids

List of external identifiers associated with the sample

files

List of files associated with the sample.

name

Name of the sample.

notes

List of notes associated with the sample.

project

The project associated with that sample.

submitter

The researcher who submitted this sample.

udf

Dictionary of UDFs associated with the sample.

udt

Dictionary of UDTs associated with the sample.

class pyclarity_lims.entities.Stage(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Holds Protocol/Workflow

index

Position of the stage in the protocol.

name

Name of the stage.

protocol

Protocol associated with this stage.

step

Step associated with this stage.

workflow

Workflow associated with the stage.

class pyclarity_lims.entities.Step(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Step, as defined by the genologics API.

actions

Link to the StepActions entity

advance()[source]

Send a post query to advance the step to the next step

available_programs

List of available programs to trigger. Each element is a tuple with the name and the trigger uri

configuration

Step configuration associated with the step.

classmethod create(lims, protocol_step, inputs, container_type_name=None, reagent_category=None, replicates=1, **kwargs)[source]

Create a new instance of a Step. This method will start a step from queued artifacts.

Parameters:
  • lims – Lims connection object
  • protocol_step – the ProtocolStep specifying the step to start.
  • inputs – A list of artifacts as input to the step. These need to be queued for that step for the query to be successful.
  • container_type_name – optional name of the type of container that this step use for its output. if omitted it uses the required type from the ProtocolStep if there is only one.
  • reagent_category – optional reagent_category.
  • replicates – int or list of ints specifying the number of replicates for each inputs.
current_state

The current state of the step.

date_completed

The date at which the step completed in format Year-Month-DayTHour:Min:Sec, e.g. 2016-11-22T10:43:32.857+00:00

date_started

The date at which the step started in format Year-Month-DayTHour:Min:Sec, e.g. 2016-11-22T10:43:32.857+00:00

details

Link to the StepDetails entity

placements

Link to the StepPlacements entity

pools

Link to the StepPools entity

process

Retrieve the Process corresponding to this Step. They share the same id

program_names

List of available program names.

program_status

Link to the StepProgramStatus entity

reagent_lots

List of reagent lots

set_placements(output_containers, output_placement_list)[source]

Create a new placement for a new step. This method also modifies the selected containers with the provided output container. It is meant to be used with a newly created step that does not have a placement yet.

Parameters:
  • output_containers – List of Containers used to store the output artifacts.
  • output_placement_list

    List of tuples (A, (B, C)) where:

    • A is an artifact,
    • B is a container,
    • C is a string specifying the location in the container such as “1:1”
trigger_program(name)[source]

Trigger a program of the provided name.

Parameters:name – the name of the program.
Returns:the program status.
Raises:ValueError – if the program does not exist.
class pyclarity_lims.entities.StepActions(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Actions associated with the end of the step

escalation
next_actions
List of dicts that represent an action for an artifact. They keys of the dict are:
  • artifact: The artifact associated with this Action
  • step: The next step associated with this action
  • rework-step: The step associated with this action when the Artifact needs to be requeued
  • action: The type of action to perform.
    • leave: Leave the sample in the QC protocol.
    • repeat: Repeat this step.
    • remove: Remove from workflow.
    • review: Request manager review.
    • complete: Mark protocol as complete.
    • store: Store for later.
    • nextstep: Continue to the next step.
    • rework: Rework from an earlier step.
    • completerepeat: Complete and Repeat
    • unknown: The action is unknown.
step

Step associated with the actions.

class pyclarity_lims.entities.StepDetails(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Details associated with a step

input_output_maps

List of tuples (input, output) where input and output item are dictionaries representing the input/output. Keys of the dict can be:

  • for the input:
    • post-process-uri: input Artifact
    • uri: input Artifact
    • limsid: lims id of the input artifact
    • parent-process: Process that generated this input
  • for the output:
    • uri: output Artifact
    • limsid: id of the Artifact generated
    • output-generation-type: type of output generation (example: PerInput)
    • output-type: type of artifact generated (Analyte, or ResultFile)
udf

Dictionary of UDFs associated with the step

udt

Dictionary of UDTs associated with the step

class pyclarity_lims.entities.StepPlacements(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Placements from within a step. Supports POST

get_placement_list()[source]
get_selected_containers()[source]
placement_list

List of tuples (A, (B, C)) where:

  • A is an artifact
  • B is a container
  • C is a string specifying the location in the container such as “1:1”
selected_containers

List of containers

set_placement_list(value)[source]
class pyclarity_lims.entities.StepPools(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

available_inputs

List of artifact available for pooling.

Note that adding artifacts to a pool will not remove them from this list until put() is run.

pooled_inputs

Dictionary where the keys are the pool names and the values are tuples (pool, inputs) representing a pool. Each tuple has two elements:

  • an output Artifact containing the pool.
  • a tuple containing the input artifacts for that pool.
put()[source]

Save this instance by doing PUT of its serialized XML.

class pyclarity_lims.entities.StepProgramStatus(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Status displayed in the step

message

Message returned by the program

status

Status of the program

class pyclarity_lims.entities.StepReagentLots(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

reagent_lots

List of ReagentLots

class pyclarity_lims.entities.Udfconfig(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Instance of field type (cnf namespace).

allow_non_preset_values

Whether the UDF allows presets.

attach_to_category

_

attach_to_name

Name of entity type the UDF is attached to.

first_preset_is_default_value

Whether the first preset of the UDF is the default value.

is_controlled_vocabulary

Whether the UDF has a controled vocabulary.

is_deviation

Whether the UDF is a deviation.

is_editable

Whether the UDF is editable.

name

Name of the UDF.

presets

List of presets.

Whether this UDF will be shown in lablink.

show_in_tables

Whether the UDF can be shown in a table.

class pyclarity_lims.entities.Workflow(lims, uri=None, id=None, _create_new=False)[source]

Bases: pyclarity_lims.entities.Entity

Workflow, introduced in 3.5

name

Name of the workflow.

protocols

List of protocols associated with this workflow.

stages

List of stages associated with this workflow.

status

Status of the workflow.