Designing Reports

Once you have successfully defined the data that you wish your report to produce, the next step is to determine how you want this data to be output to your users. The reporting module provides a flexible framework for defining and designing your report outputs, using what we call Report Renderers. There are several Report Renderers that ship with the Reporting Module. They vary in complexity and in the amount of configuration that they accept and require. Additional Report Renderers can be easily registered by any other module with a single new class definition. The renderers that come shipped with the reporting module are described in detail below.

This section assumes that the user is running a released version of the module above 0.8

Report Design Manager

You can access or add any of these types of renderers by first clicking in the Report Administration section and then in the Report Designs link.

1Report Administration
2Report Design Manager.

In this section you can add a renderer and link it to a Report Definition (keep reading for a detail explanation). This way the renderer will become an output option for that report.

On this page you will find a list of all Report Designs that a user creates and that can be edited.

3

Another way to add a renderer is from the Output Designs box on the Report Editor page when creating a Report Definition.

Report Renderers

The Report Renderers could be easily divided in two types: configurable and non-configurable renderers. Please keep reading to learn more about the currently available type of renderers and their configuration (if any).

Default Web Renderer

The only Report Renderer that is available by default for all report definitions is the Default Web Renderer which will output the data of your report to be readable directly from OpenMRS. This basically means that the data cannot be exported or taken out of the system. The main characteristics of this renderer are:

  • No configuration needed.
  • Handles multiple data set definitions.
  • Produce a nicely formatted web-optimized display for the data, with each data set contained within its own tab.

Since this renderer is a default one for all the reports that a user might create, it won’t appear among the options listed in the Report Design Manager, but it should always be as an output option when running a report.

1Listed options under Report Design Manager page.
2

This type of renderer should always be a default output option for any user-defined report.

3Expected output

Delimited Text Report Renderer

The Report Designs section has two types of Delimited Text Report Renderer: CSV Report Renderer and TSV Report Renderer and they share the following characteristics:

  • Both handle multiple data set definitions. If only one Data Set Definition is being used then the final output will be a cvs, tsv or a user-defined file extension file. In case that the Report Definition has more than one data set, then the output will be a zip containing all of the delimited text files (csv, tsv or user-defined) for each data set (see examples below).
  • The user can easily change what delimiters should be used when rendering the data. Please keep reading to learn more about this.

CSV Report Renderer

This comma-separated value renderer will allow you to export the data of your report to a flat file suitable for importing into Excel, SAS or another external analysis tool. The main characteristics of this renderer are:

  • It allows you to change the filename extension of the final file.
  • Even when the output is pre-configured to be a comma-separated value file, the user can change both the field delimiter and text delimiter (see examples below).
1Select the CSV option from the drop-down list and click on the Add another button.
2

On the configuration page, only the description field is optional.

The filename extension, field delimiter and text delimiter fields have default values.

3If you run your report, the new added design will appear as an output option of the Report Definition you previously linked it to and it will be added to the list displayed on the Report Designs Manager page as well.
4Running the same report used earlier in the Default Web Renderer example, the expected output should be a file with csv extension containing columns separated by a comma and with a text delimiter which is the closing quotation mark (the text delimiter is the character that follows a field, in this example the field is composed of the opening quotation mark and the word: type).
5Now let's say you would like your fields to be separated by a dash, then you would have to modify the field delimiter like this:
6Then the expected output file is a character-separated value (the character is a dash).
7In case that your report has more than one Data Set Definition, then the output will be a zip of delimited text files (csv files for this example).

TSV Report Renderer

There’s not much difference between the CSV  and TSV (tab-separated value) renderers, both share the same characteristics. The main discrepancy is that the user cannot change the field delimiter value which always will be a Tab. The filename extension and the text delimiter are the only fields that can be modified.

1The Field Delimiter value will always be a Tab.
2If you run your report, the new added design will appear as an output option of the Report Definition you previously linked it to and

it will be added to the list displayed on the Report Designs Manager page as well.



3The expected output is a file with tsv extension and the columns are separated by a tab with a text delimiter which is the closing quotation mark (the text delimiter is the character that follows a field, in this example the field is composed of the opening quotation mark and the word: type).
4In case that your report has more than one Data Set Definition, then the output will be a zip of delimited text files (tsv files for this example).

HTML Report Renderer

It is a very basic renderer that produces an HTML file that contains the data of your report. Its main characteristics are:

  • No configuration is needed.
  • Handles multiple data set definitions and each one is rendered to a table in the HTML output file.
1Select the HTML (Dafault) option from the drop-down list and click on the Add another button.
2Only the description field is optional. The report definition used for this example has more than one data set definition.
3If you run your report, the new added design will appear as an output option of the Report Definition you previously linked it to and it will be added to the list displayed on the Report Designs Manager page as well.
4The expected output is an HTML file.
5If you inspect the page source code should be something like this:

XML Report Renderer

A very basic renderer which produces an XML file that contains the data of your report. Its main characteristics are:

  • No configuration is needed.
  • Handles multiple data set definitions.
  • The output format of the XML document is the following:

 

<?xml version="1.0"?>
  <dataset name="theNameOfTheDataSetInTheReport">
    <rows>
      <row>
        <eachColumnLabel>eachColumnValueAsString</eachColumnLabel>
        ...
      <row>
      ...
    <rows>
   </dataset>
   ...
1Select the XML option from the drop-down list and click on the Add another button.