Sage-Bionetworks / projectlive.modules

Modules for Project Live apps across different projects
Other
0 stars 1 forks source link

New Feature request: Link between plots in "Milestone tracker" and Synapse files #76

Closed jaybee84 closed 2 years ago

jaybee84 commented 2 years ago

Please briefly describe your problem and what output you expect. This is a feature requested by one of our funders who is a heavy user of projectLive. They use the milestone tracker in the "Participating Studies" module to see how many files were expected for a certain progress report and how many files were uploaded. They visualize this in a bar plot which has a hover which tells them the count of files.

Expected Output: They would like to click on the bar and find the files on Synapse that are being counted in this bar.

One possible solution: A list of synIDs is generated from the bar. A synapse query with those synIDs is generated and provided as a link on the projectLive app (near the bar plots). When the user clicks the link it takes them to the "Project Files and Metadata Fileview" scoped using the generated query.

andrewelamb commented 2 years ago

@jaybee84 Whats the synapse id for the "Project Files and Metadata Fileview" table?

jaybee84 commented 2 years ago

Every NF study has an associated "Project Files and Metadata" fileview.

andrewelamb commented 2 years ago

Is there a way to go from the current selected study to that fileview (programatically?)

jaybee84 commented 2 years ago

Below is a crude way of doing it:

iterator <- synGetChildren(<studyID>, includeTypes = list("entityview"), sortBy = "NAME", sortDirection = "DESC")
for (i in 1:length(iterator)) {
  tryCatch(
    {
      member<-nextElem(iterator)
      a[i] <- (member$id[member$name == "Files and Metadata" | member$name == "Project Files and Metadata"])
      fileview_id <- na.omit(a)
      return(fileview_id)
    },
    error=function(e) {
      more <<-FALSE
    }
  )
}

Example

studyID <- "syn4939902"
iterator <- synGetChildren(studyID, includeTypes = list("entityview"), sortBy = "NAME", sortDirection = "DESC")

for (i in 1:length(iterator)) {
  tryCatch(
    {
      member<-nextElem(iterator)
      a[i] <- (member$id[member$name == "Files and Metadata" | member$name == "Project Files and Metadata"])
      fileview_id <- na.omit(a)
      return(fileview_id)
    },
    error=function(e) {
      more <<-FALSE
    }
  )
}

fileview_id[1]
> "syn13363852"
andrewelamb commented 2 years ago

@jaybee84 is there a way to do this: "When the user clicks the link it takes them to the "Project Files and Metadata Fileview" scoped using the generated query."

Edit: This is how:

In the web client we base64 encode the [Query](https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/table/Query.html) JSON object in the URL:
https://www.synapse.org/#!Synapse:syn<id>/tables/query/<encodedQuery>
So you could do the same thing if you construct and encode the Query object that you need (
andrewelamb commented 2 years ago

@jaybee84 Here's what it looks like in testing. This is testing data so there will be a warning about the id not being a synapse id.

When the app first loads, or the user clicks on an 'expected' bar: MT1 When the user clicks on an 'actual' bar: MT2

jaybee84 commented 2 years ago

This looks good .. couple of suggestions:

  1. Recommend not showing any FileviewID or EntityIDs on this page
  2. Is it possible to show "See selected list of files on Synapse" or "Click on a bar above in the "ACTUAL" column to see the individual files" as a banner? or somehow make it more conspicuous for the users to find it easily?
andrewelamb commented 2 years ago

@jaybee84 For #2 what do you mean by banner? Something in the description above the plot?

jaybee84 commented 2 years ago

I mean just a more conspicuous notification that a new link has been created for them to click on. Currently it is only one line of text that they may miss if they are not looking carefully.

A status flag may be a good starting point.

andrewelamb commented 2 years ago

@jaybee84 How about this for after clicking on the bar:

MT3

jaybee84 commented 2 years ago

@andrewelamb Sorry I missed this earlier. This looks good, but a couple of suggestions:

  1. Making the box a solid color instead of white will make it pop and attract attention. In the current form it is very easy to miss.
  2. "Synapse Fileview" is a bit jargon-y.. May want to add some thing more general like "List of files in selection" or something. Most of the funders are not aware of what a fileview is.
  3. Recommend removing File ID from the tool tip. Also Type of files is repeated in the tool tip.
andrewelamb commented 2 years ago

I changed to box so that the color fills the whole thing. I changed the color to red, the link color didn't look great against the green background.

I changed the the box title.

The tool tips now have just "number of files". I couldn't get rid of the duplicate "types of files", perhaps a plotly bug? Since they are clicking on the box they wouldn't need to know that anyway. I also removed the file ids from the tooltip. That could get to a huge stirng very quickly with actual file counts and actual synapse ids.

pl2_5

jaybee84 commented 2 years ago

The updates look great! One request would be to try a different shade or color for the box. I have found coolors palette to have nice shades. May be pick one of those?

andrewelamb commented 2 years ago

@jaybee84 The allowed colors are show at the bottom here. Do you have a preference?

jaybee84 commented 2 years ago

Lets try light-blue or aqua and check which one looks good :)

andrewelamb commented 2 years ago

I'll try it, but I'm not sure the link (which is blue) will stand out.

andrewelamb commented 2 years ago

The top one is aqua, and the bottom is teal. Light blue was the exact color of the link, so it was invisible. pl2_6

jaybee84 commented 2 years ago

aqua looks good to me. Actually, I would recommend using an action link button instead of this one. That way the whole button is sensitive to click and folks dont have to aim for the link specifically. We did this for the "Back to NF Data Portal" button on the "About " page.