Keywords Tutorial - Create a Keyword to Report Daily Activity
Previous:
We'll now setup a keyword to report the daily activity for each user. Â To collect data, we first need a form that contains the questions we want to capture. Â This is similar to an SMS Survey (that is not actually used in any application but is only used by Messaging). Â
Setup the SMS Application
We need to add a new application to the existing project. Â This application will contain all the form that represents the data to be collected by each data collector. Â
Add a new application to the project by going to the Applications tab and choosing New Application -> Blank Application. Â
Update the first module and set the name to Data Reporter Surveys
And then set the case type to data_reporter
Add the Daily Activity Form
We'll add a daily activity form that is used by the data collector to report their work. Â This form will also contain a last_reported_date hidden value that will be saved to the case. Â We'll use this date to trigger alert reminders to the supervisor.Â
Rename the Untitled Form to Daily Report and add questions so it resembles the following:
Save the form and configure the case management for the form.  This form will be setup to update or close cases.  We'll only save the case property last_reported_date.  When we setup the missed data collection reminder, we can use this case property to determine if the person was late to report data by more than a day. Â
Configure the Data Collection Keyword
To setup the data collection keyword, go the Messaging tab, then on the left side choose Keywords.  Then click on the down arrow to choose Add Structured Keyword. This will add a keyword that is used for structured data collection (one SMS will provide multiple pieces of data). Â
We can now configure the basics of the keyword. Â A structured keyword will allow a user to answer all the questions in a given survey in a single SMS (by sending in a specially formatted SMS). Â For example, to report stock on hand, a user might send in SOH 65 12 to indicate they have 65 ORS packages and 12 zinc tablet packages on hand. Â
Keyword: This is the word that the user must send into the system to trigger the keyword.  For this tutorial, we'll use the keyword REPORT
Description: A quick description for what the keyword does. Â For this tutorial, we can set the description to "Allows a data collector to report on their daily activity".Â
Survey: This is the survey that contains the questions to be answered. Â For this, we'll choose SMS Surveys - Data Collector Surveys - Daily Report.Â
Delimiters: This allows you to choose a different character to separate each answer in the message.  For example, instead of sending SOH 65 12, some projects may prefer to send SOH-65-12.  For this tutorial, we'll just use the default delimiter (a space).Â
Use Named Answers: This allows you to specify a name for each answer (useful if you want to allow users to skip particular answers).  For example, instead of sending in SOH 65 12, a project may prefer to send in something like SOH o65 z12.  This would then allow users to just send SOH z12 or SOH o65.  Â
For this tutorial, we'll setup named answers to make it easier for users.  We'll use h for houses visited, and p for number of participants. Â
The xpath refers to the question in the form that each named answer is mapped to. Â This is just the path of that question when writing logic in the form. Â For example, a question with the IDÂ number_participants would have the xpath of /data/number_participants. Â
Example Structured Message: Based on the options you've chosen, you'll see a sample of the message that should be sent by a user.Â
In the Response section, we can configure a message that goes back to the sender or someone else when we receive the keyword. Â For this keyword, we can just send a message to the sender (the data collector) to let them know that we've received their report. Â
The advanced section will let you configure who can send in keywords (cases, mobile worker or both). Â There is also a setting to configure if they keyword will override any existing surveys. Â For example, if the user uses the word REPORT in a response to an SMS survey, this option will close that survey and trigger the REPORT keyword instead. Â