Table of Contents
Design and Configuration
The Report capabilities of Presentation Services is currently using SpagoBI as reporting service. The code was designed having multiple reporting services in mind, but it is still coupled to Spago.
The generic interface to communicate with an external Reporting Server is org.socraticgrid.report.api.ReportServiceIFace. The concrete implementation being used in runtime can be configured using spring in the file kmrReports.xml located in PresentationService's configuration directory.
Currently, there is only 1 implementation of this interface called com.cognitivemedicine.report.service.ReportServiceImpl. This implementation is not part of PresentationServices code.
The configuration of the available reports is done using 3 different tables: ReportTemplates, ReportParameters and ReportRoles.
ReportTemplates Table
This table contains the list of all available reports in the system. This table is still tightly-coupled to Spago.
Column Name | Type | Description |
---|---|---|
ReportTemplateId | integer | This id the auto-generated id of each entry. |
Name | string | The user-friendly name of the report. |
SpagoId | string | The id of the report template in Spago server. |
SpagoName | string | The id of the report template in Spago server. |
CreatedBy | string | Name of the creator of the report. (This field is not related in any way to Users table. Its value is only descriptive) |
Type | string | The type of the report as stated by Spago specifications. |
DatasetId | integer | The id of the dataset of this report in Spago. |
EngineId | integer | The Engine id of the report as stated by Spago specifications. |
ReportParameters Table
Column Name | Type | Description |
---|---|---|
ParameterId | string | This id each entry. |
ReportTemplateId | int | The id of the Report Template where this parameter belongs. |
ParameterLabel | string | The user-friendly label that should be displayed in the UI when the template's parameters form is displayed. |
ParameterName | string | The name of the parameter (this parameter is not currently being used). |
ParameterType | ENUM | Possible values: ['text', 'number', 'date', 'label', 'datetime-local', 'organization-combobox', 'facility-combobox', 'workspace-combobox'] |
ParameterURL | string | The identifier of this parameter in Spago BI. |
Nullable | boolean | Indicates whether this parameter is nullable or not. |
The supported parameter types are basically the same as in SurveyQuestions.AnswerType (From the Surveys API) with the addition of:
API
List Report Templates
Current Implementation
Reports are assigned to User's roles. This operation returns the list of Report Templates (and their parameters) that are available to the user that is invoking it.
Parameters
Base URL: /listReportTemplates
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
token | String | Yes | Security Token obtained before. |
userId | String | Yes | The id of the logged in user. |
API Sample
Get Report
Current Implementation
This operation executes a specific Report Template and returns it as a binary. The current implementation ALWAYS returns the Report as PDF.
Parameters
Base URL: /listReportTemplates
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
token | String | Yes | Security Token obtained before. |
userId | String | Yes | The id of the logged in user. |
reportTemplateId | String | Yes | The Id of the Report Template to be executed. |
<report-specific-parameters> | N/A | No | Each specific Report Template has a set of parameters (mandatory or not) that must be present in the request. |
API Sample
Happy Path
curl 'http://localhost:8080/PresentationServices/getReport' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: ' -H 'Origin: null' -H 'X-DevTools-Emulate-Network-Conditions-Client-Id: E0A956BA-D475-1E03-7349-4A852B5BB7CA' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' --data 'userId=sigal&token=8ea54194-b1c6-42af-adab-2de7f315e52b&reportTemplateId=3&organizationid=UNC&facilityid=' --compressed
Error Path
curl 'http://localhost:8080/PresentationServices/getReport' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: ' -H 'Origin: null' -H 'X-DevTools-Emulate-Network-Conditions-Client-Id: E0A956BA-D475-1E03-7349-4A852B5BB7CA' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' --data 'userId=sigal&token=8ea54194-b1c6-42af-adab-2de7f315e52b&reportTemplateId=3&organizationid=&facilityid=' --compressed
Add Comment