Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Add config option to set the default model tree #742

Open
bruth opened this issue Oct 27, 2014 · 8 comments
Open

Add config option to set the default model tree #742

bruth opened this issue Oct 27, 2014 · 8 comments

Comments

@bruth
Copy link
Contributor

bruth commented Oct 27, 2014

This involves setting the tree GET parameter on outbound request URLs. This would be implemented similarly to #686

@sgithens
Copy link

This should restrict the concepts and fields returned from /api/concepts and /api/fields in addition to being a parameter to contexts, correct? (So that the options in the left hand pane are represented correctly).

Is this get parameter currently available on concepts/fields? I'm the trying the following, but it's not returning the subset of DataConcepts and DataFields that are traversable by the modeltree named 'volunteer' in settings.py.

http://localhost:8000/ktb/api/concepts/?tree=volunteer

@bruth
Copy link
Contributor Author

bruth commented Jan 18, 2015

@sgithens There is an issue for Serrano (chop-dbhi/serrano#214) to add support for filtering by tree.

@bruth
Copy link
Contributor Author

bruth commented Jan 18, 2015

I just posted a PR for the Serrano issue: chop-dbhi/serrano#258

@sgithens
Copy link

Great! Will try it out now.

@sgithens
Copy link

Filtering api/concepts looks good so far from the URL bar. Going to start messing with the cilantro UI.

@sgithens
Copy link

I'm currently hacking on this here: https://github.com/sgithens/cilantro/compare/cilantro-742

So far I've just experimented with adding a 'tree' parameter to the config, and slapping it on the end of all the bulk urls that get pulled from _links. On the surface this actually does quite a bit, by restricting the concepts available in the left pane, and also what columns are available for selection in the results page.

And while this partially implicitily limits what is actually be queried (because you can only select the concepts on the left), I'm assuming we should be putting the 'tree' in the PUT request to api/context/ID to actually properly put the tree in the context?

Does the api/context PUT endpoint support a tree parameter in serrano already?

Also, my other concern is detecting and resetting the context when you hit different cilantro instances in the same app. For instance, starting with this functionality I'll likely create multiple links on my dashboard for searching different modeltree, and each cilantro view from django will put in a different modeltree root. So if you click between these cilantro views in the webapp, on each change it will need to reset the feeds and query that is in the process of refinement, etc, etc.

Thoughts on the best way to detect and swap contexts like that would be helpful. I'm guessing maybe in cilantro we would look at the if a different modeltree is configured for that instance, and then look at stored contexts for the current user, and pull whatever one has that modeltree already, or create a new one if it doesn't exist.

I'm also wondering, if under the saved queries, we should list all the users saved queries, or just the ones for the explicitly modeltree in the c.config.

@bruth
Copy link
Contributor Author

bruth commented Jan 23, 2015

@sgithens Nice analysis. There are a few approaches to handling the tree parameter:

  • Add a centralized dispatcher of requests that is aware of global switches like this
  • Make each relevant model get the tree config option
  • Initialize a new Cilantro session with the tree parameter bound

My gut tells me that third option makes the most sense. For a bit of background, I implemented the Session class to enable connecting to multiple Serrano APIs from one client. The piece I have not finished is the UI control for actually switching the session, i.e. initializing the new one and updating the views on the page. This approach would handle both cases: switching contexts (i.e. the tree) and switching endpoints.

I'm also wondering, if under the saved queries, we should list all the users saved queries, or just the ones for the explicitly modeltree in the c.config.

That is an interesting question. Queries are not bound to particular tree, although some may not be valid simply because they included fields that are reachable by the current tree. This feels like there would need to be a higher-level means (more metadata, etc.) for switching context than just toggling the tree parameter. I presume the underlying need is a workflow change (e.g. sample-centric vs. patient-centric)?

@sgithens
Copy link

I've only had a bit of time to look at this again this week, and unfortunately am about to leave town through the next week. I hope to keep working on it again the week of Feb 9th.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants