Documentation

This page hosts the documentation of the SmartCGMS software architecture and all of its components.


Drawing Filter v2

The drawing filter accumulates all signals and relevant events to create visualization. This version of a drawing filter is supercedes the Drawing filter (legacy). However, not all features of the legacy filter are supported in this version and are yet to be implemented.

It uses SVG as an exchange format - the GUI needs to support SVG graphics format to properly draw it in its widgets.

The drawing filter currently supports the following views:

  • Graph view - an overview plot of all signals
  • CVGA - Control variability grid analysis; this visualizes every time segment as a single dot in a grid to depict the quality of glucose control

Configuration

  • Default_Width (integer) - default width of the canvas, to which the renderer will draw; this can be later changed in drawing request
  • Default_Height (integer) - default height of the canvas, to which the renderer will draw; this can be later changed in drawing request
  • Graph_View_Filename (string) - path to an output file for graph view
  • Cvga_Filename (string) - path to an output file for CVGA view

Supported interfaces

  • scgms::IDrawing_Filter_Inspection_v2
  • scgms::ILogical_Clock

General function

The drawing filter instance accumulates all events and draws a set of plots upon request. The request is usually triggered periodically by the GUI, or upon receiving a Shut_Down device event. Once the Shut_Down device event arrives, the filter stores the generated drawings into given output files.

This filter chooses visualization elements based on the actual signal descriptors, unlike the legacy filter, Drawing filter (legacy).

The filter maintains an internal logical clock. When a new event arrives, that would cause an update to the drawings, the logical clock increments. An external controller can determine, if a redraw is needed based on this value. The logical clock value could be retrieved using HRESULT Logical_Clock(ULONG* clock) method. The clock pointer points to a current value of the clock seen by the external source. The implementation then compares the current logical clock value to the supplied one, and outputs S_FALSE if the clock value did not change, S_OK if the clock value changed and also updates the referenced clock value, or E_ILLEGAL_STATE_CHANGE if the referenced value is greater, than the internal clock value (thus indicating an error in controller logic).

The external controller code can determine the supported plots via the HRESULT Get_Capabilities(refcnt::IVector_Container<scgms::TPlot_Descriptor>* descs) method call. The container holds a vector of plot descriptors, which are just a pair of GUID and a textual description (const wchar_t*).

For the purpose of GUI interactivity, the external controller might retrieve visualizable segments via the HRESULT Get_Available_Segments(refcnt::IVector_Container<uint64_t>* segments) call. This call retrieves a vector of time segment IDs, that are currently stored in the drawing filter memory and could be visualized.

The same applies to retrieving all available signals via the HRESULT Get_Available_Signals(uint64_t segment_id, refcnt::IVector_Container<GUID>* out_signals) call. The GUI controller can retrieve a set of signals for a given time segment. The method fills the vector of drawable signals (i.e., their respective GUIDs).

Once the GUI controller decides to perform drawing, it calls the HRESULT Draw(const GUID* plot_id, refcnt::str_container* svg, const scgms::TDraw_Options* options) method. It requests the view identified by the GUID stored in plot_id parametrized by the options stored in options container. Once the drawing is finished, it stores the resulting SVG graphics into the svg string container.

The options container structure contains the following parameters:

  • segments (array of integers) - contains an array of segment IDs to be drawn; if set to nullptr, the filter draws all segments
  • segment_count (integer) - contains the size of the segments array
  • in_signals (array of GUIDs) - contains an array of signal GUIDs to be drawn; if set to nullptr, all signals are drawn
  • reference_signals (array of GUIDs) - contains an array of reference signal GUIDs to the matching signals (on the same index) in the in_signals array; this is needed for e.g., the error grid analysis and ECDF views
  • signal_count (integer) - contains the size of the in_signals and reference_signals arrays
  • width (integer) - requested canvas width; if set to 0, default width is used
  • height (integer) - requested canvas height; if set to 0, default height is used