|
Jon (LabKey DevOps) responded: |
2015-04-22 10:41 |
|
|
himanshu mendhe responded: |
2015-04-22 12:00 |
Hi Jon, thanks for replying!
Does creating a custom module in Java mean recompiling the LabKey's source code? If yes, then that is a scenario I was trying to avoid, but I would do it as a last resort.
However, could you comment on the following alternate approaches:
1. Write an R script to modify the template, which gets invoked through Javascript.
2. Don't have a .doc template, but an HTML one and modify it and let the user print it. |
|
Jon (LabKey DevOps) responded: |
2015-04-22 22:24 |
Hi Himanshu,
Are you talking about triggering an R Script via Javascript on the client side?
Regards,
Jon |
|
himanshu mendhe responded: |
2015-04-23 06:28 |
Yes. I know it is possible but what I am unsure about, in this case, is whether you support R's packages like 'pandoc' or 'markdown' and if installation is required, how do I install them on LabKey?
Another thing is, does LabKey give enough permissions to the R script to create/modify a file on the LabKey Server (inside the file-based module), because that is where I am going to store the template.
Also, finally, it would be great to know if LabKey has any inbuilt mechanism for file downloading which I can leverage. |
|
Jon (LabKey DevOps) responded: |
2015-04-23 17:02 |
Hi Himanshu,
So according to our developers, we can we trigger an R script from javascript. There is a special LABKEY.Report Javascript API that can execute an R report. In a file-based module, it is possible to have an R report in the module that is executed via Javascript using LABKEY.Report.execute().
Additionally, any R packages can be installed on the server that is using R. Here's our documentation on using knitr with markdown - https://www.labkey.org/wiki/home/Documentation/page.view?name=knitr
R can actually run as a report to access other files on the server, so accessing those templates is possible. There is enough context passed into the script prolog to indicate file and pipeline root locations and can be done within sequence. https://www.labkey.org/wiki/home/Documentation/page.view?name=rPipeline
To download a generated file from the R report on your local machine, just go to the Admin > Manage Views, click the Add Report button and select R view. If you select the Help tab, it shows all the different syntax and shows the various ways to produce a downloadable file or an output.
Regards,
Jon |
|
himanshu mendhe responded: |
2015-04-27 11:49 |
Hi Jon,
Apologies for the late reply, I couldn't do what I wanted to do with the R-script regarding modifying .doc/.docx files. I then tried using python. While that did the required stuff on the .docx file, I had used a third party library with that script. Now, I couldn't find a way to setup/install the requisite third-party library on the server-side's python installation. Will a 'pip' command at the beginning of my script install the requisite library? I wasn't sure of it. If it is possible this could solve my problem.
Meanwhile, I also started exploring the very first option you had stated, i.e. creating a Java module. I wanted to build a local instance of LabKey Server on my machine. I have downloaded the source-code, installed Tomcat and PGSQL on my local machine. I have also setup the IntelliJ IDE for the project.
I have assigned the environment variable for "CATALINA_HOME" on my PC and in the IntelliJ IDE: 'File > Settings > Build Execution Deployment > Path Variables' tab. However, while running the ant build for pick_pg, the ant build throws an error: "tomcat directory '${tomcat.home}' not found. Set CATALINA_HOME environment variable or set the tomcat.home ant property."
I don't know what is happening here. I would like the Python option to work, that would save me a lot of time. But if that is not possible, please help me with the build.xml error. |
|
Jon (LabKey DevOps) responded: |
2015-04-27 21:38 |
Hi Himanshu,
If you have the pip package installer with Python, you should be able to use it in conjunction with the LabKey Python API without any problem. Our Python API is simple, but effective. For more details on the Python API, please review the following documentation:
https://www.labkey.org/wiki/home/Documentation/page.view?name=python
Regarding the Tomcat error, it sounds like a step might have been missed in the configuration. Can you review our documentation on installing a developer instance and confirm that you did everything under the "Install and Configure IntelliJ IDEA" section? A few steps in that section, if missed, could cause the error you're seeing. https://www.labkey.org/wiki/home/Documentation/page.view?name=build
Regards,
Jon |
|
|
|