And lastly - Camillo raised following as well, so let me show you some code, enough of my waffle in above
This will always be a pain. Automate a unique naming scheme based on attributes I’d say. It’ll be sort of user-readable. Let me just give you a very simple Django-based implementation to show what I mean when I talk about ‘plates on a database’.
from django.contrib.auth.models import User
from django.db import models
class GenericPlateType(models.Model):
"""
Mock base data model for a plate instance
"""
#Store who contributed the definition so you can shout at them
#Likewise, would add a "validated_by" field
#Django has an extensive User registration setup, you get that for free.
contributed_by= models.ForeignKey(
User,
blank=False,
null=True,
on_delete=models.SET_NULL, # Do not delete when user disappears
)
manufacturer = models.CharField(
unique=False,
null=False,
max_length=100,
help_text="Manufacturer name",
)
catalogId = models.CharField(
unique=True, #auto-checks for duplicates
null=False, # we won't allow null in the db
max_length=100,
help_text="Additional information: catalog id",
)
nx = models.PositiveSmallIntegerField(
null=False,
default=12,
unique=False,
validators=[MinValueValidator(1),MaxValueValidator(12)],
verbose_name=_("Number of X wells"),
help_text="number of wells in X direction",
)
ny = models.PositiveSmallIntegerField(
null=False,
default=8,
unique=False,
validators=[MinValueValidator(1),MaxValueValidator(8)],
verbose_name=_("Number of Y wells"),
help_text="number of wells in Y direction",
)
def __str__(self):
s="%s__%s__%d__%d"%(self.manufacturer, self.catalogId, self.nx, self.ny)
return s
def getUniqueName(self):
"""
The catalogId is unique so this will be a unique identifier too
"""
return str(self)
#All PLR plate functionality (variables, functions) goes here in
#the model definition (basically, everything that is in the current base class).
This is overly simplistic, and I skip some Django setup details, but I hope you get the gist.
Here’s how to use it:
#Create a new Greiner 96w plate type on the database by setting all its info
#and storing it
my96wplatetype = GenericPlateType(nx=12,ny=8,catalogId="bla",manufacturer="Greiner")
my96wplatetype.save() #Now it is stored on the database
#User example:
#Find a 96w Greiner plate and use the first one for whatever you do with PLR
#The mygreiner instance is now a plate object that can be used as you
#would a usual PLR plate.
greiner96w_list = GenericPlateType.objects.filter(manufacturer="Greiner",nx=12,ny=8)
mygreiner = greiner96w_list.first()
#print its unique identifier
print( mygreiner.getUniqueName() )