Developer Notes

Contents

Overview

The WRRS Messaging Metrics Dashboard provides a quick way to view the number of messages being processed from NDR. Users can also view the number of messages processed by message type and by health board. The application has been developed and tested specifically for Internet Explorer 11, but is compatible with other browsers with HTML5 and JavaScript enabled.

Developed on the ASP.NET MVC 5 framework, the Dashboard uses the following technologies: The Messaging Metrics Dashboard is an ASP.NET MVC 5 application that displays the volume of messages successfully processed between clinical systems. Message volume can be viewed by department or system type.
It supports three system categories: The metrics themselves are stored in Service Broker queues, and retrieved through stored procedures. The data access layer of the application converts the returned data to JSON format, which is forwarded to the view layer on an AJAX request.

To render the graphs for the metrics, the application uses amCharts and Chart.js.

Under the application title/header, there is the drop-down menu. Eventually this might be used to enable the user to switch between dashboards for Pathology, Radiology and Cardiology:

JavaScript Chart Frameworks

The application imports amCharts and Chart.js, which are third-party frameworks for rendering the metrics charts. Chart.js requires jQuery also to make AJAX requests.

The main chart in the Dashboard currently shows the total number of messages processed over the past several days. The maximum period is determined by the stored procedure, but any period within that can be selected using amCharts' slider at the top of the graph

View and Web API Controllers

Refers here to the view controllers. The view controllers themselves are very basic, without any additional logic other than routing the browser requests to the appropriate view.
The actual logic for returning the data to the charts is found in the Web API controllers: The Web API controllers handle the access of objects representing the data returned by the stored procedures in the data access layer.
In the view layer, a Web API controller is invoked by AJAX requests. The code for this varies between AmCharts and Chart.js. The latter depends on jQuery's '
  • $.ajax
  • ' function to make this request to the Web API controller.

    Model

    Entity Framework is used to model the stored procedures and the return data, rather than the application being designed to query the database directly.
    In the messaging database is stored procedure called ‘prMessagesProcessedByDay’. This takes one input parameter, ‘NoOfDays’ and returns a table with three column fields: Date, Id and MessagesProcessed. These were imported as an Entity Framework model.

    The Context.cs file determines the parameters or values to be passed to the stored procedure through the EF model. Here it’s simply NoOfDays as an integer.
    public virtual ObjectResult prMessagesProcessedByDay(Nullable noOfDays)
    {
    var noOfDaysParameter = noOfDays.HasValue ?
    new ObjectParameter("NoOfDays", noOfDays) :
    new ObjectParameter("NoOfDays", typeof(int));

    return((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("prMessagesProcessedByDay", noOfDaysParameter);
    }
    The values returned by the stored procedure are: public Nullable Id { get; set; }
    public Nullable Date { get; set; }
    public Nullable MessagesProcessed { get; set; }

    References

    AMCHARTS. 2017. JavaScript Charts & Maps. [WWW]. https://www.amcharts.com. 19th April 2017.

    CHART.JS. 2017. Chart.js. API Documentation. [WWW]. http://www.chartjs.org/docs/. 19th April 2017.

    JQUERY FOUNDATION. 2017. jQuery API Documentation. jQuery.ajax(). [WWW]. http://api.jquery.com/jquery.ajax/. 19th April 2017.