Support Article
Issue while using Text Analytics and Declare Trigger together
Summary
User is using Text Analytics capability (PegaNLP - 07.10 ruleset) on Pega 7.2 platform and is trying to build a Social Media Complaint Analysis application.
This application has to listen to social media, analyze if contents are negative and if so, invoke resolution actions.
User has used Data Set and Data Flow to dynamically receive tweets and facebook posts, get the sentiments and store in PR_DATA_NLP_SUMMARY Table.
Next user has written a Declare Trigger on this table (of class Data-NLP-Report-Summary) to invoke resolution case whenever new tweet or post is recorded in database table.
The issue is, if user keep the option "Trigger When an Instance is" as SAVED then it always process the second last record (for example, second last row or last tweet or post which was saved a minute back).
If COMMITTED SAVE is selected, sometimes it does not save the record in PR_DATA_NLP_SUMMARY table at first instance, sometimes it fetches the last record and invokes the case multiple times.
Error Messages
Not applicable
Steps to Reproduce
- Create Data Set, Data Flow and Free Text Model to get posts from Twitter.
- Create a sample case with resolution steps in case designer.
- Add a Trigger in Data-NLP-Report-Summary table, trigger activity to invoke the case.
Observe that the Trigger activity always process second last record irrespective of "Trigger When an Instance is" option is committed save or save.
Also "COMMITTED SAVE" option sometimes stop the system to save the social media record from Data Flow (in table PR_DATA_NLP_SUMMARY).
Root Cause
The case creation feature is available within the Data Flow itself instead of calling the Declare Trigger.
Resolution
Follow below steps to create a resolution case based on the sentiment analysed on a Tweet within the Data Flow -
Invoking case creation within Data Flow:
- Add a Filter component after the “Free Text Model”.
- Create a Negative Sentiment Filter.
- Add a condition “.NLPOutcome.pyOverallSentiment = Negative”.
- Add additional destination to a Case.
In this scenario after the sentiment analysis, it has a filter which does a Negative sentiment which saves into the summary as well as it creates a case.
To capture the Positive sentiment as well; filter could be modified as below:
In order to process the sentiment on the texts which resides on the database table column, following needs to be performed:
- Create a new Data Set.
- Select the type as Database Table which applies to Database class.
- Select the Database columns.
In order to analyze the specific property say “InputText”, one must create a free text model in the same applies to class.
Map the Outcome to a Single Page property which is defined on Data-NLP-Outcome class.
Once done need to create the Data Flow in the same class, in similar way as mentioned above.
Published August 25, 2016 - Updated December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.