Labii Documentation
HomeFree SignupFree DemoContact Us
  • Getting Started
    • Introduction
    • Quick Start
  • User Guide
    • Interface
      • Side Menu
      • Views
    • Add Record
      • Add a project
      • Add a blank record
      • Add records in bulk
      • Add a record from a template
      • Add record(s) from file(s)
      • Add a template
    • Record List View
      • Table List View
      • Project List View
      • Row List View
      • ❗Import Records
      • Export Records
      • Bulk Operations
        • Bulk Edit Columns
        • Bulk Edit Sections
        • Bulk Print Detail
        • Bulk Print Labels
        • Bulk Print Barcodes
        • Bulk Print QR Codes
        • Bulk Download
        • Use Selected to Add Blank Record
        • Use Selected to Bulk Add Records
    • Record Detail View
      • Columns
      • Sections
      • Notes
      • Signers
      • Versions
      • Activities
      • Visitors
      • Permissions
      • Section
      • Actions
        • Sign
        • Print
        • Share
    • Navbar
      • Search
        • Global search
        • Search at list view
        • Search query
      • Scan
    • Side Menu
      • Dashboard
      • Calendar
      • Notifications
      • Reload Organization
      • Switch Organization
      • Change Data Center
    • Accounts
      • Authentication
      • Setup an account
      • Create an account
      • My Profile
    • AI Integration
      • Prompt box
      • Prompt template
      • ProtocolGPT
      • AI in Widgets
      • Use cases
  • Admin Guide
    • Organization
    • Backups
    • Personnel
    • Certifications
    • Teams
    • Projects
      • Members
    • Applications
    • Tables
      • Columns
      • Sections
      • Filters
    • Workflows
    • Widgets
    • Subscriptions
    • Credits
    • Invoices
    • Single Sign On
      • Google G Suite
      • Okta
      • OneLogin
      • Microsoft Azure
    • API Keys
  • Widgets
    • Overview
    • Column Widgets
      • Form
        • Text inputs
          • Text
          • MultilineText
          • RichText
          • Number
          • RangeUnit
          • Email
          • Phone
          • Secret
          • Link
          • Address
        • Boolean
          • Checkbox
          • Switch
        • DateTime
          • Date
          • Time
          • DateTime
          • Appointment
          • TimeStamp
          • Timezone
        • Dropdown
          • Select
          • MultiSelect
          • ForeignKey
          • ForeignKeys
          • Member
          • Members
        • File
          • Files
          • Image
          • File Path
          • File Size
          • File Antivirus Status
      • Barcode
        • Barcode
        • QR Code
      • Calculation
        • Formula
        • Numbering
        • RowCount
        • Consumption
      • Integration
        • API
          • API
        • Dropdown
          • API ForeignKey
          • API ForeignKeys
      • Column
        • Record Citation
        • Column Citation
        • Column Data
        • Column Addition
      • Regulation
        • Signature
          • Signature
          • Open Signature
          • Signature Status
      • ❗Chemistry
      • ❗PubMed
      • ❗Device
      • ❗Integration
      • Advanced
        • Subtitle
        • Rating
        • Nested Fields
        • Storage Coordinates
    • Section Widgets
      • Office
        • Text
          • Plain Text
          • CKEditor Classic
          • CKEditor Balloon
          • CKEditor Document
          • CKEditor Restricted
          • CKEditor Classic Controlled
          • Code Editor
        • ❗Table
        • File
          • Files
          • File Preview
        • Google Drive
        • Drawing
        • G Suite
        • Microsoft Office
      • Data Display
        • Columns
          • Columns
          • Metadata
        • Sections
          • Section Display By Record
          • Section Display By ForeignKey
        • Record List
          • Record List
          • Record List by Column
          • Record List by ForeignKey
          • Record List by Query
      • ✅Regulation
        • Signers
        • ✅Audit Trail
          • ✅Activities
          • Versions
          • Visitors
      • Process Management
        • Flowchart
        • Steps
      • Diagram
        • Mermaid
        • Gantt Chart
        • Stage Flowchart
        • Relation Flowchart
      • Reference Manager
      • Biology
        • Plasmid Editor
        • Open Vector Editor
        • Microplate
          • 6-Well Plate
          • 12-Well Plate
          • 24-Well Plate
          • 48-Well Plate
          • 96-Well Plate
          • 384-Well Plate
          • Flexible Well Plate
        • Sample Aliquoting
        • Assay
          • ELISA Standard Curve
          • ELISA Qualitative
          • Dose Response Curve
        • Protein
          • MolStar
          • RCSB Saguaro
        • Bioinformatics
          • QUiCKR Analysis
          • CRISPResso2
      • Chemistry
        • Chemical Formats
        • Chemical Drawing
        • Chemical Analysis
        • Chemical Reaction
      • Combination
        • Clinical Genomicist Workstation
      • Productivity
        • ✅Calendars
          • Calendar
          • Scheduling
        • Automation
          • Workflows
        • Ungrouped
          • Storage Map
        • Table of Contents
        • Communication
          • Email Template
          • Notifications
          • Comments
        • Barcode
        • ToDo
        • Timer
      • Report
        • Record Summary
          • Record Summary
        • Data Driven Charts
          • Chart By Category X
          • Chart By Numeric X
        • Custom Input Charts
          • Data Visualizer
    • Dashboard Widgets
      • Labii
      • Shortcut
        • Applications
        • Links
        • Filters
      • Productivity
        • Office
        • Flowchart
        • Section
        • Project Management
          • ✅Tasks
        • Summary
      • ✅Reports
        • Record Summary
          • Record Summary By Date
          • Record Summary By Tables
          • Record Summary By Projects
          • Record Summary By Users
        • Data Driven Charts
          • Chart By Category X
          • Chart By Numeric X
        • Matrix
          • Record Count By Filter
        • Audit
          • Storage Audit
      • Integration
        • Quickbooks
          • Quickbooks Customers
          • Quickbooks Accounts
          • Quickbooks Items
          • Quickbooks Invoices
  • API
    • Concepts
      • How to get token from Labii ELN & LIMS
      • How can I load Labii data from API into DataFrame
    • Methods
      • Authentication
      • Notification
      • Organization
      • Personnel
      • Team
      • Organization Widget
      • Statement
      • Backup
      • Project
      • Member
      • Table
      • Column
      • Filter
      • Row
      • Cell
      • Section
      • Activity
      • Version
      • Visitor
      • Workflow
      • Step
      • Widget
    • Variables
    • SDK
      • API Client (python)
      • API Client (javascript)
      • SDK (python)
      • SDK (javascript)
      • Examples
  • Applications
    • Electronic Lab Notebook
      • ELN for Research and Development
      • ELN for Production
      • ELN for ELISA Data Analysis
      • ELN for Dose Response Curve
    • Process Management
      • ❗Report creating process in diagnosis testing
      • ❗Email follow up process in CRM
      • ❗Management of the purchasing, approval, and ordering processes.
    • Sample Management
      • Sample Receiving
      • Track sample consumption
      • Aliquots Management
    • Equipment Management
      • ❗Equipment Scheduling
      • ❗Equipment Maintenance
    • Inventory Management
      • Barcode System
      • Stock Checkin and Checkout
      • Storage Management
      • ❗Purchase Management
    • Laboratory Information Management System
      • LIMS for Sample Testing
      • LIMS for NGS
    • Customer Relationship Management (CRM)
      • Quickbooks Integration
    • Document Management
    • Chemical Registration
    • Mouse Colony Management
    • Diagnostic Testing
    • Diabetes Tracker
    • Project Management
      • Task Management
      • How to manage research goals
    • Reference Management
    • Training Management
  • Support
    • Overview
    • Documentation
    • YouTube
    • Videos
    • Tickets
    • Chat with us
    • Schedule a meeting
    • Take a survey
    • Resources
    • Download
    • Blogs
    • FAQ
    • Other
      • Guidelines for Preparing Documents on Research Needs for Labii Configuration
