Flexible Reporting Architecture

From FreemedDeveloperWiki, the FreeMED developers' Wiki.

Jump to: navigation, search

Flexible reporting architecture (FRA) is meant to be a general purpose replacement for reporting solutions used in FreeMED.

Warning triangle.png This is a current project. Email Jeff if you are interested in working on this.

Contents

Overview

Flexible reporting architecture uses a monolithic XML file to define reporting. Unlike most other reporting engines, it uses the concept of query "blocks", which can interact with each other to produce complex, complete reports.

Reporting is broken into two types, basic and formatted.

Basic Reports

Basic reporting produces single-dimension reports, which can be exported in a wide variety of possible formats, such as CSV, etc. They are considered "basic" because there are no advanced formatting options presented.

Formatted Reports

Formatted reports can use multiple query blocks, and provided a limited range of output formats (PDF, etc) since the data coming out is not a simple two-dimensional array.

Report XML Format

PLEASE NOTE THIS IS PROBABLY GOING TO CHANGE ...

<?xml version="1.0"?>
<report>
     <information>
          <name>report name</name>
          <version>report version</version>
          <author>report author</author>
          <uuid>uuid, as generated by uuidgen</uuid>
          <type>basic (or) formatted</type>
     </information>

     <output>
     </output>

     <block name="block name">
          <parameters>
               <param variable="variable name" default="default value" type="required|optional|eval" />
               <!-- ... more of these, if needed ... -->
          </parameters>
          <sql>text of sql query here</sql>
          <fields>
               <field name="text name" variable="variable to assign" />
               <!-- ... more of these, if needed ... -->
          </fields>
     </block>
</report>

Parameter Substitution

When parameters are specified inside the /block/parameters/param tags, they can be used in the /block/parameters/sql tag by surrounding them with '##'s. For example:

 <block name="someblock">
      <parameters>
            <param variable="patient_id" default="" type="required" />
      </parameters>
      <sql>SELECT p.ptlname, p.ptfname, p.ptmname, phy.phylname FROM patient AS p, physician AS phy
           WHERE phy.id=p.ptpcp AND p.ptid='##patient_id##'</sql>
 </block>
Personal tools
Navigation