Implementation Plan
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
Work on the custom converters for the general tags, which are aimed to support the definition in XML of a wide number of reports.
The suggested approach to develop the converters is using reflection based on the types, parameters, datasets and properties provided by the user, and fail to create the report if one cannot be instantiated with the given characteristics.
The implementation will be committed to my forked repository and I will share the link.
In this phase of the project the report definitions will be saved the same way they are being currently saved. The user will be able to export a report definition in XML format.
The development of the converters will be carried out in a way that is easy to change the alias of the properties and the tag names.
The converters will have unit testing.
The new tags will be documented on the wiki.
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
Ticket:
Error rendering macro 'jira' : Unable to locate Jira server for this macro. It may be due to Application Link configuration.Suggested tags (in suggested implementation order):
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
Ticket:
Suggested tags (in suggested implementation order):
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
Suggested tags (in suggested implementation order):
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
Suggested tags (in suggested implementation order):
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