Powered by GitBook
On this page
  • Usage
  • Initial SDK
  • Objects
  • Methods
  • create
  • retrieve
  • list
  • modify
  • delete
  • File operations
  • upload
  • watch_folder
  • Other
  • Switch organization
  • Get columns
  1. API
  2. SDK

SDK (python)

Labii SDK

PreviousAPI Client (javascript)NextSDK (javascript)

Last updated 1 year ago

SDK is the toolkit with prebuilt Labii components that developers use to interact with Labii APIs. Full documentation available at

Usage

  1. Install the Labii SDK

pip install labii-sdk

2. Import the package

from labii_sdk.sdk import LabiiObject

3. Initial the API object

labii = LabiiObject(
    api_key="xxx",
    organization__sid="xxx"
)

4. Start querying

# get a list of tables
labii.Tables.list()

Initial SDK

During SDK initiation, the following parameters can be customized:

  • base_url, the server base URL, defaults to . If you are using a different data center, make sure to change the base_url setting.

  • api_key , the API Key to get authenticated.

  • organization__sid, your organization sid. You can find it by logging into Labii () and going to Side menu -> Settings -> Organization -> Sid

  • api, the APIObject. If a new APIObject is not provided, it will be automatically created. Utilize this functionality when you require authentication for the API before initializing a Labii Object.

labii = LabiiObject(
    base_url="https://www.labii.dev",
    api_key="xxx"
    organization__sid=None
    api=None
)

Objects

  • Profile

  • APIKey

  • Organization

  • Application

  • Subscription

  • People

  • Team

  • SAML

  • OrganizationWidget

  • Backup

  • Project

  • ProjectMember

  • Table

  • Column

  • Section

  • Filter

  • Record

  • Cell

  • Version

  • Visitor

  • Activity

  • Workflow

  • Step

  • Widget

  • Dashboard

  • Notification

