1<?xml version="1.0" encoding="UTF-8"?>
  2<template xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3          xsi:noNamespaceSchemaLocation="http://chart/eps/schemas/report.xsd">
  4    <!--
  5
  6For a nice demonstration report ingest
  7
  8TDS RAPID and generate with
  9
 10chartmtg report -t test_report -s mtgi1 \-\-start 2019-10-21 \-\-stop 2019-10-22 -o ~/tmp/report \-\-ingest
 11
 12See CSAD comments below too.
 13-->
 14
 15    <!-- This might enable nice Latex math notation inside paragraph or html widgets.
 16         It's not been used outside of CHART-EPS before -->
 17    <!-- <enable-mathjax>true</enable-mathjax> -->
 18
 19    <!-- In the meta default section we can set standard attributes for any widget -->
 20    <meta>
 21        <default>
 22            <graph>
 23                <width>1000</width>
 24                <height>400</height>
 25                <zoom>
 26                    <width>1600</width>
 27                    <!-- <height>700</height> -->
 28                </zoom>
 29            </graph>
 30        </default>
 31    </meta>
 32
 33    <title>
 34        <text>Test Report for {{sid.name}}</text>
 35    </title>
 36
 37    <table-of-contents/>
 38
 39    <heading>
 40        <text>Overview</text>
 41    </heading>
 42
 43    <paragraph>
 44        <text>This is a test report to demonstrate and test some project features</text>
 45        <text>Unicode glyphs are allowed in paragraphs: </text>
 46        <rst>It covers the period:
 47         * Start: {{start|date:"Y-m-d"}}
 48         * Stop: {{stop|date:"Y-m-d"}}
 49        </rst>
 50    </paragraph>
 51
 52    <heading>
 53        <text>Out of limit status</text>
 54    </heading>
 55
 56    <table>
 57        <title>Out of limit conditions</title>
 58        <column>
 59            <name>timestamp</name>
 60            <label>Timestamp</label>
 61            <description>Time when the violation began</description>
 62            <sort>ascending</sort>
 63        </column>
 64        <column>
 65            <name>parameter</name>
 66            <label>Parameter</label>
 67        </column>
 68        <column>
 69            <name>violation</name>
 70            <label>Violation</label>
 71        </column>
 72        <column>
 73            <name>ool_state</name>
 74            <label>OOL state</label>
 75        </column>
 76        <!-- <column><name>debug</name></column> -->
 77        <source>
 78            <event>OOL-LIMIT</event>
 79            <!-- Remove events where start_change is 0 meaning a duplicate -->
 80            <condition>
 81                <template>{% if properties.state_change == 0 or properties.ool_state|upper == "NOMINAL" or properties.ool_state|upper == "UNCHECKED" %}drop{%endif%}</template>
 82            </condition>
 83            <!-- Render a nice start time for the Timestamp column -->
 84            <render>
 85                <column>timestamp</column>
 86                <template>{{start_time|date:"Y-m-d:h.m.s"}}</template>
 87            </render>
 88            <!-- Show parameter "name (description)" as the source -->
 89            <render>
 90                <column>parameter</column>
 91                <template>{{properties.param_name}} ({{properties.param_desc}})</template>
 92            </render>
 93            <!-- Show either the high or the low threshold -->
 94            <render>
 95                <column>violation</column>
 96                <template>{% if properties.ool_state|upper == "LOW" %}
 97                Value {{properties.ool_value}} below limit {{properties.min_value}}
 98                {% elif properties.ool_state|upper == "VIOLATED" %}
 99                Value {{properties.ool_value}} violates limit {{properties.min_value}}
