Custom Commands with Grammar and Data Sets
Using a command grammar we can either perform different actions or have different spoken forms.
Create a command and save it. Grammar variables can be used to insert content via the text step or handled via a Script step.
To use variables in a text step, enclose the variable in angular brackets <variableName>.
To read a variable in JavaScript use
var variableVal = fd.Result.GetParameter(“variableName”);
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.
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/.
Or we can simplify the above grammar by defining medications in a data set as shown below.
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
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.
To define alternate values in data sets separate them with semicolons (e.g. tylenol;50580 as dataset value) and the grammar would still be
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.
Column A will contain the data set name, e.g. medications.
Column B will contain the value.
Optional: Column C will contain the extra data, e.g. RxNorm Code for medication.
To import, right click in the data sets window and select the appropriate csv file.