Exercise Report Generation - Advanced Topics

Introduction

In the Console, an Instructor can generate reports for any sessions of any students in the Instructor page. A student can generate reports for their training sessions in the User page.

The Exercise Reports are generated using Python Scripts. This document describes the scripts used to generate Exercise Reports.

Python Scripts for Report Generation

The main script used for generating the reports is exercisereport.py.  This script accepts arguments that identify the database where the session data is found, the session(s) for which reports are to be generated, and options for the display of the information.

The arguments are as shown below.  They are displayed if the script is run with the --help option.

Since the exercisereport.py script is normally called from the Vortex Console, the values for the arguments are taken from either  the Console's application settings (defined in the VXC file), or from user selections (language and unit systems).

--host HOST: Database Host defined in the Mongo Database Module. If not specified, the default is localhost.

--port PORT: Database Port defined in the Mongo Database Module. If not specified, the default is 27017.

--db DB: Database Name defined in the Mongo Database Module. If not specified, the default is ConstructionDB.

--session [SESSION [ SESSION ...]] : one or more session _id identifiers, as found in the database. For example, "5ec3e1d361a6003710001ff2".

--output-directory OUTPUT_DIRECTORY: in the Console, this is hardcoded to the user's %HOME%/Vortex Reports/ folder. If it is not specified, the %TEMP% folder is used.

--assets ASSETS: the Assets Base Path defined in the Console Module.

--units UNITS: the unit system to use for displaying the metrics values. This is normally selected by the user on the Console Login page. Either metric or us may be specified.  If it is not specified, metric is used.

--language LANGUAGE: the language to be used to for the report.  Only languages which are supported by the Console and are are available for selection on the Login page can be used for generating reports.  The language format is ll_CC, where ll is the 2-character lower-case language code and CC is the 2-character upper-case country code.  For a list of language and country codes, refer to https://wiki.openstreetmap.org/wiki/Nominatim/Country_Codes. 

--layoutRightToLeft: if specified, the report will be laid out in a right-to-left fashion. If it is not specified, it will be based on the 'QT_LAYOUT_DIRECTION' setting in the language file being used. Refer to Right-to-Left Languages.

--jsonprogress: if specified, progress of the report generation is output in JSON format.


Other scripts used by exercisereports.py provide support functions for report generation.  

bidirstring.py: defines classes BidirString, BidirParagraph and BidirTable. These are used to format either left-to-right and right-to-left formatting of strings, paragraphs and tables of report content.

progress.py: provides support for displaying the progress of the report generation.

progressreport.py: provides output of progress of the report generation operation.

reportsections.py: gathers data and formats the output of the various sections of the report, adding them to the output document.

unitsystem.py: this script is generated as part of the Vortex toolkit build process. It provides functions for physical dimensions, unit symbols and conversion between Metric and US Customary unit systems .

Examples

For the session shown in the database below (refer to Vortex Student Database Schema for more details on database structure):


Report for session with _id = ObjectId("5ec3e1d361a6003710001ff2"), metric units (default), English language (default).

>python exercisereport.py --host localhost --db TestDB --session "5ec3e1d361a6003710001ff2" --assets "D:\SampleModels\VTSP_Construction\trunk\content\assets"

Generates the report: exerciseReport_GUEST_2020-05-19_09-40-35.pdf


Report for session with _id = ObjectId("5ec3e1d361a6003710001ff2"), US customary units, French language.

>python exercisereport.py --host localhost --db TestDB --session "5ec3e1d361a6003710001ff2" --assets "D:\SampleModels\VTSP_Construction\trunk\content\assets" --units us --language fr_FR

Generates the report: exerciseReport_Invité_2020-05-19_09-40-35.pdf