Skip to main content

Custom Commands with Grammar and Data Sets

Using a command grammar we can either perform different actions or have different spoken forms.

  1. Create a command and save it. Grammar variables can be used to insert content via the text step or handled via a Script step.

    1. To use variables in a text step, enclose the variable in angular brackets <variableName>.

    2. To read a variable in JavaScript use

var variableVal = fd.Result.GetParameter(“variableName”);

image104.jpeg
  1. Open the Manage commands window in Secret Mode to enable the "Set grammar" button when editing commands. With "Set grammar" you can create complex grammars.

  2. image105.jpeg
  1. Write a grammar that you want to dictate with a public statement and define the rules that are referenced in the public statement as shown below. To learn JSGF grammar see https://www.w3.org/TR/jsgf/.

image106.png
  1. Or we can simplify the above grammar by defining medications in a data set as shown below.

image107.png
  1. To execute this command you must dictate insert tylenol or insert aspirin or insert lipitor. Output: Dictate insert aspirin

From Text: The patient should take aspirin every 3 hours From Script: The patient should take aspirin every 3 hours

  1. If an alternative value needs to be displayed then use $value in the grammar.

E.g. Displaying NDC code for a medication. When insert lipitor is dictated <medications> takes value 54569.

image109.jpeg
  1. To define alternate values in data sets separate them with semicolons (e.g. tylenol;50580 as dataset value) and the grammar would still be

image110.png
  1. To add a large list of values to a data set create a csv file. One master csv file should be maintained and updated for a data set. To update an existing data set, delete the existing data set and then re-import the csv file.

    1. Column A will contain the data set name, e.g. medications.

    2. Column B will contain the value.

    3. Optional: Column C will contain the extra data, e.g. RxNorm Code for medication.

image111.jpeg

To import, right click in the data sets window and select the appropriate csv file.