100                {% elif properties.ool_state|upper == "NOMINAL" %}
101                Value {{properties.ool_value}} within limit {{properties.min_value}}
102                {%else%}
103                Value {{properties.ool_value}} above limit {{properties.max_value}}
104                {%endif%}</template>
105            </render>
106            <render>
107                <column>ool_state</column>
108                <template>{{properties.ool_state}}</template>
109            </render>                                
110        </source>
111    </table>
112
113    <heading>
114        <text>Telemetry displays</text>
115    </heading>
116
117    <subheading><text>Basic plot</text></subheading>
118
119    <graph>
120        <title>A normal plot with no customisation</title>
121        <sampling>all-points</sampling>
122        <trim>true</trim>
123        <legend>embedded-bottom-right</legend>
124        <datapoint>
125            <field>TM.AST00219</field>
126        </datapoint>
127        <datapoint>
128            <field>TM.CRTR2131</field>
129            <y-axis>right</y-axis>
130         </datapoint>
131    </graph>
132
133    <subheading><text>Extreme plot</text></subheading>
134
135    <graph>
136        <!-- Graph heading -->
137        <title>A silly version of a plot to demonstrate customised line and font sizes and colours</title>
138        <!-- Force no stats for this plot -->
139        <sampling>all-points</sampling>
140        <!-- Adjust the x axis limits to match the data available -->
141        <trim>true</trim>
142        <!-- For better use of space we put the legend inside the main graph area -->
143        <legend>embedded-bottom-left</legend>
144        <!-- Configure the x (time) axis -->
145        <x-axis>
146            <!-- We can change the size of the axis label text -->
147            <label-fontsize>16</label-fontsize>
148            <!-- And also the size of the tick labels -->
149            <fontsize>30</fontsize>
150            <!-- Using a day locator to force a tick every x days... -->
151            <locator>day</locator>
152            <!-- ... where x is given by locator-modulus -->
153            <locator-modulus>2</locator-modulus>
154            <!-- Custom tick label format, using codes from
155                 https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes
156                 -->
157            <format>%Y-%m-%d/%H</format>
158            <colour>magenta</colour>
159            <label-colour>green</label-colour>
160        </x-axis>
161        <!-- left hand axis configuration -->
162        <y-axis>
163            <fontsize>12</fontsize>
164            <label-fontsize>20</label-fontsize>
165            <colour>blue</colour>
166            <label-colour>magenta</label-colour>
167            <minor-ticks>1.6667</minor-ticks>
168        </y-axis>
169        <!-- right hand axis configuration -->
170        <y-axis>
171            <position>right</position>
172            <colour>red</colour>
173            <label-colour>red</label-colour>
174        </y-axis>
175        <datapoint>
176            <!-- We can assign colours by name ... -->
177            <!-- <colour>orange</colour> -->
178            <!-- or by RGB -->
179            <colour>#f97c7c</colour>
180            <!-- Plot a telemetry value. Table (table.field) notation is also allowed -->
181            <field>TM.CRTR2131</field>
182        </datapoint>
183        <datapoint>
184            <!-- <field>HSMF070X</field> -->
185            <field>TM.AST00219</field>
186            <!-- We force a second axis to display this point -->
187            <y-axis>right</y-axis>
188         </datapoint>
189    </graph>
190
191    <subheading><text>Raw plot</text></subheading>
192
193    <graph>
194        <title>As above but non-calibrated data</title>
195        <sampling>all-points</sampling>
196        <trim>true</trim>
197        <legend>embedded-bottom-left</legend>
198        <calibrated>false</calibrated>
199        <datapoint>
200            <field>TM.AST00219</field>
201        </datapoint>
202        <datapoint>
203            <field>TM.CRTR2131</field>
204            <y-axis>right</y-axis>
205         </datapoint>
206    </graph>
207
208
209
210    <heading><text>A paragraph of text</text></heading>
211
212    <paragraph>
213        <text>
214Exceeding reaction chamber thermal limit. We have begun power-supply calibration. Force fields have
215been established on all turbo lifts and crawlways. Running a level-two diagnostic on warp-drive
216systems. Antimatter containment positive. Warp drive within normal parameters. There is an
217approaching ion trail characteristic of a freighter escape pod. Detecting some unusual fluctuations
218in subspace frequencies.  Deflector power at maximum. Energy discharge in six seconds. Warp reactor
219core primary coolant failure. Fluctuate phaser resonance frequencies. Resistance is
220futile. Recommend we adjust shield harmonics to the upper EM band when proceeding. These appear to
221be some kind of power-wave-guide conduits which allow them to work collectively as they perform ship
222functions. Increase deflector modulation to upper frequency band.
223        </text>
224    </paragraph>
225
226    <heading><text>Some less standard plots</text></heading>
227
228    <subheading><text>Correlation and scatter plots</text></subheading>
229
230    <layout><type>horizontal-begin</type></layout>
231
232    <!--graph-xy>
233        <title>A correlation plot between 2 parameters</title>
234        <width>400</width>
235        <x-series>A99E068T</x-series>
236        <y-series>A99E069T</y-series>
237    </graph-xy-->
238
239    <layout><type>horizontal-continue</type></layout>
240
241    <graph>
242        <title>A scatter plot</title>
243        <appearance>scatter</appearance>
244        <legend>none</legend>
245        <width>500</width>
246        <height>400</height>
247        <datapoint>
248            <field>TM.AST00219</field>
249        </datapoint>
250    </graph>
251
252    <layout><type>horizontal-end</type></layout>
253
254    <subheading><text>Histogram plots</text></subheading>
255
256    <layout><type>horizontal-begin</type></layout>
257
258    <histogram>
259        <title>Histogram from flat table storage for 2017-01-01</title>
260        <!-- we only have csad data for 2017-01-01 so get an empty plot
261             unless the report is for that day, or absolute-start/stop-time
262             is implemented -->
263        <width>700</width>
264        <height>600</height>
265        <absolute-start-time>2017-01-01</absolute-start-time>
266        <absolute-stop-time>2017-01-02</absolute-stop-time>
267        <datapoint>
268            <field>ORBIT4ANT.X</field>
269        </datapoint>
270    </histogram>
271
272    <layout><type>horizontal-continue</type></layout>
273
274    <histogram>
275        <title>Histogram from JSONB storage</title>
276        <width>700</width>
277        <height>600</height>
278        <datapoint>
279            <field>TM.CRTR2131</field>
280        </datapoint>
281    </histogram>
282
283    <layout><type>horizontal-end</type></layout>
284
285    <subheading><text>Minmax plot</text></subheading>
286
287    <subheading><text>Stats plots</text></subheading>
288
289    <layout><type>horizontal-begin</type></layout>
290
291    <graph>
292        <title>Stats plot - min/max shading and avg line</title>
293        <width>700</width>
294        <height>400</height>
295        <sampling>stats</sampling>
296        <appearance>dynrange</appearance>
297        <datapoint>
298            <field>TM.CRTR2131</field>
299        </datapoint>
300    </graph>
301
302    <layout><type>horizontal-continue</type></layout>
303
304    <graph>
305        <title>Stats plot - averages only</title>
306        <width>700</width>
307        <height>400</height>
308        <sampling>stats</sampling>
309        <appearance>line</appearance>
310        <datapoint>
311            <field>TM.CRTR2131</field>
312        </datapoint>
313    </graph>
314
315    <layout><type>horizontal-end</type></layout>
316
317    <subheading><text>Coverage plots</text></subheading>
318
319    <layout><type>horizontal-begin</type></layout>
320
321    <graph>
322        <title>Global coverage showing total telemetry packet count per 20 minute stat region</title>
323        <width>700</width>
324        <height>400</height>
325        <sampling>stats</sampling>
326        <appearance>line</appearance>
327        <datapoint>
328            <field>TM_STORE.ROWCOUNT</field>
329        </datapoint>
330    </graph>
331
332    <layout><type>horizontal-continue</type></layout>
333
334    <graph>
335        <title>Coverage plot showing number of A99E021R values per 20 minute stat region</title>
336        <width>700</width>
337        <height>400</height>
338        <sampling>stats</sampling>
339        <appearance>line</appearance>
340        <datapoint>
341            <field>TM.AST00219</field>
342        </datapoint>
343    </graph>
344
345    <layout><type>horizontal-end</type></layout>
346
347    <subheading><text>Anomaly removal</text></subheading>
348
349    <layout><type>horizontal-begin</type></layout>
350
351    <graph>
352        <title>A plot with some anomalous values</title>
353        <width>700</width>
354        <height>300</height>
355        <appearance>line</appearance>
356        <datapoint>
357            <field>TM.AST00535</field>
358        </datapoint>
359        <!-- this is to work with our current test data which doesn't have many points available
360             Therefore with a big zoom graph, subsampling is not possible and the anomaly
361             removal algorithm won't work -->
362        <zoom>
363            <width>1000</width>
364        </zoom>
365    </graph>
366
367    <layout><type>horizontal-continue</type></layout>
368
369    <graph>
370        <title>Same plot with anomalies filtered</title>
371        <width>700</width>
372        <height>300</height>
373        <appearance>line</appearance>
374        <anomaly-response>remove</anomaly-response>
375        <anomaly-threshold>1</anomaly-threshold>
376        <zoom>
377            <width>1000</width>
378        </zoom>
379        <datapoint>
380            <field>TM.AST00535</field>
381        </datapoint>
382    </graph>
383
384    <layout><type>horizontal-end</type></layout>
385
386</template>