39
loading...
This website collects cookies to deliver better user experience
Originally posted on dasha.ai/en-us/blog/ai-covid-symptom-checker
import "commonReactions/all.dsl";
context
{
input phone: string;
}
start node root
{
do
{
#connectSafe($phone);
#waitForSpeech(1000);
#sayText("Hi, this is Dasha calling to complete your daily health checkup. Is it a good time to talk?");
wait *;
}
transitions
{
will_call_back: goto will_call_back on #messageHasIntent("no");
symptoms: goto symptoms on #messageHasIntent("yes");
}
}
"no": {
{
"version": "v2",
"intents":
{
"includes": [
"no",
"definitely not",
"none of such",
"none of the kind",
"nothing like that",
"nothing of the sort",
"none of that",
"wrong",
"incorrect",
"I do not",
"I don't",
"I would not",
"I wouldn't",
"nope",
"nah",
"incorrect",
"wrong",
"I'm okay",
"that's not right",
"that's wrong",
"I don't think so",
"I doubt that",
"no contact",
"I didn't have any contact",
"had zero contact",
"zero contact",
"haven't been in contact",
"no plans",
"no plan",
"not planning",
"not"
]
},
node will_call_back
{
do
{
#sayText("No worries. Please make sure to call back before your shift. Looking forward to speaking to you soon! Bye!");
#disconnect();
exit;
}
}
node symptoms
{
do
{
#sayText("Perfect. Now, do you have any covid-like symptoms such as fever, sore throat, loss of smell or taste, et cetera?");
wait *;
}
transitions
{
stay_home: goto stay_home on #messageHasIntent("yes") or #messageHasData("symptoms");
vaccinated: goto vaccinated on #messageHasIntent("no");
}
}
exit;
part means that the app will end the call.node symptoms
, we ask whether the shift employee experiences any Covid-like symptoms. We then suggest they stay home if any symptoms are present or continue with the health screening by asking whether they’ve got vaccinated.node stay_home
. Here we need to tell the shift worker to stay at home since it’s possible they are sick and we don’t want the virus spreading at the workplace. Once we’re done with that, we can ask if they have any questions. For instance, they might be worried that they won’t be paid, so we need to program the app to respond to that. They might ask what the stay-home corporate policy entails or how long they have to stay at home (we’ll answer both of those questions with one node - node stay_home_policy
). In case the shift employee has no questions, we transition to the node bye
:node stay_home
{
do
{
#sayText("The corporate policy states that employees who present any symptoms should stay home, so I suggest you do just that. I'll call you tomorrow to check how you feel. Do you have any questions?");
wait *;
}
transitions
{``
stay_home_policy: goto stay_home_policy on #messageHasIntent("yes") or #messageHasIntent("stay_home_policy");
paid: goto paid on #messageHasIntent("payment");
bye: goto bye on #messageHasIntent("no");
}
}
digression stay_home_policy
{
conditions {on #messageHasIntent("stay_home_policy");}
do
{
#sayText("Employees who have any covid-like symptoms should stay at home for 24 hours after the symptoms go away completely.");
#repeat(); // let the app know to repeat the phrase in the node from which the digression was called, when go back to the node
return;
}
}
node stay_home_policy
{
do
{
#sayText("Employees who have any covid-like symptoms should stay at home for 24 hours after the symptoms go away completely. May I help with anything else?");
wait *;
}
transitions
{
paid: goto paid on #messageHasIntent("payment");
bye: goto bye on #messageHasIntent("no");
}
}
digression paid
{
conditions {on #messageHasIntent("payment");}
do
{
#sayText("Yes, absolutely. Your leave will be paid for.");
#repeat(); // let the app know to repeat the phrase in the node from which the digression was called, when go back to the node
return; // go back to the node from which we got distracted into the digression
}
}
node paid
{
do
{
#sayText("Yes, absolutely. Your leave will be paid for. Do you have any other questions?");
wait *;
}
transitions
{
question: goto question on #messageHasIntent("yes") or #messageHasIntent("question");
bye: goto bye on #messageHasIntent("no");
}
}
#repeat(); return;
.node paid
, we write a question
transition. For the purpose of this demo, I haven’t gone as far as writing all the possible questions out. I direct the shift employee to HR with any additional questions they might have. However, you might need to properly think of all the possible questions your shift employees might ask.node question
{
do
{
#sayText("I'm sorry but I'm not quite sure I can answer that. I suggest you contact HR about that. Is that okay?");
wait *;
}
transitions
{
bye: goto bye on #messageHasIntent("yes");
can_help_then_: goto bye on #messageHasIntent("no");
}
}
node bye
. It’s very simple:node bye
{
do
{
#sayText("Great! Thank you for taking time to reply to the questions, we're looking forward to seeing you at work in a bit. Talk to you tomorrow! Bye!");
#disconnect();
exit;
}
}
node symptoms
and see how to program the conversation to be in case the employee is healthy:node vaccinated
{
do
{
#sayText("That's good news! Did you get your vaccine?");
wait *;
}
transitions
{
yes_vac: goto yes_vac on #messageHasData("yes_vac") or #messageHasIntent("yes") or #messageHasIntent("vac_one");
yes_two_vac: goto yes_two_vac on #messageHasIntent("yes_two_vac");
no_vac: goto no_vac on #messageHasIntent("no_vac") or #messageHasIntent("no");
}
}
node yes_vac
{
do
{
#sayText("Got that. Have you received both doses of the vaccine?");
wait *;
}
transitions
{
yes_two_vac: goto yes_two_vac on #messageHasIntent("yes") or #messageHasIntent("yes_two_vac");
vac_one: goto bye on #messageHasIntent("no") or #messageHasIntent("vac_one");
}
}
node vac_one
{
do
{
#sayText("Mgm, got that. Have you possibly been in contact with someone who experiences any covid symptoms in the past 2 weeks?");
wait *;
}
transitions
{
yes_two_vac: goto yes_two_vac on #messageHasIntent("no");
watch_for_symptoms: goto bye on #messageHasIntent("maybe") or #messageHasIntent("yes");
}
}
node watch_for_symptoms
{
do
{
#sayText("At this point you should look out for any symptoms that might appear. In case you notice any, please stay at home. Do you have any questions?");
wait *;
}
transitions
{
paid: goto paid on #messageHasIntent("yes") or #messageHasIntent("payment");
stay_home_policy: goto stay_home_policy on #messageHasIntent("stay_home_policy");
bye: goto bye on #messageHasIntent("no");
}
}
node yes_two_vac
{
do
{
#sayText("Awesome! We're looking forward to seeing you at work in a bit. Talk to you tomorrow! Bye!");
#disconnect();
exit;
}
}
node no_vac
{
do
{
#sayText("Mhm, got that. Are you planning on getting vaccinated?");
wait *;
}
transitions
{
will_vaccinate: goto will_vaccinate on #messageHasIntent("yes") or #messageHasIntent("will_vaccinate");
wont_vaccinate: goto wont_vaccinate on #messageHasIntent("wont_vaccinate");
bye: goto bye on #messageHasIntent("no");
}
}
node will_vaccinate
{
do
{
#sayText("Perfect, I'm glad to hear that! Please make sure to let the HR know once you get vaccinated. Thank you for taking time to reply to the questions, we'll see you at work in a bit. Bye!");
exit;
}
}
node wont_vaccinate
{
do
{
#sayText("It's recommended you get vaccinated if you don't have any medical limitations. In the meantime, please exercise social distancing and wear your PPE.");
}
transitions
{
bye: goto bye;
}
}