← Back to team overview

dhis2-users team mailing list archive

Re: R in DHIS reports

 

Hi Tom,
Nice to hear others see the value in integrating DHIS2 and R more closely.
I have added several examples recently to the DHIS2 documentation on how to
use R and DHIS2/MyDatamart together. You can read this here.

What I have yet to document (because I am still working on the code, then
will include some documentation) is the use of
FastRWeb<http://www.rforge.net/FastRWeb/>.
FastRWeb basically allows you to execute R as CGI Scripts using Apache and
Rserve. So a scripit like

run<-function(n=10){
x<-1:n
y<-rnorm(n)
Cairo(file="/tmp/svgtest.svg",type="svg",dpi=72)
plot(x,y)
dev.off()
readLines("/tmp/svgtest.svg")
}

Is meant to produce a SVG graphic from some random data. Note that n=10.
This will be used as a paramater in the URL

So, something like

http://mydhis.foo.com/cgi-bin/R/svg?n=100

will tell FastRWeb to execute the file named svg.R (above) and supply the
paramater n=100 to the script.

This then would allow you to parameterize your R scripts, so that reports
can be produced based on what the orgunit is. Now, does DHIS2 support this?
Not yet, but I suspect that it could quite easily. However, Lars has added
a number of examples of how to use the the WebAPI (which could also be used
for reports)  to the documentation, which could also be used for building
reports with R.

Hope this helps and keep me informed!

Best regards,
Jason


On Mon, May 21, 2012 at 5:20 AM,  <hiattt@xxxxxxxxxxxx> wrote:
> It seems that the ‘Standard Report’ feature needs to be linked with
> JasperReports to work. Is this right? I try and create a new report
without
> linking a file and it just doesn’t save and reloads the input screen
rather
> than giving a ‘JasperReports XML file required’ error message so maybe I’m
> doing something wrong.
>
>
>
> I’m a fan of R and thought this might be a very useful place to have the
> ability to input R code which produces reports. I can just output the data
> and create reports outside of the system, but it would be nice to
> incorporate it with the dashboard, etc. I’m not sure the best way for this
> to work, but it would be great for me if it did!
>
>
>
> Thanks,
>
> Tom
>
>
>
>
>
>
>
> ________________________________
>
> This message was scanned for viruses with Trend Micro ScanMail, GFI
> MailSecurity and GFI MailEssentials by the World Health Organization
> Regional Office for the Western Pacific. However, the recipient is advised
> to scan this e-mail and any attached files for viruses.
>
> Disclaimer:
>
> This e-mail, together with any attachments, is intended for the named
> recipients only and is confidential. It may also be privileged or
otherwise
> protected by law.
>
> If you have received it in error, please notify the sender immediately by
> reply e-mail and delete it and any attachments from your system. You may
not
> copy or disclose its contents to anyone.
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References