MegaQC icon indicating copy to clipboard operation
MegaQC copied to clipboard

Arbitrary sample tags

Open multimeric opened this issue 6 years ago • 4 comments

I recently ran a survey of bioinformaticians within my organization, and this was the number 1 feature that was requested.

Basically I think we need the option to edit the data associated with samples, including the ability to add new tags to samples. The primary use for this is being able to tag and untag samples as failed/warning/passed QC, but this should be flexible enough for other arbitrary tags, for example creating cohorts of samples.

In theory this could be a new database entity, but I see no reason we can't re-purpose the SampleData table for this, and just create a GUI for editing the data.

Any thoughts on this before I get started?

multimeric avatar Sep 19 '19 07:09 multimeric

My proposed technology is React Admin, using ra-jsonapi-client as a backend since the REST API is JSON API conformant.

There's also a more static solution: flask-admin, but I rather like the idea of the admin page doing everything through the API. Plus the React option looks much nicer and has nice performance from being a single page app.

multimeric avatar Sep 19 '19 08:09 multimeric

Also, it has occurred to me that this issue, and a few others could be improved by adding a JSON schema object to the SampleDataType model. This would give us data types associated with each type, which would help for plotting, editing in the admin interface, validating etc. The only hard part would be inferring a schema from the MultiQC reports, but it's doable nonetheless.

multimeric avatar Sep 23 '19 05:09 multimeric

@ewels I'm proposing this as my third big PR. Even if you don't yet have time to review code, could you share some quick thoughts on these changes:

  • Add an admin interface for viewing/editing/deleting records of all types
  • Add a JSON schema to the SampleDataType, allowing us to provide a more powerful SampleData editor (showing a calendar for datetimes, a number input for numeric data etc)

Together, these two features will allow users to add new data/tags to samples very easily, which solve the use cases mentioned above (cohort creation, and QC pass/fail tagging)

The only downside I see for this is that the react-admin will have inconsistent UI with the rest of MegaQC, since it uses Material UI and not bootstrap. Is this a dealbreaker?

multimeric avatar Sep 24 '19 02:09 multimeric

Subtasks for my own reference:

  • [x] Add the schema column to SampleDataType
  • [x] Integrate React Admin with MegaQC
  • [x] Write PR for ra-jsonapi-client to fix count behaviour: https://github.com/henvo/ra-jsonapi-client/pull/19
  • [x] Add a JSON editor to the Admin pages, for the JSON data fields
  • [x] Write PR for ra-jsonapi-client to ensure the records include associated data: https://github.com/henvo/ra-jsonapi-client/pull/22
  • [x] Add ID filtering to the REST API resources in MegaQC (so we can handle the GET_MANY requests from React Admin)
  • [x] Integrate the Admin GUI with MegaQC (colours etc)
  • [ ] Validate SampleData according to the SampleDataType's schema

multimeric avatar Sep 30 '19 07:09 multimeric