wettenhj / mytardis

MyTardis - a data management system for private lab/facility data
http://mytardis.github.com
GNU General Public License v3.0
0 stars 0 forks source link

Default experiments (to be used by MyData) - please discuss MyTardis model changes required #5

Closed wettenhj closed 9 years ago

wettenhj commented 9 years ago

Background

The initially targeted users of MyData (https://github.com/wettenhj/mydata) have requested that their users shouldn't have to interact with MyData at all if they don't want to, i.e. MyData will be primarily used by facility managers for adding new instrument PCs to MyTardis and for diagnosing failed uploads. So general microscope users should be able to simply save a folder (e.g. "Dataset 1") in their user folder (e.g. "jsmith") and leave it up to MyData to put the dataset in a sensible default experiment in MyTardis (which the user can later modify if they wish). The proposed method for defining a default experiment is to group datasets by: (i) instrument, (ii) user who collected the data (the researcher) (iii) the date on which the data was collected.

So for example, if MyData found a "Dataset 1" folder with a creation date of "2014-10-11" within a "jsmith" folder on instrument "Test Microscope 1", then it would query MyTardis to see if a default experiment record already exists which is suitable for this dataset, i.e. an experiment record tagged with "Test Micrsocope 1", "jsmith" and "2014-10-11". If it didn't already exist, MyData would create this default experiment record. It would initially create the record using a facility role account, e.g. MyTardis username="myfacility", and then user "jsmith" would be given full ownership access to the experiment record by creating an appropriate ObjectACL record.

The question is how to implement these experiment "tags" (instrument, data-collector and date-of-collection) nicely in MyTardis.

Option 1. (already implemented in MyData's current MyTardis test instance)

Option 2.

Option 3.

grischa commented 9 years ago

Thanks for giving us the background information in such detail. After considering all the requirements you listed, I came up with another option shown below. I hope I understood it well enough to address all the requirements.

Option 4.

wettenhj commented 9 years ago

Hi Grischa,

Your Option 4 sounds good!

Except I can't see an "owner" field in the Experiment model. So I guess I should add functionality to the ExperimentResource in api.py, so that you can filter by "owner", which then queries the ObjectACL model.

Does that make sense?

Cheers, James

On 21 Nov 2014, at 3:28 pm, Grischa Meyer notifications@github.com wrote:

Thanks for giving us the background information in such detail. After considering all the requirements you listed, I came up with another option shown below. I hope I understood it well enough to address all the requirements.

Option 4.

Use the existing fields in the experiment model start_time and end_time https://github.com/mytardis/mytardis/blob/develop/tardis/tardis_portal/models/experiment.py#L55

Use the owner field to set the user who collected the data, add an ACL for that user as well, of course.

Query for a "default experiment" by title__startswith, owner, start_time and end_time.

If you need to do complex queries with the API, why not create a custom API hook/url for these queries. It is a lot more lightweight than a database migration and more maintainable.

— Reply to this email directly or view it on GitHub.

wettenhj commented 9 years ago

The use of the custom schema / parameters has been removed, and MyData now uses "Option 4" instead. See the following commits:

It appears to work, but further testing is needed...

wettenhj commented 9 years ago

One flaw with using titlestartswith (Option 4) is that our clients were hoping that users could rename these default experiments in MyTardis from their default titles of "Instrument name Date" to anything they want. After users have renamed these experiments, using the titlestartswith method of identifying a default experiment from MyData won't work, so MyData will create a duplicate experiment the next time it scans the datasets from that instrument and creation date. So do we consider adding an instrument foreign key to the experiment model (which can be NULL for experiments spanning multiple instruments)?

steveandroulakis commented 9 years ago

Note to self: Talk about Steve's "option 5" when we meet. ;)