Reporter
Introduction#
The Piveau Metrics Reporter is part of the Metadata Quality Assurance (MQA) of Piveau. It exports metrics measurements about catalogues to PDF, XLSX and ODS files. In this way, the metrics information can be easily read, stored and shared by humans. The reports can be are generated in several languages.
What information does the Piveau Metrics Reporter export?#
Currently, the Piveau Metrics Reporter will export the following information to PDF, XLSX and ODS:
- an overview dashboard with the following metrics about all catalogues:
- catalogue country
- catalogue name
- Accessibility Access URL
- Accessibility Download URL
- DCAT-AP Compliance
- Machine Readability
- Rating
- detailed metrics about each catalogue:
- Contextuality (Rights available, File size available, Issued date available, Modified date available)
- Accessibility (Most frequent accessURL status codes, Most frequent downloadURL status codes, DownloadURL available)
- Reusability (License available, License from vocabulary, Access rights available, Access rights from vocabulary, Contact point available, Publisher available)
- Interoperability (Format available, Media type available, Format / Media type from vocabulary, Non-proprietary, Machine readable, DCAT-AP compliance)
- Findability (Keywords available, Category available, Spatial information available, Temporal information available)
Which external services and APIs are used by the Piveau Metrics Reporter to create the reports?#
The Piveau Metrics Reporter uses the iText library to create the PDF version of the report. To generate the chart images in the PDF, Quickchart is used.
Note
If you want to try out the Piveau Metrics Reporter locally, an instance of Quickchart needs to be running as well to create the chart images for the report.
For the XLSX version of the report, Apache POI is used. The ODS version of the report is created by copying the XLSX file to an ODS file - jOpenDocument is used fo this.
How does the Piveau Metrics Reporter work?#
Generally speaking, there are two manners to create a report: Either the generation of a single report in a single language and format is triggered via the API or all reports in all languages and formats are created and saved to the Piveau Hub. While the creation of an XLSX and ODS report are pretty straight forward (the information is pasted to the columns and labels in the correct language are added), the creation of a PDF is more sophisticated: Here, the PDF is styled with fonts and colours, the chart images are put in the correct place and pages which explain the metrics are added to the report.
Piveau Metrics Reporter Classes#
The Piveau Metrics Reporter consists of the following classes written in Java:
- The MainVerticle is the application entry point that handles requests coming from the API and starts the other Verticles. In case all reports for all languages need to be created, the MainVerticle fetches the data for all catalogues, creates a temporary directory where all report files are stored and hands this information to the PdfCreatorVerticle and TableReportVerticle for further processing.
- The PdfCreatorVerticle can either generate a single report in a single language or all PDF reports in all languages. In case of the second option, it creates temporary files for all languages and replaces them with the respective PDFs once they have been generated. It also handles all the chart images, translations and styling for a PDF.
- The TableReportVerticle can either generate a single XLSX or ODS report in a single language or all XLSX and ODS reports in all languages. After an XLSX report was created, it copys its contents to an ODS report. Therefore, an XLSX report must always be created before an ODS report can be generated.
- The UploadVerticle uploads the finished reports to the Piveau Hub.
- The XlsReport class manages the instances of the XLSX report.
- The ApplicationConfig contains the configuration for the service.
/model
classes:- The Catalogue class is a representation of a catalogue with ID, title, description, spatial, type and sections.
- The MetricsPdfDocument class is a representation of a single PDF document with a locale and Styles (see below).
- The ReportLabels class handles the translations for the reports.
- The ReportTask class is used to instantiate ReportTasks which are handed from the MainVerticle to the PdfCreatorVerticle or the TableReportVerticle when a report should be created. It contains information about the locale, the directory to store the finished reports in, the global dashboard and the catalogue metrics for the report.
- The Section class is instantiated to store the sections of a catalogue (Contextuality, Accessibility, Reusability, Interoperability, Findability) with heading and Charts (see below).
- The Styles class holds all font styles for a PDF document (e.g. headings, footer styles and paragraph styles).
/model/charts
classes:- The BarChartBundle class stores a a bar chart and its respective heading.
- The DoughnutChartBundle class stores a a doughnut chart and its respective heading.
- The ChartBundle interface is a blueprint for the Doughnut- and BarChartBundle.
/utils
classes:- The PdfUtils class contains static methods that help with the creation of the PDF.
- The ReportLabelCreator class is used to create all labels in the language of a certain locale.
- The TableCreator class is a helper class for the generation of the dashboard table with info about all catalogues in the beginning of the PDF.
API#
The report creation can be triggered via the API. Currently, there are three endpoints:
- POST
/generate
triggers the generation of all reprt formats in all languages - POST
/upload
triggers the upload of the generated reports to the Piveau Hub - GET
/report/{languageCode}/{format}
triggers the generation of one report in one language and format