Sample created by the Dropbox is NOT editable

Setting up a new Dropbox for an analytical measurement, I intend to create a sample of the type ‘ANALYTICAL_MEASUREMENT’ as a child to a known experiment/object. The Dropbox then parses the metadata from the machine’s raw file and fills in some properties of the newly created sample of type ‘ANALYTICAL_MEASUREMENT.’ Finally, the raw data is uploaded as a dataset to the same sample of type ‘ANALYTICAL_MEASUREMENT.’
The routine works fine, but the user can not edit the object of type ‘ANALYTICAL_MEASUREMENT’ or see it in the ‘explorer part’ on the left side, although objects of the same type created by the user and not ‘etlserver’ can be seen and edited. The dataset, meanwhile, is editable.

Is that a known phenomenon?

Thanks and regards,
Volker

Hi Volker,

This sounds strange, tt should not make any difference if the object is created by dropbox or manually by a user. If the properties in the object type are editable, they should always be no matter how the object was registered.
Is the object created in a space/project the user has access to?

Hi Caterina,

I tried several combinations: It doesn’t matter whether I am ‘admin’ or ‘user,’ and yes, the user has the space right.
I added a second child of the same type to the same sample. This time, not via Dropbox, just by creating a new sample from the GUI. Both are listed as children of the parent object, but I only see the object created in the GUI on the left side, and I can only edit that one.

While replying to this message, I noticed that the identifiers of both objects look different:
While the second one, created in the web app, looks like ‘/SPACE/PROJECT/CODE,’ the one created by Dropbox is just ‘/SPACE/CODE.’ That is probably the reason.
Here is the relevant code:

“”"

service = ServiceProvider.getV3ApplicationService()
sessionToken = transaction.getOpenBisServiceSessionToken()
# setting up sampleSearch
searchCriteria = SampleSearchCriteria()
fetchOptions = SampleFetchOptions()

# getting incoming file
incoming = transaction.getIncoming()
if not incoming.isFile():
    raise UserFailureException(
        "Incoming is not a regular file: " + incoming.getAbsolutePath()
    )
##### THE PART WITH THE EXTRACTION OF METADATA FROM THE FILE IS EXCLUDED #####
# permID of the parent sample is extrated from the raw data

transaction.getLogger().info("PermID of the parent sample: %s" % permID)

# ---- fetching data for the parent sample ----
searchCriteria.withPermId().thatEquals(permID)
fetchOptions.withProject()
fetchOptions.withSpace()
fetchOptions.withRegistrator()
results = service.searchSamples(
    sessionToken, searchCriteria, fetchOptions
).getObjects()
# ---- getting identifier ----
identifier = results[0].getIdentifier().toString()
if not results:
    raise UserFailureException('Could not find parent step at "%s"' % permID)
else:
    transaction.getLogger().info("Parent sample found: %s" % identifier)

space = results[0].getSpace().toString().split(" ")[1]
project = results[0].getProject().toString().split(" ")[1]
registrator = results[0].getRegistrator().toString().split(" ")[1]

# ---- creating new sample of type 'DSC_MEASUREMENT' ----
sampleType = "DSC_MEASUREMENT"
sample = transaction.createNewSampleWithGeneratedCode(space, sampleType)
transaction.getLogger().info(
    'Created a new sample of type "%s in space "%s" with Identifier: "%s"'
    % (sampleType, space, sample.getSampleIdentifier())
)
# ---- setting parents ----
sample.setParentSampleIdentifiers([identifier])  # set parent sample

“”"

I excluded the dataset creation and metadata extraction since I think the code above is the part that matters.

Cheers,
Volker

Unfortunately, the problem is still not solved. I changed the method to create the new sample:

sample = transaction.createNewProjectSampleWithGeneratedCode(
        project_identifier, sampleType
    )

creates the complete Identifier with ‘/Space/Project/Code’. Still, the Path is ‘/Space/code/’ and no experiment is set.

sample.setExperiment(experiment_identifier)

neither works with passing the Identifier nor the PermID of the experiment, resulting in the following error:

TypeError: setExperiment(): 1st arg can't be coerced to ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v2.IExperimentImmutable

Any ideas are welcome!

Regards,
Volker

Hi Volker

It looks like these “WithGeneratedCode” methods are not suitable for you. They are to be used for space and project samples. Your sample should be in an experiment sample. You can try something like this:

sample_identifier = SampleIdentifier(space_code, project_code, None, sample_code).toString()
sample = transaction.createNewSample(sample_identifier, sample_type_code)

Cheers,
Viktor

Hi Viktor,

interesting prodecure, but the result is identical!
I still have no experiment defined.

The solution was to get the experiment object

ch.systemsx.cisd.etlserver.registrator.api.v2.impl.ExperimentImmutable@a8cd4dce

instead of the experiment identifier or permID so set

exp = search.getExperiment(experiment_identifier)
sample.setExperiment(exp)

Regards,
Volker