Using the Descriptive Analytics Sample Mashup
One way to use the data generated by the services in the StatisticalMonitoring or StatisticalCalculation microservers is by building a mashup to visualize the data. A reference mashup is provided below, along with some sample data to implement it with. By experimenting with the provided Statistical Calculation sample, you can explore how a mashup is built to display descriptive analytic data.
Requirements
• ThingWorx Composer is installed and running.
• Descriptive Analytics microservice is installed and the services in the StatisticalCalculation microservice are available.
◦ Statistical_Calculation_Reference_Implementation.xml
◦ signalData.csv
◦ temperatureData.csv
• The preparation tasks in
Preparing to Use the Services have been completed. During these preparation, when you attach a ThingShape from the
Implemented Shapes field, select the StatisticalCalculationThingShape.
Preparing the Reference Mashup
1. In ThingWorx Composer, use the import as file option to import the reference mashup xml file that you extracted above: Statistical_Calculation_Reference_Implementation.xml
The following are created in ThingWorx:
◦ A Mashup called StatisticalCalculationReferenceMashup
◦ A Thing called CsvRepo
3. In ThingWorx Composer, import the CSV Parser as an extension.
4. In ThingWorx Composer, open the CsvRepo Thing and under My Services, execute the InitializeRepo service.
An Output message of Successful! is returned and a new CsvRepo folder is created in your \ThingworxStorage\repository\ filepath.
5. Move the sample CSV data files (the files you extracted above: signalData.csv and temperatureData.csv) into the new CsvRepo folder.
6. In ThingWorx Composer, open the CsvRepo Thing and under My Services, execute the ImportCsvData service. When prompted, enter the following Inputs:
◦ fileName – Enter the name of the file where the data will come from.
◦ destinationThing – Select the Thing you created.
◦ destinationProperty – Enter the name of a logged property on the Thing.
Click the green Execute button.
An Output message of Successful! is returned and the data for the selected property is imported for use in the sample mashup.
Viewing Data in the Reference Mashup
1. In ThingWorx Composer, navigate to > > and open the StatisticalCalculationReferenceMashup.
The mashup opens in Design view.
2. Click Preview at the top of the screen.
A new browser tab opens with a preview of the mashup.
3. Click the selector icon (
) in the
Thing Selector field and select the Thing you created.
4. In the Property Name field, enter the logged property you entered as the destinationProperty when you imported the CSV data.
5. Click the start and end dates at the top of the screen and select new dates to change the range of data that will display. The available sample data only runs from the beginning of January to the end of February 2018.
6. Click Update Data and data will be displayed in each chart of the mashup.
| To view data in the mashup from another property, execute the ImportCsvData service again using different input prompts (a different data file name and/or property). After data for multiple properties is imported, you can switch between viewing data for those properties in the mashup by changing the Property Name and clicking Update Data. |