Building a reporting sytem with BREW

Building a reporting system with
BREW



Xavi Guardiola
Chief Technology Officer
Simpple - Xarxa Sanitària i Social de Santa Tecla


xavier.guardiola@simpple.com
    @xguardi
Enterprise report generation

  Datawharehouse


   Data analysis

                        Report template wizards:
  Report template       Jasper Reports, BIRT, etc.

         Report

                        Report distribution:
   Rep    Rep     Rep   Web, email.
                        Dynamic reports
Enterprise reporting design shortcomings

Poor in-report logic.
Not a best practice but most of the times inevitable!



Ugly defaults.
Please, check out Tufte books.


Simple plots.
Sometimes you need statistical or more complex plots.




Regular users should be able to create their own reports. Really?
Brew The dumbest example

            example.brew
             <% x <- 2 %>
             Good morning.
             Today the kilo oranges
             is priced at <%= x %> euros.




            R> brew(“example.brew”, “example.txt”)


            example.txt
             Good morning.
             Today the kilo oranges
             is priced at 2 euros.
Brew Precomputing things before

              example.R
               x <- 2
               save(x, file= “data.Rdata”)


              example.brew
               <% load(“data.Rdata”) %>
               Good morning.
               Today the kilo oranges
               is priced at <%= x %> euros.


              R> brew(“example.brew”, “example.txt”)

              example.txt
               Good morning.
               Today the kilo oranges
               is priced at 2 euros.
Brew Smart templates
             example.R
              x <- 2
              save(x, file= “data.Rdata”)


             example.brew
              <% load(“data.Rdata”)   %>
              Good morning.
              Today the kilo oranges
              is priced at <%= x %> euros.
              <% if x > 1 %>
              That’s f***ing expensive!
              <% end %>



             R> brew(“example.brew”, “example.txt”)

             example.txt
              Good morning.
              Today the kilo oranges
              is priced at 2 euros.
              That’s f***ing expensive!
Brew + latex
      example.brew
       begin{document}
       Today the kilo oranges $rightarrow$ <%= x %> euros.
       end{document}


      R> brew(“example.brew”, “example.tex”)

      example.tex
       begin{document}
       Today the kilo oranges $rightarrow$ 2 euros.
       end{document}




      R> texi2dvi(“example.tex”, pdf=TRUE)

      example.pdf

        Today the kilo oranges   !   2 euros.
The alternative stack

                                                R selects DB data
  Datawharehouse        Datawharehouse          RJDBC, RMySQL, etc.


                                                R computes results and
   Data analysis               R script         plots.

                                                Latex brew template loads
  Report template       Brew latex template     results and plots and
                                                generate template file

                                                PDF report is generated
         Report                Report           from the tex file



   Rep    Rep     Rep    Rep     Rep      Rep
