Looking for Labkey experts advice

Study Forum (Inactive)
Looking for Labkey experts advice acampos  2011-09-22 15:45
Status: Closed
 
Hi all,
I'm looking for some advice on how to set up a database "query" on user-picked files. Given the existing ms1 and ms2 files, I would like to enable my user to pick a number of files. Then, the user should be able to press a button that will execute both a SQL query and a R script to plot a number of graphs.
I reckon that there are a number of ways to do so in LabKey (external module, web part, etc) and I would love to hear your advice on the best way to do it.
I really appreciate your time,
Alex
 
 
jeckels responded:  2011-09-22 17:02
Hi Alex,

When developing reports and other custom functionality of moderate or significant complexity, I'd recommend using an external module. From your short description, it sounds you likely won't need to include Java code to support your use case.

The tutorial here should provide a good starting point for your development:

https://www.labkey.org/wiki/home/Documentation/page.view?name=helloWorldModuleTutorial

Some advantages of using a module include:

You can place the files under a source control system.
You can easily migrate your code from a development or staging server to a production server.
You can easily reuse the same report in multiple projects and folders on your server.
You can use the development environment of your choice to edit your source code.


The primary alternative is to use HTML-based wiki pages, SQL queries created through the schema browser, R reports created through Views->Create->R Report. This is a great approach for doing quick prototypes or tools that don't need to be deployed on multiple servers or in many folders on a single server.

Thanks,
Josh
 
acampos responded:  2011-09-23 09:01
Hi Josh,
Thanks for tip. I started working on the module option.
A quick question though ...
Following the idea in the tutorial, I built a module and added an HTML view/Web part. My begin.html is quite simple (as a novice programmer) and has a direct access to my SQL query and R plot results.
Nevertheless, in my initial concept, I would to provide the user the option to choose multiple ms2 files (from the ones available in the project folder) that he/she wants to make the query and plot the graphs. Should I do this in the HTML code or something else????
Thank you a lot for your help and time,
Alex
 
jeckels responded:  2011-09-27 09:48
Hi Alex,

Yes, this will need to be done with HTML and JavaScript.

I think there are two basic approaches that you can take:

1. Use an ExtJS-based grid to present the run list. See the JavaScript API documentation for LABKEY.ext.EditorGridPanel. You'd point it at the MS2 run list as its data source, configure it to let users select their runs of interest, and add buttons or other UI components to let them request the query/graph.

2. Use the LABKEY.QueryWebPart JavaScript API instead. It would be similar to using the other approach, in that you'd point it at the run list as its data source. Use the config.showRecordSelectors to be sure there are checkboxes to let the user choose their runs of interest. You'd then need to add UI (possibly with the config.buttonBar settings) to let them request the query/graph.

Thanks,
Josh