Methods

A list of methods for interacting with objects.

create

Create a object.

  • query (optional), additional query to limit the results.

# Create a project
labii.Project.create({name="test", ...})

# Create a table
labii.Table.create({name_singular="test", ...})

# Create a row
labii.Record.create{{name="test", ...}, query="table__sid=xxx"}

retrieve

Return a object

  • sid, the sid of the object

  • query (optional), additional query to limit the results.

# Return a project
labii.Project.retrieve("psvy0a40x18c0rwBGLQV1")

# Return a record
labii.Row.retrieve("psvy0a40x18c0rwBGLQV1")

list

Get a list of objects

  • page (default=1), the page number to return.

  • page_size (default=10), the number of items to be paginated.

  • all_pages (bool, default=False), Whether all pages should be returned. When False, only return the data for the first page. Only applies to list views.

    • name, return only sid and name, very fast

    • list, return selected fields of the objects, fast

    • detail, return all fields of the objects, slow

  • query (optional), additional query to limit the results.

# Return first page of experiment records
labii.Row.list(
    page=1,
    page_size=10,
    all_pages=False,
    level="organization",
    serializer="name",
    query="table__sid=psvy0a40x18c0rwBGLQV1&is_archived=false"
)

# Return list of projects
labii.Project.list()

modify

Edit an object

  • sid, the sid of the object

  • query (optional), additional query to limit the results.

# modify the name of a project
labii.Project.modify(
    sid="psvy0a40x18c0rwBGLQV1",
    data={"name": "new name"}
)

delete

Remove an object

  • sid, the sid of the object

  • query (optional), additional query to limit the results.

Not all objects can be deleted. A 405 error will be displayed if an object cannot be deleted.

# remove the permission of a user
labii.ProjectMember.delete("psvy0a40x18c0rwBGLQV1")

File operations

Labii also developed a few functions to facilitate the file uploading.

upload

Upload a file to Labii

  • file_path, the full file path

  • projects , list of projects in the format of [{"sid": "project__sid"}]

# upload a file
from labii_sdk.sdk import LabiiObject
labii = LabiiObject(api_key="xxx", organization__sid="xxx")
file_record = labii.upload("/tmp/test.txt", [{"sid":"xxx"}])

watch_folder

You can use this function to watch a particular folder. As soon as the file(s) are present, the function will upload each file to Labii and move the file to the "uploaded" subfolder. This function allows you to upload files generated by a machine/equipment automatically.

Version 1.9 or later is required to use this function.

  • folder_path, required, the folder (including the path) to watch. default to current path.

  • projects, required, list of projects in the format of [{"sid": "project__sid"}]

  • interval, optional, time interval to check the folder, default to 5 seconds.

// Watch a results folder
from labii_sdk.sdk import LabiiObject
labii = LabiiObject(api_key="xxx", organization__sid="xxx")
labii.watch_folder(folder_path="./results", [{"sid":"xxx"}])

Other

Switch organization

Utilize this function for seamlessly transitioning between various organizations. This will prove especially advantageous when transitioning from a test organization to a production organization.

// switch organization
from labii_sdk.sdk import LabiiObject
labii = LabiiObject(api_key="xxx", organization__sid="xxx")
labii.switch_organization(organization__sid)

Get columns

When you're in the process of generating a new record, it's frequently necessary to have the column SID in order to prepare the data object. In Python, obtaining the index of an object in an array isn't always a straightforward task. This is why we have developed this function to simplify the coding process when working with the Labii SDK.

from labii_sdk.sdk import LabiiObject
labii = LabiiObject(api_key="xxx", organization__sid="xxx")

# get sample table
table = labii.Table.list(query="name_singular=sample", serializer="name")["results"][0]
columns = labii.get_columns(f"table__sid={table['sid']}&name__in=volume,concentration,storage")
print(columns)

{
    "volume": "70cf0a40x459cb9dinsxCH",
    "concentration": "9beh0a40x459cdafkpuzEJ",
    "source_samples": "0cfi0a40x459cebglqvAFK",
    "storage": "behk0a40x459d0dinsxCHM",
    "storage_coordinates": "cfil0a40x459d1ejotyDIN"
}

Labii objects for interaction. Learn more at

data (dict), a JSON dict data to post. Learn more at

level (default to "organization"), the scope of records to retrieve. Learn more at

serializer (default to "list"), the scope of fields of the return data. Learn more at

data (dict), a JSON dict data to post. Learn more at

https://docs.labii.com/api/overview
https://www.labii.dev
https://www.labii.com/login/
https://docs.labii.com/api/overview#objects
https://docs.labii.com/api/methods
https://docs.labii.com/api/overview#levels
https://docs.labii.com/api/overview#serializer
https://docs.labii.com/api/methods