Report example
Report example
Report example
Brew vs Sweave
example.brew                        example.Rnw

 begin{document}                    begin{document}

 begin{table}                       <<Table1, echo=F,results=tex>>=
 <% for (i in 1:nrow(data)) { -%>    print(xtable(data))
   <%= data$name[i] %> &             @
   <%= data$value[i] %> 
 end{table}                         Price is Sexpr{x}

 Price is <%= x %>                   <<plot1, echo=F, fig=T>>==
                                     print(plot1)
 begin{figure}                      @
   includegraphics{...}
 end{figure}                        end{document}

 end{document}
Thanks!
1 of 13

Recommended

Python programming lab 11 by
Python programming lab 11Python programming lab 11
Python programming lab 11profbnk
337 views41 slides
The data visualization with R:An Example- Visualizing obesity across united s... by
The data visualization with R:An Example- Visualizing obesity across united s...The data visualization with R:An Example- Visualizing obesity across united s...
The data visualization with R:An Example- Visualizing obesity across united s...Dr. Volkan OBAN
228 views5 slides
Brief Tutorial on Multilevel Model by
Brief Tutorial on Multilevel ModelBrief Tutorial on Multilevel Model
Brief Tutorial on Multilevel ModelKamarul Imran
1.2K views12 slides
BMGEN in Japan by
BMGEN in JapanBMGEN in Japan
BMGEN in JapanYves Pigneur
3.1K views108 slides
BMGEN in China by
BMGEN in ChinaBMGEN in China
BMGEN in ChinaYves Pigneur
2.4K views107 slides
Designing Business Models by
Designing Business ModelsDesigning Business Models
Designing Business ModelsYves Pigneur
5.5K views71 slides

More Related Content

Viewers also liked

Business Model_Innovation_JMA_6Jul2015 by
Business Model_Innovation_JMA_6Jul2015Business Model_Innovation_JMA_6Jul2015
Business Model_Innovation_JMA_6Jul2015Shin Yamamoto
3.1K views80 slides
Service Concept & scenario by
Service Concept & scenarioService Concept & scenario
Service Concept & scenarioYves Pigneur
17.2K views55 slides
Disruptive Business Model by
Disruptive Business ModelDisruptive Business Model
Disruptive Business ModelYves Pigneur
7.8K views74 slides
Performance measure by
Performance measurePerformance measure
Performance measureYves Pigneur
4.5K views65 slides
Business Model Innovation by
Business Model Innovation Business Model Innovation
Business Model Innovation Yves Pigneur
21.4K views100 slides
Business Model Innovation and Design at Todai by
Business Model Innovation and Design at TodaiBusiness Model Innovation and Design at Todai
Business Model Innovation and Design at TodaiYves Pigneur
76.4K views289 slides

Viewers also liked(10)

Business Model_Innovation_JMA_6Jul2015 by Shin Yamamoto
Business Model_Innovation_JMA_6Jul2015Business Model_Innovation_JMA_6Jul2015
Business Model_Innovation_JMA_6Jul2015
Shin Yamamoto3.1K views
Service Concept & scenario by Yves Pigneur
Service Concept & scenarioService Concept & scenario
Service Concept & scenario
Yves Pigneur17.2K views
Disruptive Business Model by Yves Pigneur
Disruptive Business ModelDisruptive Business Model
Disruptive Business Model
Yves Pigneur7.8K views
Performance measure by Yves Pigneur
Performance measurePerformance measure
Performance measure
Yves Pigneur4.5K views
Business Model Innovation by Yves Pigneur
Business Model Innovation Business Model Innovation
Business Model Innovation
Yves Pigneur21.4K views
Business Model Innovation and Design at Todai by Yves Pigneur
Business Model Innovation and Design at TodaiBusiness Model Innovation and Design at Todai
Business Model Innovation and Design at Todai
Yves Pigneur76.4K views
独自のビジネスモデルと顧客価値を創造する方法 by Yves Pigneur
独自のビジネスモデルと顧客価値を創造する方法独自のビジネスモデルと顧客価値を創造する方法
独自のビジネスモデルと顧客価値を創造する方法
Yves Pigneur7.1K views
Service Design by Yves Pigneur
Service DesignService Design
Service Design
Yves Pigneur25.1K views
Value Proposition Canvas (explained) by Julius Parrisius
Value Proposition Canvas (explained)Value Proposition Canvas (explained)
Value Proposition Canvas (explained)
Julius Parrisius208.8K views
Value Proposition Design by Yves Pigneur
Value Proposition DesignValue Proposition Design
Value Proposition Design
Yves Pigneur369.3K views

Similar to Building a reporting sytem with BREW

Principals, Practices, and Habits by
Principals, Practices, and HabitsPrincipals, Practices, and Habits
Principals, Practices, and HabitsJeremy Leipzig
912 views8 slides
Next Generation Programming in R by
Next Generation Programming in RNext Generation Programming in R
Next Generation Programming in RFlorian Uhlitz
1.7K views54 slides
R Programming - part 1.pdf by
R Programming - part 1.pdfR Programming - part 1.pdf
R Programming - part 1.pdfRohanBorgalli
17 views33 slides
Mixed Effects Models - Descriptive Statistics by
Mixed Effects Models - Descriptive StatisticsMixed Effects Models - Descriptive Statistics
Mixed Effects Models - Descriptive StatisticsScott Fraundorf
148 views65 slides
Cutting Edge Data Processing with PHP & XQuery by
Cutting Edge Data Processing with PHP & XQueryCutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQueryWilliam Candillon
6.4K views49 slides
A Multiformat Document Workflow With Docutils by
A Multiformat Document Workflow With DocutilsA Multiformat Document Workflow With Docutils
A Multiformat Document Workflow With DocutilsMatthew Leingang
445 views41 slides

Similar to Building a reporting sytem with BREW(20)

Principals, Practices, and Habits by Jeremy Leipzig
Principals, Practices, and HabitsPrincipals, Practices, and Habits
Principals, Practices, and Habits
Jeremy Leipzig912 views
Next Generation Programming in R by Florian Uhlitz
Next Generation Programming in RNext Generation Programming in R
Next Generation Programming in R
Florian Uhlitz1.7K views
Mixed Effects Models - Descriptive Statistics by Scott Fraundorf
Mixed Effects Models - Descriptive StatisticsMixed Effects Models - Descriptive Statistics
Mixed Effects Models - Descriptive Statistics
Scott Fraundorf148 views
Cutting Edge Data Processing with PHP & XQuery by William Candillon
Cutting Edge Data Processing with PHP & XQueryCutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQuery
William Candillon6.4K views
A Multiformat Document Workflow With Docutils by Matthew Leingang
A Multiformat Document Workflow With DocutilsA Multiformat Document Workflow With Docutils
A Multiformat Document Workflow With Docutils
Matthew Leingang445 views
Modern Architecture by ryandotsmith
Modern ArchitectureModern Architecture
Modern Architecture
ryandotsmith2.4K views
Rails Antipatterns | Open Session with Chad Pytel by Engine Yard
Rails Antipatterns | Open Session with Chad Pytel Rails Antipatterns | Open Session with Chad Pytel
Rails Antipatterns | Open Session with Chad Pytel
Engine Yard2.5K views
PHP and MySQL with snapshots by richambra
 PHP and MySQL with snapshots PHP and MySQL with snapshots
PHP and MySQL with snapshots
richambra888 views
Reproducibility with R by Martin Jung
Reproducibility with RReproducibility with R
Reproducibility with R
Martin Jung1K views
Client Side rendering Not so Easy by nuria_ruiz
Client Side rendering Not so EasyClient Side rendering Not so Easy
Client Side rendering Not so Easy
nuria_ruiz3.2K views
Defensive Programming 2013-03-18 by Laura A Schild
Defensive Programming 2013-03-18Defensive Programming 2013-03-18
Defensive Programming 2013-03-18
Laura A Schild2.2K views
Distributed, Incremental Dataflow Processing on AWS with GRAIL's Reflow (CMP3... by Amazon Web Services
Distributed, Incremental Dataflow Processing on AWS with GRAIL's Reflow (CMP3...Distributed, Incremental Dataflow Processing on AWS with GRAIL's Reflow (CMP3...
Distributed, Incremental Dataflow Processing on AWS with GRAIL's Reflow (CMP3...
Capacity Management for Web Operations by John Allspaw
Capacity Management for Web OperationsCapacity Management for Web Operations
Capacity Management for Web Operations
John Allspaw27K views
Hack Like It's 2013 (The Workshop) by Itzik Kotler
Hack Like It's 2013 (The Workshop)Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)
Itzik Kotler1.1K views

Recently uploaded

UNIDAD 3 6º C.MEDIO.pptx by
UNIDAD 3 6º C.MEDIO.pptxUNIDAD 3 6º C.MEDIO.pptx
UNIDAD 3 6º C.MEDIO.pptxMarcosRodriguezUcedo
150 views32 slides
BUSINESS ETHICS MODULE 1 UNIT I_A.pdf by
BUSINESS ETHICS MODULE 1 UNIT I_A.pdfBUSINESS ETHICS MODULE 1 UNIT I_A.pdf
BUSINESS ETHICS MODULE 1 UNIT I_A.pdfDr Vijay Vishwakarma
92 views25 slides
Gross Anatomy of the Liver by
Gross Anatomy of the LiverGross Anatomy of the Liver
Gross Anatomy of the Liverobaje godwin sunday
89 views12 slides
Six Sigma Concept by Sahil Srivastava.pptx by
Six Sigma Concept by Sahil Srivastava.pptxSix Sigma Concept by Sahil Srivastava.pptx
Six Sigma Concept by Sahil Srivastava.pptxSahil Srivastava
51 views11 slides
ICS3211_lecture 09_2023.pdf by
ICS3211_lecture 09_2023.pdfICS3211_lecture 09_2023.pdf
ICS3211_lecture 09_2023.pdfVanessa Camilleri
147 views10 slides

Recently uploaded(20)

Six Sigma Concept by Sahil Srivastava.pptx by Sahil Srivastava
Six Sigma Concept by Sahil Srivastava.pptxSix Sigma Concept by Sahil Srivastava.pptx
Six Sigma Concept by Sahil Srivastava.pptx
Sahil Srivastava51 views
11.30.23A Poverty and Inequality in America.pptx by mary850239
11.30.23A Poverty and Inequality in America.pptx11.30.23A Poverty and Inequality in America.pptx
11.30.23A Poverty and Inequality in America.pptx
mary850239181 views
Interaction of microorganisms with vascular plants.pptx by MicrobiologyMicro
Interaction of microorganisms with vascular plants.pptxInteraction of microorganisms with vascular plants.pptx
Interaction of microorganisms with vascular plants.pptx
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE... by Nguyen Thanh Tu Collection
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE...
Guess Papers ADC 1, Karachi University by Khalid Aziz
Guess Papers ADC 1, Karachi UniversityGuess Papers ADC 1, Karachi University
Guess Papers ADC 1, Karachi University
Khalid Aziz105 views
NodeJS and ExpressJS.pdf by ArthyR3
NodeJS and ExpressJS.pdfNodeJS and ExpressJS.pdf
NodeJS and ExpressJS.pdf
ArthyR350 views
Introduction to AERO Supply Chain - #BEAERO Trainning program by Guennoun Wajih
Introduction to AERO Supply Chain  - #BEAERO Trainning programIntroduction to AERO Supply Chain  - #BEAERO Trainning program
Introduction to AERO Supply Chain - #BEAERO Trainning program
Guennoun Wajih123 views
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx by Niranjan Chavan
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptxGuidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx
Niranjan Chavan42 views
Pharmaceutical Analysis PPT (BP 102T) by yakshpharmacy009
Pharmaceutical Analysis PPT (BP 102T) Pharmaceutical Analysis PPT (BP 102T)
Pharmaceutical Analysis PPT (BP 102T)
yakshpharmacy009116 views
The Future of Micro-credentials: Is Small Really Beautiful? by Mark Brown
The Future of Micro-credentials:  Is Small Really Beautiful?The Future of Micro-credentials:  Is Small Really Beautiful?
The Future of Micro-credentials: Is Small Really Beautiful?
Mark Brown102 views

Building a reporting sytem with BREW

  • 1. Building a reporting system with BREW Xavi Guardiola Chief Technology Officer Simpple - Xarxa Sanitària i Social de Santa Tecla xavier.guardiola@simpple.com @xguardi
  • 2. Enterprise report generation Datawharehouse Data analysis Report template wizards: Report template Jasper Reports, BIRT, etc. Report Report distribution: Rep Rep Rep Web, email. Dynamic reports
  • 3. Enterprise reporting design shortcomings Poor in-report logic. Not a best practice but most of the times inevitable! Ugly defaults. Please, check out Tufte books. Simple plots. Sometimes you need statistical or more complex plots. Regular users should be able to create their own reports. Really?
  • 4. Brew The dumbest example example.brew <% x <- 2 %> Good morning. Today the kilo oranges is priced at <%= x %> euros. R> brew(“example.brew”, “example.txt”) example.txt Good morning. Today the kilo oranges is priced at 2 euros.
  • 5. Brew Precomputing things before example.R x <- 2 save(x, file= “data.Rdata”) example.brew <% load(“data.Rdata”) %> Good morning. Today the kilo oranges is priced at <%= x %> euros. R> brew(“example.brew”, “example.txt”) example.txt Good morning. Today the kilo oranges is priced at 2 euros.
  • 6. Brew Smart templates example.R x <- 2 save(x, file= “data.Rdata”) example.brew <% load(“data.Rdata”) %> Good morning. Today the kilo oranges is priced at <%= x %> euros. <% if x > 1 %> That’s f***ing expensive! <% end %> R> brew(“example.brew”, “example.txt”) example.txt Good morning. Today the kilo oranges is priced at 2 euros. That’s f***ing expensive!
  • 7. Brew + latex example.brew begin{document} Today the kilo oranges $rightarrow$ <%= x %> euros. end{document} R> brew(“example.brew”, “example.tex”) example.tex begin{document} Today the kilo oranges $rightarrow$ 2 euros. end{document} R> texi2dvi(“example.tex”, pdf=TRUE) example.pdf Today the kilo oranges ! 2 euros.
  • 8. The alternative stack R selects DB data Datawharehouse Datawharehouse RJDBC, RMySQL, etc. R computes results and Data analysis R script plots. Latex brew template loads Report template Brew latex template results and plots and generate template file PDF report is generated Report Report from the tex file Rep Rep Rep Rep Rep Rep
  • 12. Brew vs Sweave example.brew example.Rnw begin{document} begin{document} begin{table} <<Table1, echo=F,results=tex>>= <% for (i in 1:nrow(data)) { -%> print(xtable(data)) <%= data$name[i] %> & @ <%= data$value[i] %> end{table} Price is Sexpr{x} Price is <%= x %> <<plot1, echo=F, fig=T>>== print(plot1) begin{figure} @ includegraphics{...} end{figure} end{document} end{document}