cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Prescriptions Mashup for Thingworx Analytics

Amethyst

Prescriptions Mashup for Thingworx Analytics

I have created a mashup which allows you to easily use and test the Prescriptions functionality in Thingworx Analytics (TWA). This is where you choose 1 or more fields for optimization, and TWA tells you how to adjust those fields to get an optimal outcome.

 

The functionality is based on a public sample dataset for concrete mixtures, full details are included in the attached documentation.

 

PrescriptionMashup.PNG

11 REPLIES 11

Re: Prescriptions Mashup for Thingworx Analytics

Can you help to explain the id fielfs amd lever fields in the function prescribeStrength() and how they are populated

Re: Prescriptions Mashup for Thingworx Analytics

Hi, I think the Lever fields are important but the Id fields are probably not (you could test the results with excluding the Id fields, i.e. removing parameter identifierFields: idFields from the call to RealtimeScore).

 

The Lever fields are populated due to an infotable called leverSelection which is passed in as an input from the mashup when the service is called. These are the fields which the user has selected in the list using multi-select. So for example if you highlight fields Age and FineAggregate, then these become the levers and Thingworx Analytics (TWA) will optimise these values to maximise (as per the call to RealtimeScore) the goal field which is CompressiveStrength. TWA will return the optimal settings for Age and FineAggregate (in this example), which are displayed on the mashup. If I remember correctly, theoretically the values shown for Age and FineAggregate aren't necessarily the optimal values but in practise usually they should be.

Re: Prescriptions Mashup for Thingworx Analytics

Hi,

 

Thank you very much for this demo, since I have found no other source for prescriptive analytics helpful like this.

 

I tried to duplicate all the entities you created and use it in my project, but at the end I get this message below when I run the "PredictStrength" service:

" Error executing service PredictStrength. Message :: Error returned from service [500]: Failed to score: Unable to retrieve results at results:/models/nq2019_NQ2019Model_46eba09a-2e88-4b1d-8994-48f0d7a1820a. Received response: {"code":404,"message":"Could not retrieve result [nq2019_NQ2019Model_46eba09a-2e88-4b1d-8994-48f0d7a1820a]"} - See Script Error Log for more details."

 

Can you help me on this? Thanks in advance.

 

 

Re: Prescriptions Mashup for Thingworx Analytics

Thanks. Am I correct in understanding that you are able to make the provided demo work, but when you try and port the code to your application/entities then it fails? If that's the case, please could you export your entities and attach them here so I can test them?

Re: Prescriptions Mashup for Thingworx Analytics

Yes, you are correct. Your demo worked. But I tried both predictStrenght and prescribeStrength but got same error. TWX files and the model is attached. Goal is T1401.

Re: Prescriptions Mashup for Thingworx Analytics

I tried importing your entities but I got this error:

 

Unable to process import: Validation Failure: DataShape nesquik_provider.concrete_concrete1_c2054f0a-afb2-4880-b471-3cd13a574efa.ResultDataShape Had An Invalid DataShape [nesquik_provider.concrete_concrete1_c2054f0a-afb2-4880-b471-3cd13a574efa.ResultimportantFieldsDataShape] assigned to field [importantFields]

 

So could you please re-export and include this data shape?: nesquik_provider.concrete_concrete1_c2054f0a-afb2-4880-b471-3cd13a574efa.ResultimportantFieldsDataShape

Re: Prescriptions Mashup for Thingworx Analytics

Hi, I think on Thing ConcreteHelper you should set ModelID = c2054f0a-afb2-4880-b471-3cd13a574efa

 

This should be the same ModelID that you see in Analytics Builder as shown in the below screenshot.

 

ModelJobID.PNG

Re: Prescriptions Mashup for Thingworx Analytics

Thanks, modelID mistake was the reason for 403 error. Now I have a new one:

"Error executing service prescribeStrength. Message :: Wrapped com.thingworx.common.exceptions.GenericHTTPException - See Script Error Log for more details."

 

Entities with the right data shapes is attached.

Re: Prescriptions Mashup for Thingworx Analytics

Hi oaslan,

 

Are you still receiving the error:

"Error executing service prescribeStrength. Message :: Wrapped com.thingworx.common.exceptions.GenericHTTPException - See Script Error Log for more details." ?

If yes, what errors are reported in the Script Error Log?

The log can be found via path <>\ThingworxStorage\logs

 

Best,

Asia

Announcements