Skip to content

Instantly share code, notes, and snippets.

@sunnyy02
Created March 2, 2022 23:10
Show Gist options
  • Save sunnyy02/b9c4828581b501d2efa27e4904ed5eb3 to your computer and use it in GitHub Desktop.
Save sunnyy02/b9c4828581b501d2efa27e4904ed5eb3 to your computer and use it in GitHub Desktop.
using System.Linq;
namespace AppointmentBot.CognitiveModels
{
// Extends the partial DoctorBooking class with methods and properties that simplify accessing entities in the luis results
public partial class DoctorBooking
{
public string Doctor
{
get
{
var doctorChosen = Entities?._instance?.Doctor?.FirstOrDefault()?.Text;
return doctorChosen;
}
}
// This value will be a TIMEX. And we are only interested in a Date so grab the first result and drop the Time part.
// TIMEX is a format that represents DateTime expressions that include some ambiguity. e.g. missing a Year.
public string AppointmentDate
=> Entities.datetime?.FirstOrDefault()?.Expressions.FirstOrDefault()?.Split('T')[0];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment