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
        • 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
        • Molecular Biology Suite
          • 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
  • Create a record
  • Create a entry
  • Create a sample
  • Create a section
  • Import RT-PCR CT Range
  1. API
  2. SDK

Examples

Examples to use the SDK

Create a record

Create a entry

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

# 1. get entry table
et = labii.Table.list(query="name_singular=entry", serializer="name")["results"][0]

# 2. get the project
project = labii.Project.list(query="name=Sample Project", serializer="name")["results"][0]

# 3. create the entry
et1 = labii.Record.create({
    "name": "Demo template",
    "projects": [{"sid": project["sid"], "name": "Sample Project"}],
    "is_template": True
}, query=f"table__sid={et['sid']}")

Create a sample

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

# 1. get sample table
sp = labii.Table.list(query="name_singular=sample", serializer="name")["results"][0]

# 2. get the project
project = labii.Project.list(query="name=Sample Project", serializer="name")["results"][0]

# 3. get the columns
columns = labii.get_columns(f"table__sid={sg['sid']}&name__in=volume,concentration,storage")

# 4. get the storage information
sg3 = labii.Record.list(query=f"table__name_singular=storage&uid=SG3", serializer="name")["results"][0]

# 5. create the sample
sp1 = labii.Record.create({
    "name": "Demo sample",
    "projects": [{"sid": project["sid"], "name": "Sample Project"}],
    columns["volume"]: 100,
    columns["concentration"]: 10,
    columns["storage"]: {"sid": sg3["sid"], "name": sg3["name"]},
}, query=f"table__sid={sp['sid']}")

Create a section

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

# 1. get record
ep1 = labii.Record.list(query=f"table__name_singular=experiment&uid=EP1", serializer="name")["results"][0]

# 2. add a Procedure section with CKEditor Classic widget
labii.Section.create({
	"data": {
		"html": "<h4>Procedure</h4><ol><li>Prepare the PCR solution based on the protocol: {protocol}</li><li>Based on the below table, the PCR cycle is used</li></ol><figure class=\"table\"><table><tbody><tr><td>#</td><td>Plant</td><td>Anneal Temp (°C)</td><td>Extension Time</td></tr><tr><td>1</td><td>xrn2-1</td><td>58</td><td>60s</td></tr><tr><td>2</td><td>xrn2-2</td><td>58</td><td>60s</td></tr></tbody></table></figure><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>"
	},
	"name": "Procedure",
	"widget": {"sid": "0cfi0a40x3abglqvAFK", "name": "CKEditor Classic"}
}, query=f"row__sid={et1['sid']}")

Import RT-PCR CT Range

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

# prepare data
table = labii.Table.list(query="name_singular=qPCR CT Range", serializer="name")["results"][0]
project = labii.Project.list(query="name=Sample Project", serializer="name")["results"][0]
columns = labii.get_columns(f"table__sid={table['sid']}&name__in=CT_low_start,CT_low_end,CT_medium_start,CT_medium_end,CT_high,recommended_treatment,antibiotic_resistance")
# import file
with open("qPCR_CT_Range.tsv", 'r') as file:
	for line in file:
		if not "CT_low_start" in line: # skip the first line
			data = line.split("\t")
			print(f"Importing {data[0]}...")
			labii.Record.create({
				"name": data[0].strip(),
				"projects": [{"sid": project["sid"], "name": "Sample Project"}],
				columns["CT_low_start"]: data[1].strip(),
				columns["CT_low_end"]: data[2].strip(),
				columns["CT_medium_start"]: data[3].strip(),
				columns["CT_medium_end"]: data[4].strip(),
				columns["CT_high"]: data[5].strip(),
				columns["recommended_treatment"]: data[6].strip(),
				columns["antibiotic_resistance"]: data[7].strip()
			}, query=f"table__sid={table['sid']}")
PreviousSDK (javascript)NextElectronic Lab Notebook

Last updated 1 year ago