VOGO Voice – Knowledge Base

Socrata Show Chart Example

Estimated reading time: 7 min

Socrata is acloud-based service known for its built-in capability to create classic visual representation of government domain-specific data through a web interface in public interest so as to allow users the privilege to query, analyze and share information.

This instructional tutorial aims at illustrating a use-case on how to make use of a Socrata dataset for the purpose of data visualization in the form of a chart.  Adopting a comprehensive methodology, the tutorial is dedicated towards presenting a guided step-by-step walk-through to understand how to configure the Socrata connector instance within a custom interaction model, and design it with the needful combination of components to specifically address the requirements of a custom skill that uses both screen and voice interaction.

Prerequisites: 

  •  VOGO Voice account: https://www.vogovoice.com/
  • Access rights to the Intents section under Settings.
  • Access rights to Interaction builder platform.
  • Socrata 4×4 Dataset Identifier and Datasite URL.
  • Understanding how to write SoQL queries.
  • An Alexa device such as Alexa Echo Show. 

Setting up a Socrata connector instance

In order to create a Socrato connector instance
1. Log into your VOGO Voice account to be directed to VOGO Voice Management Console (https://account.vogovoice.com)
2. Navigate to Settings on the top right-hand corner of the Dashboard and select Integration from the list of tabs displayed.
Settings > Integration
3. Click on the Add Button on the top left-hand corner of the screen.

4. In the Select Account Type window, choose the Socrata icon from the list of connectors and click the Create Connector button which opens up the Add Socrata Connection window.
5. Populate the required fields in the Add Socrata Connection window.

Field values

Provide the Name assigned to the instance of the connector createdHere, the given name is Iowa Veterans.
In the Datasite field, input the Base URL of the open data portal to which access is intended. Here the input Datasite is data.iowa.gov.

The additional parameters in the Add Socrata Connection window are optional fields that need to be populated depending on the requirements of the skill. 

To learn more about the additional parameters, refer the Socrata connector guide: https://university.vogovoice.com/kb/socrata/

6. After filling in the required fields click the Save button to set up and integrate the connector instance with the platform.

Create a custom intent

Create an appropriate intent to be invoked for executing an interaction flow mapped to it to retrieve a list of wars and the count of veterans who fought those battles and return the required result set in the form of a chart.

Create an intent titled ‘Show Me a Chart Example’ with a sample utterance mapped to it. The sample utterance in this intent is: “Show me a chart example”.

To learn how to create custom intents refer the guide: https://university.vogovoice.com/kb/creating-intents/

Steps to Configure the Socrata connector instance

Once the Socrata connector has been created, navigate to Interactions and click on the Interactions button at the bottom right-hand corner of the screen. Select the ‘Show Me a Chart Example’ intent to be directed into the Interaction builder platform.

Now let’s create an interaction flow to return a resultset of the required data representing the list of wars alongwith the count of veterans who fought each of those battles, and use that data to create a chart. Ensure to format the query using the SoQL syntax. The end purpose of designing this interaction flow is to enable visualization of the chart on a video-enabled voice assisted device and thereby validate the dynamic side of a custom skill that uses both screen and voice interaction.

1. In the flow diagram area, you will be able to see the Start and Response component.
2. Unlink the Start component from the Response card by clicking the delete icon placed in the middle of the chain.

3. Drag and drop a Socratacomponent onto the flow diagram area and connect the anchor symbol of Next on the Start component to the Socrata connector.

🖍 Note: To interconnect the different components click on their respective Anchor symbols so as to chain and hold them in the interaction flow.

4. Double click the Socrata component, or click the pencil to access the Configuration window and fill in the required fields to insert the user specific input data.

Setting up the configuration fields for c1

Name: The name is provided by default and can be changed manually. It is used to identify the connector instance and how it is referenced throughout the flow. 

Data Set: In this field provide the 4×4 Dataset Identifier. In this instance being xqff-jfst for the respective dataset from the open data catalogs to which access is intended. You can also search for it by typing “Iowa Veterans Home Current and Past Residents” which will populate the 4×4 after selected. The Socrata dataset can also be found here https://data.iowa.gov/Health-Providers-Services/Iowa-Veterans-Home-Current-and-Past-Residents/xqff-jfst

To know more on how to locate the Dataset Identifier visit: https://university.vogovoice.com/kb/socrata/

Query: “Socrata Query Language” (SoQL) is the query language used to filter the datasets. Here a query is formulated to retrieve data representing the count of veterans who fought different battles along with the names of wars from the Socrata dataset and return a resultset which will be used for the preparation of the intended chart that is to be displayed through the device.

SELECT War,count (War) AS cnt group by War

To learn how to write SoQL queries visit https://dev.socrata.com/docs/queries/query.html

5. Drag and drop another Socrata component onto the flow diagram area and connect the anchor symbol of Next on the preceding Socrata component to it.

6. Double click the Socrata component, or click the pencil to access the Configuration window and fill in the required fields.

🖍 Note: Ensure to click the Save button to save the interaction flow as and when edits are made.

Setting up the configuration fields for c2

Name: The name is provided by default and can be changed manually. It is used to identify the connector instance and how it is referenced throughout the flow. 

🖍 Note: Ensure not to provide the same name for both the connector instances. 

Query: Frame the query to retrieve data representing the names of different battles along with the count of veterans who fought different wars. 

SELECT War,count (War) AS cnt group by War  ORDER BY cnt desc

👍 Note: Two connector instances are made use of because from the retrieved data through C1 only the data indicating the count is taken and from C2 the data representing the war names alone are used. This is done to tackle the mismatch of data as well as render the required result set in the correct order.

7. Drag and drop a Check variable component onto the flow diagram area.
8. Connect the second Socrata connector instance to the Check Variable component.

9. Configure the Check Variable component with a test condition using the relational operator is equal to. The flow for the existing user will proceed from Then if the device supports display features and from Otherwise if the device does not support the display capability.
1. Populate the left hand side of the Configuration window as in the screenshot shown below. Set the data type based on the input.

 Left-Hand side: capabilities.display (choose data type as Path).

💡 Tip: To autogenerate capabilities.display and its corresponding type as Path, navigate to the Data tab adjacent to the Components on the top left-hand side of the interaction builder platform, click on the plus button against Capabilities to have its subsection appear.  In the list that appears, click on Display by dragging and dropping it in the Left-Hand side value field of the Check Variable component. 

Right-Hand side: true (choose data type as Boolean)

To learn about different template engines to be followed to run functions visit https://university.vogovoice.com/kb/template-engine/

10. Drag and drop two Response components onto the flow canvas and link one to Then and the other to the Otherwise on the Check Variable Component.
11. Roll the mouse over the Response component attached to the Then on the Check Variable component to see the voice, computer and camera icon on the top right-hand side of the component.
12. Click on the Voice icon of the Response card to open up the Speak pop-up window and type the voice action intended to be spoken to the user whose device supports display capabilities.
  Say: We have prepared for you additional content along with some findings. The charting example you see displayed has been created using an Iowa dataset from Socrata data platform to identify the number of veterans who served in different wars.

To add a display message in a video-enabled voice-assisted device

  1. Click on the Computer icon which will open up a Show pop-up window.
  2. Populate the required fields and click the Save button.
    Title: Iowa Veterans
    Background Image URL:   https://image-charts.com/chart?chco=76A4FB&chd=t:38,769,532,850,369,2787,0&chds=a&chf=bg,s,757487&chl=38|769|532|850|369|2787|0&chm=N,000000,0,-1,11&chs=700×200&cht=bhs&chxl=0:|0|WWII|Vietnam|Korean|Peace%20Time|WWI|Gulf|&chxs=0,FFFFFF,13&chxt=y

💡 Tip: The above link has been created on image-charts.com using the resultset returned by the Socrata connector instances.

For further reference on how to populate the additional fields visit https://university.vogovoice.com/kb/guide-response-component/

13. Click on the Voice icon of the Response card attached to Otherwise to open up the Speak pop-up window with a field titled Say, and type the voice message to be relayed to the existing user when the test condition implemented in the Check Variable component is not satisfied.

Say: While we would love to show you a charting example your device does not support this feature. 

To add a display message in a video-enabled voice-assisted device
1. Click on the Computer icon, and type in a condensed version of the voice message in the field titled Display Message of the Show pop-up window.
2. Populate the required fields and click the Save button.
Title: Iowa Veterans
Display Message: While we would love to show you a charting example your device does not support this feature. 

The screenshot below captures the aforementioned interaction flow.

Testing and Validation

  1. Click on the Test button next to the Flow Editor button on the interaction builder platform.

2. In the Tests pop-up window that appears click the + button on its top right-hand corner. 

3. Fill the Name field of the Test Response window that shows up.

4. In the Conversation section of the Test Response, Show Me a Chart Example intent through which this interaction flow has been initiated will be auto-generated in the User invokes field.

5. Navigate further down and check the checkmark box of Display under the Device Capabilities section.

6. Finally, click the Save button to save the input and perform the test.
7. To validate the Test Response, click on the lightning symbol on the left-hand side of the test case. 

8. On the resultant Test Response window, the blue chat bubble presents the input message within the Response component. The 2 lightning bolt symbols in yellow represent the Socrata connector instances.

9. Click on the chat bubble to see the details of the response. To take a detailed look at the data fetching part of the connector instance, click on the lightning bolt icon highlighted in yellow. 

To know more about testing an interaction refer https://university.vogovoice.com/kb/testings/

Congratulations! You have successfully created a custom interaction model by making use of the Socrata connector instance to illustrate data visualization in the form of a chart. On the whole, you have designed an interaction flow that validates the dynamic functionality of a custom skill that is efficiently tailored and curated with voice responses to suit the specific requirements of the end-user.

👍 Note: To test the functioning of the interactions on your device you have to deploy the custom skill to facilitate the skill with the new edits. To accomplish this, click on the Deploy button seen at the bottom of the Skill Settings pop-up window.

To know how to deploy a custom skill visit https://university.vogovoice.com/kb/deploying-a-skill/

Tags:
Was this article helpful?
Dislike 0
Previous: Tutorial for stripping HTML
Next: If/Else