diff --git a/plasmid/source/core-plugins/petermigration/1/as/definitions.py b/plasmid/source/core-plugins/petermigration/1/as/definitions.py index 6cf0d515317babb43e8d21a5145016ef89930064..c756b3336b553a57f2cf2cef799aa061fd3ba4a3 100644 --- a/plasmid/source/core-plugins/petermigration/1/as/definitions.py +++ b/plasmid/source/core-plugins/petermigration/1/as/definitions.py @@ -43,7 +43,7 @@ def getStorageGroupDefinition(): ["STORAGE_COLUMN", "Physical Storage", "Storage Column", DataType.INTEGER, None, "Storage Column", None, None, False], ["STORAGE_BOX_NAME", "Physical Storage", "box label", DataType.VARCHAR, None, "Storage Box Name", None, None, False], ["STORAGE_BOX_SIZE", "Physical Storage", "box size", DataType.CONTROLLEDVOCABULARY, "STORAGE_BOX_SIZE", "Storage Box size", None, None, False], - ["STORAGE_USER", "Physical Storage", "frozen by", DataType.CONTROLLEDVOCABULARY, "ALL_LAB_MEMBERS", "Storage User Id", None, None, False], + ["STORAGE_USER", "Physical Storage", "frozen by", DataType.VARCHAR, None, "Storage User Id", None, None, False], ["STORAGE_BOX_POSITION", "Physical Storage", "position", DataType.VARCHAR, None, "Storage Box Position", None, None, False] ]; diff --git a/plasmid/source/core-plugins/petermigration/1/dss/drop-boxes/petermigration/migration.py b/plasmid/source/core-plugins/petermigration/1/dss/drop-boxes/petermigration/migration.py index 44b497ae290427ddae7b09df68d7733f48e2bf63..ddeda563740da510cd0a8ed71d671addf66e4582 100644 --- a/plasmid/source/core-plugins/petermigration/1/dss/drop-boxes/petermigration/migration.py +++ b/plasmid/source/core-plugins/petermigration/1/dss/drop-boxes/petermigration/migration.py @@ -265,8 +265,8 @@ class FMPeterBoxAdaptor(FileMakerEntityAdaptor): if antibodyNumber is not None: values = {} values["STORAGE_NAME"] = result.getString("location") - values["STORAGE_ROW"] = None - values["STORAGE_COLUMN"] = None + values["STORAGE_ROW"] = "1" + values["STORAGE_COLUMN"] = "1" values["STORAGE_BOX_NAME"] = result.getString("box label") values["STORAGE_BOX_SIZE"] = result.getString("box size") values["STORAGE_USER"] = result.getString("frozen by") diff --git a/plasmid/source/core-plugins/petermigration/2/as/initialize-master-data.py b/plasmid/source/core-plugins/petermigration/2/as/initialize-master-data.py index 72dd365b0105817d94241631ffc149d788c568ea..bea3aac2470eb942b389a29cfcd0d84d7c57c74e 100644 --- a/plasmid/source/core-plugins/petermigration/2/as/initialize-master-data.py +++ b/plasmid/source/core-plugins/petermigration/2/as/initialize-master-data.py @@ -67,19 +67,25 @@ def createExperimentTypeWithProperties(experimentTypeCode, description, properti newExperiment.setDescription(description); addProperties(newExperiment, properties); +def getSampleType(sampleTypeCode): + sampleType = None + if sampleTypeCode in samplesCache: + sampleType = samplesCache[sampleTypeCode]; + else: + sampleType = tr.getSampleType(sampleTypeCode) + samplesCache[sampleTypeCode] = sampleType; + return sampleType; + def addPropertiesToSamples(sampleTypeCodes, properties): for sampleTypeCode in sampleTypeCodes: - if sampleTypeCode in samplesCache: - sampleType = samplesCache[sampleTypeCode]; - else: - sampleType = tr.getSampleType(sampleTypeCode) + sampleType = getSampleType(sampleTypeCodes); addProperties(sampleType, properties); def addProperties(entity, properties): for property in properties: - addProperty(entity, property[0], property[1], property[2], property[3], property[4], property[5], property[6], property[7], property[8]); + addProperty(entity, property[0], property[1], property[2], property[3], property[4], property[5], property[6], property[7], property[8], None); -def addProperty(entity, propertyCode, section, propertyLabel, dataType, vocabularyCode, propertyDescription, managedScript, dynamicScript, isMandatory): +def addProperty(entity, propertyCode, section, propertyLabel, dataType, vocabularyCode, propertyDescription, managedScript, dynamicScript, isMandatory, position): property = None; if propertyCode in propertiesCache: @@ -90,6 +96,8 @@ def addProperty(entity, propertyCode, section, propertyLabel, dataType, vocabula propertyAssignment = tr.assignPropertyType(entity, property); propertyAssignment.setSection(section); propertyAssignment.setMandatory(isMandatory); + if position is not None: + propertyAssignment.setPositionInForms(position); if managedScript != None: propertyAssignment.setManaged(True); propertyAssignment.setShownEdit(True); @@ -117,13 +125,30 @@ def addStorageGroups(numGroups, sampleType): property[5] = property[5] + "_" + str(storageIdx); addPropertiesToSamples([sampleType], storageGroup); -def addBoxSizeProperty(numGroups, sampleType): +def findAssignment(entityType, propertyType): + for assignment in tr.listPropertyAssignments(): + if assignment.getEntityKind().equals(entityType.getEntityKind()) and assignment.getEntityTypeCode() == entityType.getCode() and assignment.getPropertyTypeCode() == propertyType.getCode(): + return assignment; + return None; + +def addBoxSizeProperty(numGroups, sampleTypeCode): + sampleType = getSampleType(sampleTypeCode) for storageIdx in range(1,(numGroups + 1)): property = ["STORAGE_BOX_SIZE", "Physical Storage", "box size", DataType.CONTROLLEDVOCABULARY, "STORAGE_BOX_SIZE", "Storage Box size", None, None, False]; property[0] = property[0] + "_" + str(storageIdx); property[1] = property[1] + "_" + str(storageIdx); property[5] = property[5] + "_" + str(storageIdx); - addPropertiesToSamples([sampleType], [property]); + #Resolve Position + position = None + propertyTypeCode = "STORAGE_USER" + "_" + str(storageIdx); + propertyType = tr.getPropertyType(propertyTypeCode); + assigments = tr.listPropertyAssignments(); + assigment = findAssignment(sampleType, propertyType); + if storageIdx == 1: + position = assigment.getPositionInForms(); + else: + position = assigment.getPositionInForms() + storageIdx - 1; + addProperty(sampleType, property[0], property[1], property[2], property[3], property[4], property[5], property[6], property[7], property[8], position); #Valid Script Types: DYNAMIC_PROPERTY, MANAGED_PROPERTY, ENTITY_VALIDATION def createScript(path, name, description, scriptType, entityType):