Beispiel #1
0
        public void Map(AppointmentInput input)
        {
            var date    = DateTime.Parse(input.AppointmentDate);
            var time    = DateTime.Parse(input.AppointmentTime);
            var created = input.CreateDate == "NULL" ? (DateTime?)null : DateTime.Parse(input.CreateDate);
            var dob     = input.DateOfBirth == "NULL" ? (DateTime?)null : DateTime.Parse(input.DateOfBirth);

            Hour                   = time.Hour;
            LeadTime               = !created.HasValue ? 0 : ((float)(date - created.Value).TotalDays);
            DayOfWeek              = (int)date.DayOfWeek;
            Season                 = CalcSeason(date);
            Month                  = date.Month;
            Week                   = ISOWeek.GetWeekOfYear(date);
            DayOfYear              = date.DayOfYear;
            Minutes                = input.Minutes;
            Age                    = !dob.HasValue ? 0 : ((float)(date - dob.Value).TotalDays * 365);
            Sex                    = input.Sex;
            OMBWhite               = input.OMBWhite == "1";
            OMBAmericanIndian      = input.OMBAmericanIndian == "1";
            OMBAsian               = input.OMBAsian == "1";
            OMBBlack               = input.OMBBlack == "1";
            OMBHawaiian            = input.OMBHawaiian == "1";
            CDCCode                = input.CDCCode;
            HasEmergencyContact    = input.HasEmergencyContact == "1";
            LastAppointmentNoShow  = input.LastAppointmentShowNoShow != "1";
            PreviousNoShows        = input.PreviousNoShows;
            TotalScheduled         = input.TotalScheduled;
            IsFirstAppt            = input.TotalScheduled == 0;
            NoShowRatio            = input.PreviousNoShows / input.TotalScheduled;
            LastAppointmentScripts = input.LastAppointmentScripts;
            IsRecurring            = input.IsRecurring == "1";
            IsFirstInRecurrence    = input.IsFirstInRecurrence == "1";
            Cancelled              = input.ShowNoShow == 3 ? 1 : 0;
            NoShow                 = input.ShowNoShow == 2;
        }
Beispiel #2
0
        private void Predict(PredictionEngine <AppointmentInput, NoShowPrediction> predictionEngine, string description, AppointmentInput sample)
        {
            var prediction = predictionEngine.Predict(sample);

            Console.WriteLine($"Sample: {description,-20} Predicted: {prediction.NoShow,-5} Actual: {sample.ShowNoShow == 2,-5} Probability: {prediction.Probability,-10:P2}");
        }