Reports
A report definition in SanteDB's BI services framework represents an asset which is ultimately rendered to one or more output formats (like HTML, XLS, etc.).
Data sources for reports can be either a view or a query which can be referenced or inline with the report definition itself.
Report Definition Files
Report definition files define one or more data sources (query or view), metadata (including permission), and one or more views. These views represent different ways of representing data. For example you may have a report with a tabular view and a chart view.
The view contents are defined using XHTML and the content is generated using view components defined in the http://santedb.org/bi/view namespace.
Report View Components
There are several built-in view components which you can use for creating your report. They are:
Component
Description
<bi:aggregate>
Aggregate one of the reports data sources
<bi:locale>
Render a localized string into the report
<bi:repeat>
Repeat the contents of for each row contained in the data source
<bi:switch>
Conditional rendering of report components
<bi:value>
Bind the contents to a particular column in the current row.
<bi:chart>
Render a pie, line, bar, radar, donut or combination chart.
Aggregate Component
The aggregate component is used to aggregate a particular data source. This is useful for showing totals, averages, counts, etc.
The aggregation functions currently supported are:
Function
Description
sum
Adds the particular field or expression together
count
Counts the number of non-null values
count-distinct
Counts the unique instances of a value or expression
min
The minimum value for the value or expression in the dataset
max
The maximum value
avg
Average value
You can either aggregate a field, or an expression, for exam
Locale Component
The locale component will replace the value of the element with the correct string from the current locale.
Repeat Component
The repeat component is an iterator which opens a dataset and repeats until the rows in the data source are exhausted.
The contents of the repeat element is any content, for example, this component is used to create tables:
Switch Component
The switch component is used to provide conditional rendering of components.
For example, the switch statement can be used to provide iconography:
Value Component
The value component allows the rendering of report data elements or expressions.
The when changed indicates that the value should only be emitted when the previous rows' value is not equal to this row's value. For example:
This may output a table such as:
ui.patient
ui.visitDate
SMITH, JOHN
2019-03-11
2019-04-11
JONES, JENNIFER
2019-11-01
2 ui.patients.total
3
Chart Component
The charting component allows for quick creation of basic charts using the data found in the data source.
For example, to create a simple pie chart:
It is also possible to create composite charts
Reference Data / Layers
Within a bar, line or radar chart you can add reference data sets which are useful for comparing data against a known good value set. These reference sets will appear as other datasets on the chart, however are drawn from a different data source than the primary view.
Reference data sets must:
Have their first column match the
<labels>
or<axis>
elements as they appear on the chartShould be sorted in the same manner as the primary axis or dataset
Reference datasets are included via the @ref-source
attribute on the <bi:chart
element, and individual lines created using <bi:refset
. For example, if there is a chart with ages, and a target population to serve as a reference set:
Styling Chart Data
Charts can be styled using the following attributes on the <bi:dataset
or <bi:refset
as documented below.
backgroundColor
Color
Controls the fill color of the series
borderColor
Color
Controls the line color of the border
borderWidth
Number
Controls the width of the border drawn
fill
Boolean
When false
the series will not be a filled series
order
Number
The relative order of the series in the chart
pointRadius
Number
The radius of the data points on the series (so users can see the data value)
spanGaps
Boolean
When true, any gaps in data will be filled, when false the line will be broken
barThickness
Number
When using a bar graph, controls the width of each bar.
skipNull
Boolean
When true, elements with no value are skipped in the dataset.
Last updated