Getting Started
This guide will help you install and set up Platform Status DB for your laboratory automation system.
Installation
Prerequisites
- Python 3.9 or higher
- pip package manager
- Git (for cloning the repository)
Install from GitLab
- Clone the repository:
git clone https://gitlab.com/OpenLabAutomation/lab-automation-packages/platform_status_db.git
cd platform_status_db
- Install the package:
- Install the laborchestrator dependency:
pip install --index-url https://gitlab.com/api/v4/projects/70366855/packages/pypi/simple "laborchestrator<0.3"
Verify Installation
Check that the installation was successful:
python -c "from platform_status_db.larastatus.status_db_implementation import StatusDBImplementation; print('Installation successful!')"
Initial Setup
1. Initialize the Database
Apply Django migrations to create the database schema:
python src/platform_status_db/manage.py makemigrations
python src/platform_status_db/manage.py migrate
This creates a SQLite database file at src/platform_status_db/db.sqlite3.
2. Create an Admin User
To access the Django admin interface, create a superuser:
You'll be prompted to enter: - Username - Email address - Password (entered twice)
3. Start the Server
Start the development server:
Or alternatively:
The server will start on http://127.0.0.1:8000/ by default.
Accessing the Web Interface
Admin Interface
Navigate to http://127.0.0.1:8000/admin/ and log in with the superuser credentials you created.
From the admin interface, you can: - Add and manage devices - View containers and their locations - Browse process steps and experiments - Manually edit database records
Job Logs Interface
Navigate to http://127.0.0.1:8000/job_logs/ to view: - Device list and status - Container locations - Process history - Movement tracking
Configuring Your Laboratory
Option 1: Using a Configuration File (Recommended)
Create a YAML configuration file describing your laboratory setup:
# lab_config.yaml
sila_servers:
robotic_arms:
RoboticArm1:
capacity: 10
type: "robot"
RoboticArm2:
capacity: 8
type: "robot"
readers:
PlateReader1:
capacity: 1
type: "reader"
BarcodeReader:
capacity: 1
type: "reader"
incubators:
Incubator1:
capacity: 20
type: "incubator"
Then load it programmatically:
from platform_status_db.larastatus.status_db_implementation import StatusDBImplementation
db = StatusDBImplementation()
db.create_lab_from_config("lab_config.yaml")
Option 2: Manual Configuration via Admin Interface
- Go to http://127.0.0.1:8000/admin/
- Click on "Devices" under JOB_LOGS
- Click "Add Device" in the top right
- Fill in the device details:
- Lara name: Unique identifier for the device
- Num slots: Number of positions/slots available
- Lara uri: URL endpoint for the device (e.g.,
http://192.168.1.100:50051) - Click "Save"
Positions are automatically created based on the number of slots.
Option 3: Programmatic Configuration
from platform_status_db.job_logs.models import Device, Position
# Create a device
device = Device.objects.create(
lara_name="RoboticArm1",
num_slots=10,
lara_uri="http://192.168.1.100:50051"
)
# Create positions (if not auto-created)
for i in range(device.num_slots):
Position.objects.create(
device=device,
slot_number=i,
deep_well_suited=False
)
First Steps with the API
Initialize the Status DB
from platform_status_db.larastatus.status_db_implementation import StatusDBImplementation
# Create instance
db = StatusDBImplementation()
Add a Container
from laborchestrator import structures
container_info = structures.ContainerInfo(
name="TestPlate1",
current_device="RoboticArm1",
current_pos=0,
barcode="PLATE001",
lidded=True,
filled=True
)
db.add_container(container_info)
Check if a Position is Empty
is_empty = db.position_empty(device="RoboticArm1", pos=0)
print(f"Position is empty: {is_empty}") # False, we just added a container
Get Container Information
container = db.get_container_at_position(device="RoboticArm1", pos=0)
print(f"Container barcode: {container.barcode}")
print(f"Container is lidded: {container.lidded}")
Move a Container
db.moved_container(
source_device="RoboticArm1",
source_pos=0,
target_device="PlateReader1",
target_pos=0,
barcode="PLATE001"
)
Configuration Options
Database Settings
By default, the system uses SQLite. To use a different database, edit src/platform_status_db/larastatus/settings.py:
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "platform_status",
"USER": "dbuser",
"PASSWORD": "dbpassword",
"HOST": "localhost",
"PORT": "5432",
}
}
Timezone Configuration
The default timezone is Europe/Berlin. To change it, edit settings.py:
Production Deployment
Important: The default settings are for development only. For production:
- Change
DEBUG = Falseinsettings.py - Set a secure
SECRET_KEY - Configure
ALLOWED_HOSTS - Use a production database (PostgreSQL, MySQL, etc.)
- Use a production WSGI server (Gunicorn, uWSGI)
- Set up static file serving
See Django's deployment checklist for details.
Testing Your Setup
Run the included tests to verify everything is working:
Next Steps
- Managing Devices: Learn how to add and configure devices
- Managing Containers: Understand container tracking and movement
- API Reference: Explore all available methods
- Advanced Usage: Work with experiments and process tracking
Troubleshooting
ImportError: No module named 'django'
Make sure Django is installed:
ImportError: No module named 'laborchestrator'
Install the laborchestrator package:
pip install --index-url https://gitlab.com/api/v4/projects/70366855/packages/pypi/simple "laborchestrator<0.3"
Database Migration Errors
If you encounter migration errors, try:
# Reset migrations (WARNING: This will delete all data)
rm src/platform_status_db/db.sqlite3
python src/platform_status_db/manage.py migrate
Server Won't Start
Check if another process is using port 8000: