The XML reports project is going to be divided into two phases; the first phase involves the addition of the "XML reports" functionality to the Reporting module API, the second will focus on adding this functionality to the Reporting module UI.

Main characteristics of the development

XML Reports Design

The first phase seeks the representation of report definitions and its components in XML. The serialization from objects to XML and vice versa is going to be carried out using the XStream library which is already a dependency of the Reporting module. The current version of the library is 1.4.8 and the one used in OpenMRS is 1.4.3. There are no major changes between versions that may affect the development (base on the changes between versions listed here).

One of the main concepts of the library is “Converters”. The Converters help to serialize objects to XML and vice versa. A part from the built-in Converters that the library provides, we will create custom ones for our custom objects/tags.

Cohort Queries tags

 

Tag Name

Attributes

Root Tag

Comments

description

N/A

More than one

Generic tag to set a description for its root tag. Its content should be a string

property

name, value  AND/OR fixedValueId

More than one

This tag can be a self-closing tag or content can be a parameter tag or character data. A value in the attributes is the same as a fixed value and a fixedValuedId makes reference to a cohortDefinition.

See the Fixed Value case section

parameter

type, name and label

More than one

This tag can be a self-closing tag or have a configuration tag as content.

configuration

N/A

parameter

Its content can be character data for the configuration of the parameter it refers to.

allPersonQuery

name

N/A

Self-closing tag or a tag description as its content,

sqlPersonQuery

name

N/A

Its content can be one or more parameter tags and a property that has character data containing the sql query.

allPatientsQuery

name

 

Its content can be one or more parameter tags and a property that has character data containing the sql query.

cohortQuery

type AND name.

referenceId

N/A

Its content can be a description tag and/or a property tag. See the Fixed Value case section.

Fixed value case

There are cases when a fixed value refers to a Cohort Definition and we should be able to detect what Cohort Definition is the one to use. The suggestion is to add the fixedValueId attribute to the cohortQuery tag. This id then can be used in any property tag. See examples below.

Examples using the Cohort Queries tags

Note how property names are the same used in the Cohort Definition classes.





Indicator tags

 

Tag Name

Attributes

Root Tag

Comments

description

N/A

More than one

Generic tag to set a description for its root tag. Its content should be a string.

location

cohortDefinitionId

 

Self-closing tag.

parameter

type, name and label

More than one

This tag can be a self-closing tag or have a configuration tag as content.

configuration

N/A

parameter

Its content can be character data for the configuration of the parameter it refers to.

indicator

type and name

 

Its content can be a description tag and/or a property tag.


Dimension tags

 

Tag Name

Attributes

Root Tag

Comments

description

N/A

More than one

Generic tag to set a description for its root tag. Its content should be a string.

option

key AND cohortDefinitionId

 

Self-closing tag.

parameter

type, name and label

More than one

This tag can be a self-closing tag or have a configuration tag as content.

configuration

N/A

parameter

Its content can be character data for the configuration of the parameter it refers to.

dimension

type and name

 

Its content can be a description tag and/or a property tag.

DataSet tags

 

Tag Name

Attributes

Root Tag

Comments

description

N/A

More than one

Generic tag to set a description for its root tag. Its content should be a string

parameter

type, name and label

More than one

This tag can be a self-closing tag or have a configuration tag as content.

configuration

N/A

parameter

Its content can be character data for the configuration of the parameter it refers to.

row

cohortDefinitionId

 

Self-closing tag.

column

cohortDefinitionId

 

Self-closing tag.

dimension

type and name

 

Its content can be a description tag and/or a property tag.

XML Reports UI

TBD