count the number of days between the appointments taken by the same patient.

#1

I am trying to count the number of days between the appointments taken by the same patient. However, when I execute the code I get the difference for few values in a negative scale even if I am sorting the dates. Can you let me know where I can make changes to get the right answer?

Here is the reprex link:
file:///C:/Users/MeghanaTunga/AppData/Local/Temp/Rtmpyio76l/reprex10e87c164ae1/reprex_reprex.html

0 Likes

#2

The link you posted is for a file on your device, and obviously we can't access it. Please provide a reprex as suggested here.

1 Like

#4
library(lubridate)
#> 
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:base':
#> 
#>     date
library(tidyverse)
pat_id <- c(001,001,001, 002, 002, 002, 002,
            003,003,003,003, 004,004,004,004,004)
visit_date <- mdy(c('1/3/2019','1/28/2019','3/7/2019',
                '1/4/2019','1/19/2019', '1/31/2019', '3/7/2019',
                '1/2/2019','4/17/2019', '5/31/2019', '7/18/2019',
                '1/4/2019','6/2/2019', '8/12/2019', '10/31/2019',
                '12/11/2019'))
visits <- data.frame(pat_id, visit_date)


visits %>% 
  group_by(pat_id) %>% 
  mutate(days_btwn_visits = visit_date - lag(visit_date))
#> # A tibble: 16 x 3
#> # Groups:   pat_id [4]
#>    pat_id visit_date days_btwn_visits
#>     <dbl> <date>     <time>          
#>  1      1 2019-01-03  NA days        
#>  2      1 2019-01-28  25 days        
#>  3      1 2019-03-07  38 days        
#>  4      2 2019-01-04  NA days        
#>  5      2 2019-01-19  15 days        
#>  6      2 2019-01-31  12 days        
#>  7      2 2019-03-07  35 days        
#>  8      3 2019-01-02  NA days        
#>  9      3 2019-04-17 105 days        
#> 10      3 2019-05-31  44 days        
#> 11      3 2019-07-18  48 days        
#> 12      4 2019-01-04  NA days        
#> 13      4 2019-06-02 149 days        
#> 14      4 2019-08-12  71 days        
#> 15      4 2019-10-31  80 days        
#> 16      4 2019-12-11  41 days

Created on 2019-02-23 by the reprex package (v0.2.1)

0 Likes

#5
install.packages("datapasta")
#> Installing package into 'C:/Users/MeghanaTunga/Documents/R/win-library/3.4'
#> (as 'lib' is unspecified)
#> package 'datapasta' successfully unpacked and MD5 sums checked
#> 
#> The downloaded binary packages are in
#>  C:\Users\MeghanaTunga\AppData\Local\Temp\Rtmp4gOmpW\downloaded_packages
library("rstudioapi")
library(chron)
library(lubridate)
#> 
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:chron':
#> 
#>     days, hours, minutes, seconds, years
#> The following object is masked from 'package:base':
#> 
#>     date
rdata <- read.csv("C:\\Users\\MeghanaTunga\\Desktop\\meg\\rdata3.csv",header=T, na.strings=c("","NA"))
head(rdata)
#>   FACILITY DEPARTMENT PROVIDER_ID APPOINTMENT_DATE APPOINTMENT_TIME
#> 1      SCH        MED    67350046       04-12-2009         17:30:00
#> 2      SCH        MED    67350046       04-12-2009         17:40:00
#> 3      SCH        MED    67350046       04-12-2009         17:50:00
#> 4      SCH        MED    67350046       04-12-2009         18:00:00
#> 5      SCH        MED    67350046       04-12-2009         18:10:00
#> 6      SCH        MED    67350046       04-12-2009         18:20:00
#>   PATIENT_ID APPOINTMENT_TYPE BOOKING_DATE BOOKING_TIME SHOW_CODE
#> 1   12210741  Telephone Visit   04-12-2009     15:05:00         Y
#> 2    5491175  Telephone Visit   04-12-2009     16:15:00         Y
#> 3   15740599  Telephone Visit   04-12-2009     16:43:00         Y
#> 4   80420422  Telephone Visit   04-12-2009     16:53:00         Y
#> 5   86030202  Telephone Visit   04-12-2009     16:57:00         Y
#> 6   68651098  Telephone Visit   04-12-2009     17:14:00         Y
#>   CHECKIN_DATE CHECKIN_TIME
#> 1   04-12-2009     17:30:00
#> 2   04-12-2009     17:40:00
#> 3   04-12-2009     17:50:00
#> 4   04-12-2009     18:00:00
#> 5   04-12-2009     18:10:00
#> 6   04-12-2009     18:20:00

View(rdata)
unique(rdata$PROVIDER_ID)
#>   [1] 67350046 23750102 49840144 64873696  5783730 21115592 99420159
#>   [8] 12830191 78380377 19290411 63190596 33280633 47080744 47510814
#>  [15] 27330822 39850863 39560883 92430939 18961081 38351123  1571160
#>  [22] 12801161 68591176 98601179  4621300 46301464 32171733 69941846
#>  [29] 38782013 86852028 22292052 30782063 24402122 57772125 78842167
#>  [36] 94752289 31082303 75512367 99042389 27602442 80252478 18582611
#>  [43] 80942738 88862818 75892827 15412841 20102932 85442948 68773016
#>  [50] 32813143 48993364 64973386 37153613 53083615 81053858 75913877
#>  [57] 69373906 42133974 66104036 26364062 22764222 33044243 68144266
#>  [64] 72424397 29374502 91634529 89114618 11574621 79864737 97854849
#>  [71] 59874975  5094990 97365139 61065326 28685352 86875358  7955370
#>  [78] 69815466  4915490 86285608 39655693 44225744 29085752 57025795
#>  [85] 68805846 76955917 26765922 53925925 16236031 63736116 92736209
#>  [92] 68196216 37886323 23066332  6746370 64766376 64646396 32396433
#>  [99] 42286434 85486448 42386474 91686479 29916512 99106589 41296694
#> [106] 80416718 45096734 63696826 25326992 78357077 58957125 50227155
#> [113] 52147405 14527411 54427475 88807508 16017531 52517545   927560
#> [120] 49027714 80207838 18298011 42448044 71888117 83538338 26578382
#> [127] 68158386 26568412 63598656 56988725 92638799 33658903 91668939
#> [134] 12638941 74778987 91929069   729290 65279356 96079429 65439446
#> [141] 94759599  4149630 33499633 77649687 48859704  7709710 18619711
#> [148] 15569861  5729880 80069968


#removing entries where checkin time has not been noted
#rdata$CHECKIN_TIME <- as.character(rdata$CHECKIN_TIME)
#rdata$CHECKIN_TIME[rdata$CHECKIN_TIME==""] <- "NA"
#rdata$CHECKIN_TIME <- as.factor(rdata$CHECKIN_TIME)
rdata2 <- na.omit(rdata)

rdata2$APPOINTMENT_TIME = gsub('^.* ','',rdata2$APPOINTMENT_TIME)
rdata2$APPOINTMENT_TIME = chron(times=rdata2$APPOINTMENT_TIME)


#to check if apppointment_time is greater or less than 5.30pm
str(rdata2)
#> 'data.frame':    111768 obs. of  12 variables:
#>  $ FACILITY        : Factor w/ 1 level "SCH": 1 1 1 1 1 1 1 1 1 1 ...
#>  $ DEPARTMENT      : Factor w/ 1 level "MED": 1 1 1 1 1 1 1 1 1 1 ...
#>  $ PROVIDER_ID     : int  67350046 67350046 67350046 67350046 67350046 67350046 67350046 67350046 67350046 67350046 ...
#>  $ APPOINTMENT_DATE: Factor w/ 193 levels "01-01-2010","01-02-2010",..: 28 28 28 28 28 28 28 28 28 28 ...
#>  $ APPOINTMENT_TIME:Class 'times'  atomic [1:111768] 0.729 0.736 0.743 0.75 0.757 ...
#>   .. ..- attr(*, "format")= chr "h:m:s"
#>  $ PATIENT_ID      : int  12210741 5491175 15740599 80420422 86030202 68651098 91221095 45771319 63531063 96011310 ...
#>  $ APPOINTMENT_TYPE: Factor w/ 2 levels "In-Person Visit",..: 2 2 2 2 2 2 2 2 2 2 ...
#>  $ BOOKING_DATE    : Factor w/ 266 levels "01-01-2010","01-02-2010",..: 35 35 35 35 35 35 35 35 35 35 ...
#>  $ BOOKING_TIME    : Factor w/ 1272 levels "00:00:00","00:01:00",..: 738 808 836 846 850 867 854 869 878 900 ...
#>  $ SHOW_CODE       : Factor w/ 3 levels "N","P","Y": 3 3 3 3 3 3 3 3 3 3 ...
#>  $ CHECKIN_DATE    : Factor w/ 193 levels "01-01-2010","01-02-2010",..: 28 28 28 28 28 28 28 28 28 28 ...
#>  $ CHECKIN_TIME    : Factor w/ 790 levels "07:00:00","07:42:00",..: 590 600 610 620 630 640 650 670 680 690 ...
#>  - attr(*, "na.action")=Class 'omit'  Named int [1:13285] 33 34 35 36 37 38 39 40 41 42 ...
#>   .. ..- attr(*, "names")= chr [1:13285] "33" "34" "35" "36" ...
five_thirty = chron(times='17:30:00')
class(five_thirty)
#> [1] "times"
rdata2$cc<- (ifelse((rdata2$APPOINTMENT_TIME) >= five_thirty,1,0))

#checkin time greater than 5.30 and appointment_type is telephone visit
rdata2$ccc <-(ifelse(rdata2$cc ==1 & rdata2$APPOINTMENT_TYPE == "Telephone Visit",1,0))

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:lubridate':
#> 
#>     intersect, setdiff, union
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(plyr)
#> -------------------------------------------------------------------------
#> You have loaded plyr after dplyr - this is likely to cause problems.
#> If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
#> library(plyr); library(dplyr)
#> -------------------------------------------------------------------------
#> 
#> Attaching package: 'plyr'
#> The following objects are masked from 'package:dplyr':
#> 
#>     arrange, count, desc, failwith, id, mutate, rename, summarise,
#>     summarize
#> The following object is masked from 'package:lubridate':
#> 
#>     here

#total number of patients afterhours
rd <-rdata2 %>% 
  mutate(APPOINTMENT_DATE = dmy(APPOINTMENT_DATE)) %>% arrange(PATIENT_ID, desc(APPOINTMENT_DATE)) %>%
  group_by(PATIENT_ID) %>% filter(cc == 1) %>% filter(APPOINTMENT_TYPE == "Telephone Visit") %>%
  mutate(previous_date = lag(APPOINTMENT_DATE), days_count = APPOINTMENT_DATE - previous_date) %>% 
  filter(SHOW_CODE == "Y") 
head(rd)
#> # A tibble: 6 x 16
#> # Groups:   PATIENT_ID [5]
#>   FACILITY DEPARTMENT PROVIDER_ID APPOINTMENT_DATE APPOINTMENT_TIME
#>   <fct>    <fct>            <int> <date>           <S3: times>     
#> 1 SCH      MED           92430939 2010-05-06       18:50:00        
#> 2 SCH      MED           39655693 2010-05-24       17:50:00        
#> 3 SCH      MED           57772125 2010-05-06       19:00:00        
#> 4 SCH      MED           38782013 2010-03-18       17:50:00        
#> 5 SCH      MED           80416718 2010-01-18       17:50:00        
#> 6 SCH      MED           53083615 2010-01-07       19:30:00        
#> # ... with 11 more variables: PATIENT_ID <int>, APPOINTMENT_TYPE <fct>,
#> #   BOOKING_DATE <fct>, BOOKING_TIME <fct>, SHOW_CODE <fct>,
#> #   CHECKIN_DATE <fct>, CHECKIN_TIME <fct>, cc <dbl>, ccc <dbl>,
#> #   previous_date <date>, days_count <time>

Created on 2019-02-24 by the reprex package (v0.2.1)

I am getting negative values in days count when I use this code. I arranged the dates in descending order but still getting the same error.

0 Likes

#6

Is there a way you could share a subset of your data, i.e. with datapasta?) or by posting data and code on GitHub or a box link?

0 Likes

#7

anonymized data

s<-tibble::tribble(
~FACILITY, ~DEPARTMENT, ~PROVIDER_ID, ~APPOINTMENT_DATE, ~APPOINTMENT_TIME, ~PATIENT_ID, ~APPOINTMENT_TYPE, ~BOOKING_DATE, ~BOOKING_TIME, ~SHOW_CODE, ~CHECKIN_DATE, ~CHECKIN_TIME,
    "SCH",       "MED",     67350046,       "4/12/2009",        "17:30:00",    12210741, "Telephone Visit",   "4/12/2009",    "15:05:00",        "Y",   "4/12/2009",    "17:30:00",
    "SCH",       "MED",     67350046,       "4/12/2009",        "17:40:00",     5491175, "Telephone Visit",   "4/12/2009",    "16:15:00",        "Y",   "4/12/2009",    "17:40:00",
    "SCH",       "MED",     67350046,       "4/12/2009",        "17:50:00",    15740599, "Telephone Visit",   "4/12/2009",    "16:43:00",        "Y",   "4/12/2009",    "17:50:00",
    "SCH",       "MED",     67350046,       "4/12/2009",        "18:00:00",    80420422, "Telephone Visit",   "4/12/2009",    "16:53:00",        "Y",   "4/12/2009",    "18:00:00",
    "SCH",       "MED",     67350046,       "4/12/2009",        "18:10:00",    86030202, "Telephone Visit",   "4/12/2009",    "16:57:00",        "Y",   "4/12/2009",    "18:10:00",
    "SCH",       "MED",     67350046,       "4/12/2009",        "18:20:00",    68651098, "Telephone Visit",   "4/12/2009",    "17:14:00",        "Y",   "4/12/2009",    "18:20:00",
    "SCH",       "MED",     67350046,       "4/12/2009",        "18:30:00",    91221095, "Telephone Visit",   "4/12/2009",    "17:01:00",        "Y",   "4/12/2009",    "18:30:00",
    "SCH",       "MED",     67350046,       "4/12/2009",        "18:50:00",    45771319, "Telephone Visit",   "4/12/2009",    "17:16:00",        "Y",   "4/12/2009",    "18:50:00",
    "SCH",       "MED",     67350046,       "4/12/2009",        "19:00:00",    63531063, "Telephone Visit",   "4/12/2009",    "17:25:00",        "Y",   "4/12/2009",    "19:00:00",
    "SCH",       "MED",     67350046,       "4/12/2009",        "19:10:00",    96011310, "Telephone Visit",   "4/12/2009",    "17:47:00",        "Y",   "4/12/2009",    "19:10:00",
    "SCH",       "MED",     67350046,       "4/12/2009",        "19:20:00",     1071301, "Telephone Visit",   "4/12/2009",    "17:54:00",        "Y",   "4/12/2009",    "19:20:00",
    "SCH",       "MED",     67350046,       "4/12/2009",        "19:30:00",    28841329, "Telephone Visit",   "4/12/2009",    "18:21:00",        "Y",   "4/12/2009",    "19:30:00",
    "SCH",       "MED",     67350046,       "4/12/2009",        "19:40:00",    95001285, "Telephone Visit",   "4/12/2009",    "18:40:00",        "Y",   "4/12/2009",    "19:40:00",
    "SCH",       "MED",     67350046,       "8/12/2009",        "17:30:00",    43170522, "Telephone Visit",   "8/12/2009",    "15:12:00",        "Y",   "8/12/2009",    "17:30:00",
    "SCH",       "MED",     67350046,       "8/12/2009",        "17:40:00",    85241162, "Telephone Visit",   "8/12/2009",    "17:38:00",        "Y",   "8/12/2009",    "17:47:00",
    "SCH",       "MED",     67350046,       "8/12/2009",        "18:00:00",     3340506, "Telephone Visit",   "8/12/2009",    "17:58:00",        "Y",   "8/12/2009",    "18:00:00",
    "SCH",       "MED",     67350046,       "8/12/2009",        "18:20:00",    76670349, "Telephone Visit",   "8/12/2009",    "17:49:00",        "Y",   "8/12/2009",    "18:20:00",
    "SCH",       "MED",     67350046,       "8/12/2009",        "18:30:00",    62731301, "Telephone Visit",   "8/12/2009",    "17:56:00",        "Y",   "8/12/2009",    "18:30:00",
    "SCH",       "MED",     67350046,       "8/12/2009",        "19:00:00",     3731365, "Telephone Visit",   "8/12/2009",    "18:07:00",        "Y",   "8/12/2009",    "19:00:00",
    "SCH",       "MED",     67350046,       "8/12/2009",        "19:10:00",    97390513, "Telephone Visit",   "8/12/2009",    "18:56:00",        "Y",   "8/12/2009",    "19:10:00",
    "SCH",       "MED",     67350046,      "31-12-2009",        "17:30:00",    63181235, "Telephone Visit",  "31-12-2009",    "15:19:00",        "Y",  "31-12-2009",    "17:30:00",
    "SCH",       "MED",     67350046,      "31-12-2009",        "17:40:00",    69411106, "Telephone Visit",  "31-12-2009",    "16:38:00",        "Y",  "31-12-2009",    "17:40:00",
    "SCH",       "MED",     67350046,      "31-12-2009",        "17:50:00",    45160188, "Telephone Visit",  "31-12-2009",    "16:54:00",        "Y",  "31-12-2009",    "17:50:00",
    "SCH",       "MED",     67350046,      "31-12-2009",        "18:00:00",    91450306, "Telephone Visit",  "31-12-2009",    "16:53:00",        "Y",  "31-12-2009",    "18:00:00",
    "SCH",       "MED",     67350046,      "31-12-2009",        "18:10:00",     5050502, "Telephone Visit",  "31-12-2009",    "17:09:00",        "Y",  "31-12-2009",    "18:10:00",
    "SCH",       "MED",     67350046,      "31-12-2009",        "18:20:00",    75900475, "Telephone Visit",  "31-12-2009",    "17:19:00",        "Y",  "31-12-2009",    "18:20:00",
    "SCH",       "MED",     67350046,      "31-12-2009",        "18:30:00",    20340517, "Telephone Visit",  "31-12-2009",    "17:32:00",        "Y",  "31-12-2009",    "18:30:00",
    "SCH",       "MED",     67350046,      "31-12-2009",        "18:50:00",     9370441, "Telephone Visit",  "31-12-2009",    "17:57:00",        "Y",  "31-12-2009",    "18:50:00",
    "SCH",       "MED",     67350046,      "31-12-2009",        "19:00:00",    91431322, "Telephone Visit",  "31-12-2009",    "17:58:00",        "Y",  "31-12-2009",    "19:00:00",
    "SCH",       "MED",     67350046,      "31-12-2009",        "19:10:00",    83251369, "Telephone Visit",  "31-12-2009",    "18:42:00",        "Y",  "31-12-2009",    "19:10:00",
    "SCH",       "MED",     67350046,      "31-12-2009",        "19:30:00",    82490338, "Telephone Visit",  "31-12-2009",    "16:12:00",        "Y",  "31-12-2009",    "19:30:00",
    "SCH",       "MED",     67350046,      "31-12-2009",        "19:40:00",    90960652, "Telephone Visit",  "31-12-2009",    "19:00:00",        "Y",  "31-12-2009",    "19:40:00",
    "SCH",       "MED",     67350046,        "8/1/2010",        "17:30:00",    54330589, "Telephone Visit",    "8/1/2010",    "16:41:00",        "P",            NA,            NA,
    "SCH",       "MED",     67350046,        "8/1/2010",        "17:40:00",    65701082, "Telephone Visit",    "8/1/2010",    "16:37:00",        "P",            NA,            NA,
    "SCH",       "MED",     67350046,        "8/1/2010",        "17:50:00",    97241181, "Telephone Visit",    "8/1/2010",    "16:49:00",        "P",            NA,            NA,
    "SCH",       "MED",     67350046,        "8/1/2010",        "18:00:00",    51920445, "Telephone Visit",    "8/1/2010",    "16:46:00",        "P",            NA,            NA,
    "SCH",       "MED",     67350046,        "8/1/2010",        "18:10:00",    91940202, "Telephone Visit",    "8/1/2010",    "17:00:00",        "P",            NA,            NA,
    "SCH",       "MED",     67350046,        "8/1/2010",        "18:20:00",    54330589, "Telephone Visit",    "8/1/2010",    "17:07:00",        "P",            NA,            NA,
    "SCH",       "MED",     67350046,        "8/1/2010",        "18:30:00",    60380961, "Telephone Visit",    "8/1/2010",    "17:07:00",        "P",            NA,            NA,
    "SCH",       "MED",     67350046,        "8/1/2010",        "18:50:00",     7230637, "Telephone Visit",    "8/1/2010",    "17:16:00",        "P",            NA,            NA,
    "SCH",       "MED",     67350046,        "8/1/2010",        "19:00:00",      370185, "Telephone Visit",    "8/1/2010",    "17:39:00",        "P",            NA,            NA,
    "SCH",       "MED",     67350046,        "8/1/2010",        "19:10:00",    91401298, "Telephone Visit",    "8/1/2010",    "17:45:00",        "P",            NA,            NA,
    "SCH",       "MED",     67350046,        "8/1/2010",        "19:20:00",    98480513, "Telephone Visit",    "8/1/2010",    "18:02:00",        "P",            NA,            NA,
    "SCH",       "MED",     67350046,        "8/1/2010",        "19:30:00",    39531029, "Telephone Visit",    "8/1/2010",    "18:05:00",        "P",            NA,            NA,
    "SCH",       "MED",     67350046,        "8/1/2010",        "19:40:00",    20691046, "Telephone Visit",    "8/1/2010",    "18:12:00",        "P",            NA,            NA,
    "SCH",       "MED",     67350046,       "10/1/2010",        "19:00:00",    39280227, "Telephone Visit",   "10/1/2010",    "16:20:00",        "N",            NA,            NA,
    "SCH",       "MED",     67350046,       "10/1/2010",        "19:10:00",    32030482, "Telephone Visit",   "10/1/2010",    "16:38:00",        "N",            NA,            NA,
    "SCH",       "MED",     67350046,       "10/1/2010",        "19:20:00",    37071301, "Telephone Visit",   "10/1/2010",    "18:17:00",        "N",            NA,            NA,
    "SCH",       "MED",     67350046,       "10/1/2010",        "19:45:00",    87420744, "In-Person Visit",   "10/1/2010",    "19:11:00",        "Y",   "10/1/2010",    "19:35:00",
    "SCH",       "MED",     67350046,      "14-01-2010",        "17:30:00",    71870098, "Telephone Visit",  "14-01-2010",    "16:23:00",        "Y",  "14-01-2010",    "17:30:00",
    "SCH",       "MED",     67350046,      "14-01-2010",        "17:40:00",    82130578, "Telephone Visit",  "14-01-2010",    "17:07:00",        "Y",  "14-01-2010",    "17:40:00",
    "SCH",       "MED",     67350046,      "14-01-2010",        "17:50:00",    40570786, "Telephone Visit",  "14-01-2010",    "17:10:00",        "Y",  "14-01-2010",    "17:50:00",
    "SCH",       "MED",     67350046,      "14-01-2010",        "18:00:00",    86170552, "Telephone Visit",  "14-01-2010",    "16:42:00",        "Y",  "14-01-2010",    "18:00:00",
    "SCH",       "MED",     67350046,      "14-01-2010",        "18:10:00",    65150619, "Telephone Visit",  "14-01-2010",    "17:19:00",        "Y",  "14-01-2010",    "18:10:00",
    "SCH",       "MED",     67350046,      "14-01-2010",        "18:20:00",    11851156, "Telephone Visit",  "14-01-2010",    "17:59:00",        "Y",  "14-01-2010",    "18:20:00",
    "SCH",       "MED",     67350046,      "14-01-2010",        "18:30:00",    13911370, "Telephone Visit",  "14-01-2010",    "17:43:00",        "Y",  "14-01-2010",    "18:30:00",
    "SCH",       "MED",     67350046,      "14-01-2010",        "18:50:00",    86680304, "Telephone Visit",  "14-01-2010",    "18:06:00",        "Y",  "14-01-2010",    "18:50:00",
    "SCH",       "MED",     67350046,      "14-01-2010",        "19:00:00",    69110801, "Telephone Visit",  "14-01-2010",    "17:49:00",        "Y",  "14-01-2010",    "19:00:00",
    "SCH",       "MED",     67350046,      "14-01-2010",        "19:10:00",    72930309, "Telephone Visit",  "14-01-2010",    "18:21:00",        "Y",  "14-01-2010",    "19:10:00",
    "SCH",       "MED",     67350046,      "14-01-2010",        "19:20:00",    76391368, "Telephone Visit",  "14-01-2010",    "18:09:00",        "Y",  "14-01-2010",    "19:20:00",
    "SCH",       "MED",     67350046,      "14-01-2010",        "19:30:00",    38580322, "Telephone Visit",  "14-01-2010",    "18:44:00",        "Y",  "14-01-2010",    "19:30:00",
    "SCH",       "MED",     67350046,      "14-01-2010",        "19:40:00",    31730200, "Telephone Visit",  "14-01-2010",    "19:02:00",        "Y",  "14-01-2010",    "19:40:00",
    "SCH",       "MED",     67350046,        "9/2/2010",        "17:30:00",    50050591, "Telephone Visit",    "9/2/2010",    "16:34:00",        "Y",    "9/2/2010",    "17:30:00",
    "SCH",       "MED",     67350046,        "9/2/2010",        "17:40:00",    50150350, "Telephone Visit",    "9/2/2010",    "16:57:00",        "Y",    "9/2/2010",    "17:40:00",
    "SCH",       "MED",     67350046,        "9/2/2010",        "17:50:00",    88160881, "Telephone Visit",    "9/2/2010",    "17:14:00",        "Y",    "9/2/2010",    "17:50:00",
    "SCH",       "MED",     67350046,        "9/2/2010",        "18:00:00",    94240791, "Telephone Visit",    "9/2/2010",    "17:21:00",        "Y",    "9/2/2010",    "18:00:00",
    "SCH",       "MED",     67350046,        "9/2/2010",        "18:20:00",    48631025, "Telephone Visit",    "9/2/2010",    "17:36:00",        "Y",    "9/2/2010",    "18:20:00",
    "SCH",       "MED",     67350046,        "9/2/2010",        "18:30:00",    52131015, "Telephone Visit",    "9/2/2010",    "17:31:00",        "Y",    "9/2/2010",    "18:30:00",
    "SCH",       "MED",     67350046,        "9/2/2010",        "18:40:00",    72090679, "Telephone Visit",    "9/2/2010",    "17:42:00",        "Y",    "9/2/2010",    "18:40:00",
    "SCH",       "MED",     67350046,        "9/2/2010",        "18:50:00",    75271274, "Telephone Visit",    "9/2/2010",    "17:51:00",        "Y",    "9/2/2010",    "18:50:00",
    "SCH",       "MED",     67350046,        "9/2/2010",        "19:00:00",    13020455, "Telephone Visit",    "9/2/2010",    "18:18:00",        "Y",    "9/2/2010",    "19:00:00",
    "SCH",       "MED",     67350046,        "9/2/2010",        "19:10:00",     4520787, "Telephone Visit",    "9/2/2010",    "18:49:00",        "Y",    "9/2/2010",    "19:10:00",
    "SCH",       "MED",     67350046,      "27-02-2010",        "18:15:00",    80620711, "In-Person Visit",  "27-02-2010",    "16:10:00",        "Y",  "27-02-2010",    "18:15:00",
    "SCH",       "MED",     67350046,      "27-02-2010",        "18:40:00",    45981296, "Telephone Visit",  "27-02-2010",    "15:21:00",        "Y",  "27-02-2010",    "18:40:00",
    "SCH",       "MED",     67350046,      "27-02-2010",        "18:50:00",    99371106, "Telephone Visit",  "27-02-2010",    "15:54:00",        "Y",  "27-02-2010",    "18:50:00",
    "SCH",       "MED",     67350046,      "27-02-2010",        "19:15:00",    71101068, "In-Person Visit",  "27-02-2010",    "16:12:00",        "Y",  "27-02-2010",    "19:12:00",
    "SCH",       "MED",     67350046,      "27-02-2010",        "19:30:00",    50611359, "Telephone Visit",  "27-02-2010",    "16:08:00",        "Y",  "27-02-2010",    "19:30:00",
    "SCH",       "MED",     67350046,      "27-02-2010",        "19:40:00",    81150308, "Telephone Visit",  "27-02-2010",    "16:17:00",        "Y",  "27-02-2010",    "19:40:00",
    "SCH",       "MED",     67350046,      "27-02-2010",        "19:50:00",    54571329, "Telephone Visit",  "27-02-2010",    "16:24:00",        "Y",  "27-02-2010",    "19:50:00",
    "SCH",       "MED",     67350046,      "27-02-2010",        "20:15:00",    72661327, "In-Person Visit",  "27-02-2010",    "16:45:00",        "Y",  "27-02-2010",    "20:06:00",
    "SCH",       "MED",     67350046,      "27-02-2010",        "20:30:00",    45610365, "In-Person Visit",  "27-02-2010",    "16:46:00",        "Y",  "27-02-2010",    "20:13:00",
    "SCH",       "MED",     67350046,      "14-03-2010",         "9:00:00",     1581300, "Telephone Visit",  "13-03-2010",    "20:06:00",        "Y",  "14-03-2010",     "9:00:00",
    "SCH",       "MED",     67350046,      "14-03-2010",         "9:10:00",    39561301, "Telephone Visit",  "13-03-2010",    "20:50:00",        "Y",  "14-03-2010",     "9:10:00",
    "SCH",       "MED",     67350046,      "14-03-2010",         "9:20:00",    45681028, "Telephone Visit",  "13-03-2010",    "21:39:00",        "Y",  "14-03-2010",     "9:20:00",
    "SCH",       "MED",     67350046,      "14-03-2010",         "9:30:00",     5770570, "Telephone Visit",  "13-03-2010",    "22:00:00",        "Y",  "14-03-2010",     "9:30:00",
    "SCH",       "MED",     67350046,      "14-03-2010",         "9:40:00",    62970903, "Telephone Visit",  "14-03-2010",     "7:42:00",        "Y",  "14-03-2010",     "9:40:00",
    "SCH",       "MED",     67350046,      "14-03-2010",         "9:50:00",     3110251, "Telephone Visit",  "14-03-2010",     "8:26:00",        "Y",  "14-03-2010",    "10:01:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "10:10:00",    11260298, "Telephone Visit",  "13-03-2010",    "20:39:00",        "Y",  "14-03-2010",    "10:10:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "10:20:00",    39471067, "Telephone Visit",  "14-03-2010",     "8:57:00",        "Y",  "14-03-2010",    "10:20:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "10:30:00",    58660262, "Telephone Visit",  "13-03-2010",    "20:46:00",        "Y",  "14-03-2010",    "10:30:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "10:40:00",    46581239, "Telephone Visit",  "14-03-2010",     "9:41:00",        "Y",  "14-03-2010",    "10:40:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "10:50:00",      400877, "Telephone Visit",  "14-03-2010",     "9:49:00",        "Y",  "14-03-2010",    "10:50:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "11:00:00",    36661178, "Telephone Visit",  "14-03-2010",     "9:59:00",        "Y",  "14-03-2010",    "11:00:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "11:20:00",    60820165, "Telephone Visit",  "14-03-2010",    "10:17:00",        "Y",  "14-03-2010",    "11:25:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "11:30:00",    51011175, "Telephone Visit",  "14-03-2010",    "10:33:00",        "Y",  "14-03-2010",    "11:30:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "11:40:00",    79631370, "Telephone Visit",  "14-03-2010",    "10:39:00",        "Y",  "14-03-2010",    "11:40:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "11:50:00",     6001242, "Telephone Visit",  "14-03-2010",    "10:58:00",        "Y",  "14-03-2010",    "11:50:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "12:00:00",    12970773, "Telephone Visit",  "14-03-2010",    "11:12:00",        "Y",  "14-03-2010",    "12:00:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "12:10:00",    20090865, "Telephone Visit",  "14-03-2010",    "11:13:00",        "Y",  "14-03-2010",    "12:10:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "13:30:00",     4190798, "In-Person Visit",  "14-03-2010",    "10:10:00",        "Y",  "14-03-2010",    "13:23:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "13:45:00",    70420937, "In-Person Visit",  "14-03-2010",    "10:38:00",        "Y",  "14-03-2010",    "13:15:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "14:00:00",    94661283, "In-Person Visit",  "14-03-2010",    "11:00:00",        "Y",  "14-03-2010",    "13:50:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "14:15:00",    91820845, "In-Person Visit",  "14-03-2010",    "11:20:00",        "Y",  "14-03-2010",    "14:22:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "14:45:00",    33640992, "In-Person Visit",  "14-03-2010",    "11:58:00",        "Y",  "14-03-2010",    "14:41:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "15:00:00",    99420809, "In-Person Visit",  "14-03-2010",    "14:05:00",        "Y",  "14-03-2010",    "14:58:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "15:15:00",    76811285, "In-Person Visit",  "14-03-2010",    "13:14:00",        "Y",  "14-03-2010",    "15:12:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "15:30:00",    70620487, "In-Person Visit",  "14-03-2010",    "13:47:00",        "Y",  "14-03-2010",    "15:52:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "16:00:00",    77080452, "In-Person Visit",  "14-03-2010",    "13:25:00",        "Y",  "14-03-2010",    "16:01:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "16:15:00",    59640859, "In-Person Visit",  "14-03-2010",    "15:16:00",        "Y",  "14-03-2010",    "16:13:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "16:30:00",    53681327, "In-Person Visit",  "14-03-2010",    "14:27:00",        "Y",  "14-03-2010",    "16:30:00",
    "SCH",       "MED",     67350046,      "14-03-2010",        "16:45:00",    66020217, "In-Person Visit",  "14-03-2010",    "16:13:00",        "Y",  "14-03-2010",    "16:18:00",
    "SCH",       "MED",     67350046,      "18-04-2010",         "9:00:00",    48950239, "Telephone Visit",  "17-04-2010",    "19:02:00",        "Y",  "18-04-2010",     "9:00:00",
    "SCH",       "MED",     67350046,      "18-04-2010",         "9:10:00",    55720597, "Telephone Visit",  "17-04-2010",    "19:02:00",        "Y",  "18-04-2010",     "9:10:00",
    "SCH",       "MED",     67350046,      "18-04-2010",         "9:20:00",    63270206, "Telephone Visit",  "17-04-2010",    "20:18:00",        "Y",  "18-04-2010",     "9:20:00",
    "SCH",       "MED",     67350046,      "18-04-2010",         "9:30:00",    34350507, "Telephone Visit",  "17-04-2010",    "20:24:00",        "Y",  "18-04-2010",     "9:30:00",
    "SCH",       "MED",     67350046,      "18-04-2010",         "9:40:00",    85410790, "Telephone Visit",  "17-04-2010",    "21:25:00",        "Y",  "18-04-2010",     "9:40:00",
    "SCH",       "MED",     67350046,      "18-04-2010",         "9:50:00",    58760397, "Telephone Visit",  "17-04-2010",    "23:00:00",        "Y",  "18-04-2010",     "9:50:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "10:10:00",    17091324, "Telephone Visit",  "17-04-2010",    "23:55:00",        "Y",  "18-04-2010",    "10:10:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "10:20:00",    27551239, "Telephone Visit",  "18-04-2010",     "7:24:00",        "Y",  "18-04-2010",    "10:20:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "10:30:00",    44910588, "Telephone Visit",  "18-04-2010",     "7:50:00",        "Y",  "18-04-2010",    "10:30:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "10:40:00",    84710811, "Telephone Visit",  "18-04-2010",     "8:21:00",        "Y",  "18-04-2010",    "10:40:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "10:50:00",     2031008, "Telephone Visit",  "18-04-2010",     "8:25:00",        "Y",  "18-04-2010",    "10:50:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "11:00:00",    57051304, "Telephone Visit",  "18-04-2010",     "8:30:00",        "Y",  "18-04-2010",    "11:00:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "11:20:00",    80430721, "Telephone Visit",  "18-04-2010",     "8:52:00",        "Y",  "18-04-2010",    "11:20:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "11:30:00",    35181170, "Telephone Visit",  "18-04-2010",     "9:00:00",        "Y",  "18-04-2010",    "11:30:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "11:40:00",    23941141, "Telephone Visit",  "18-04-2010",     "9:29:00",        "Y",  "18-04-2010",    "11:40:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "11:50:00",    81780581, "Telephone Visit",  "18-04-2010",     "9:35:00",        "Y",  "18-04-2010",    "11:50:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "12:00:00",    84921325, "Telephone Visit",  "18-04-2010",     "9:47:00",        "Y",  "18-04-2010",    "12:00:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "12:10:00",     7840708, "Telephone Visit",  "18-04-2010",    "10:02:00",        "Y",  "18-04-2010",    "12:10:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "13:30:00",    90890843, "Telephone Visit",  "18-04-2010",    "10:03:00",        "Y",  "18-04-2010",    "13:30:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "13:40:00",    65520243, "Telephone Visit",  "18-04-2010",    "10:03:00",        "Y",  "18-04-2010",    "13:40:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "13:50:00",    51631371, "Telephone Visit",  "18-04-2010",    "10:22:00",        "Y",  "18-04-2010",    "13:50:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "14:00:00",    39541320, "Telephone Visit",  "18-04-2010",    "11:16:00",        "Y",  "18-04-2010",    "14:00:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "14:10:00",    78741252, "Telephone Visit",  "18-04-2010",    "11:00:00",        "Y",  "18-04-2010",    "14:10:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "14:20:00",    30201029, "Telephone Visit",  "18-04-2010",    "11:29:00",        "Y",  "18-04-2010",    "14:20:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "14:40:00",    36581376, "Telephone Visit",  "18-04-2010",    "12:01:00",        "Y",  "18-04-2010",    "14:40:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "14:50:00",     5630527, "Telephone Visit",  "18-04-2010",    "12:22:00",        "Y",  "18-04-2010",    "14:50:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "15:00:00",     9030189, "Telephone Visit",  "18-04-2010",    "12:28:00",        "Y",  "18-04-2010",    "15:00:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "15:10:00",    86610579, "Telephone Visit",  "18-04-2010",    "13:49:00",        "Y",  "18-04-2010",    "15:10:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "15:20:00",    88050532, "Telephone Visit",  "18-04-2010",    "14:24:00",        "Y",  "18-04-2010",    "15:20:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "15:30:00",    11900820, "Telephone Visit",  "18-04-2010",    "14:16:00",        "Y",  "18-04-2010",    "15:30:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "16:20:00",    65560364, "Telephone Visit",  "18-04-2010",    "15:46:00",        "Y",  "18-04-2010",    "16:00:00",
    "SCH",       "MED",     67350046,      "18-04-2010",        "17:10:00",    84680527, "Telephone Visit",  "18-04-2010",    "16:38:00",        "Y",  "18-04-2010",    "17:10:00",
    "SCH",       "MED",     67350046,        "7/5/2010",        "17:30:00",    21130631, "Telephone Visit",    "7/5/2010",    "16:38:00",        "Y",    "7/5/2010",    "17:30:00",
    "SCH",       "MED",     67350046,        "7/5/2010",        "17:40:00",    66380930, "Telephone Visit",    "7/5/2010",    "16:49:00",        "Y",    "7/5/2010",    "17:40:00",
    "SCH",       "MED",     67350046,        "7/5/2010",        "17:50:00",    57270715, "Telephone Visit",    "7/5/2010",    "17:08:00",        "Y",    "7/5/2010",    "17:50:00",
    "SCH",       "MED",     67350046,        "7/5/2010",        "18:00:00",    74590916, "Telephone Visit",    "7/5/2010",    "16:42:00",        "Y",    "7/5/2010",    "18:00:00",
    "SCH",       "MED",     67350046,        "7/5/2010",        "18:10:00",    48591358, "Telephone Visit",    "7/5/2010",    "17:36:00",        "Y",    "7/5/2010",    "18:10:00",
    "SCH",       "MED",     67350046,        "7/5/2010",        "18:20:00",    48380640, "Telephone Visit",    "7/5/2010",    "17:27:00",        "Y",    "7/5/2010",    "18:20:00",
    "SCH",       "MED",     67350046,        "7/5/2010",        "18:30:00",    83630529, "Telephone Visit",    "7/5/2010",    "17:39:00",        "Y",    "7/5/2010",    "18:30:00",
    "SCH",       "MED",     67350046,        "7/5/2010",        "18:50:00",    24990769, "Telephone Visit",    "7/5/2010",    "17:43:00",        "N",            NA,            NA,
    "SCH",       "MED",     67350046,        "7/5/2010",        "19:00:00",    93730683, "Telephone Visit",    "7/5/2010",    "17:41:00",        "Y",    "7/5/2010",    "19:00:00",
    "SCH",       "MED",     67350046,        "7/5/2010",        "19:10:00",    90720562, "Telephone Visit",    "7/5/2010",    "17:52:00",        "Y",    "7/5/2010",    "19:10:00",
    "SCH",       "MED",     67350046,        "7/5/2010",        "19:20:00",     9130746, "Telephone Visit",    "7/5/2010",    "18:07:00",        "Y",    "7/5/2010",    "19:20:00",
    "SCH",       "MED",     67350046,        "7/5/2010",        "19:30:00",    41390157, "Telephone Visit",    "7/5/2010",    "18:42:00",        "Y",    "7/5/2010",    "19:30:00",
    "SCH",       "MED",     67350046,        "7/5/2010",        "19:40:00",    30790850, "Telephone Visit",    "7/5/2010",    "19:05:00",        "N",            NA,            NA,
    "SCH",       "MED",     67350046,      "14-05-2010",        "17:30:00",    15100895, "Telephone Visit",  "14-05-2010",    "16:27:00",        "Y",  "14-05-2010",    "17:30:00",
    "SCH",       "MED",     67350046,      "14-05-2010",        "17:40:00",     8820665, "Telephone Visit",  "14-05-2010",    "16:44:00",        "Y",  "14-05-2010",    "17:40:00",
    "SCH",       "MED",     67350046,      "14-05-2010",        "17:50:00",    24480005, "Telephone Visit",  "14-05-2010",    "17:02:00",        "Y",  "14-05-2010",    "17:50:00",
    "SCH",       "MED",     67350046,      "14-05-2010",        "18:00:00",    90990756, "Telephone Visit",  "14-05-2010",    "16:49:00",        "Y",  "14-05-2010",    "18:00:00",
    "SCH",       "MED",     67350046,      "14-05-2010",        "18:10:00",    10490595, "Telephone Visit",  "14-05-2010",    "17:06:00",        "Y",  "14-05-2010",    "18:10:00",
    "SCH",       "MED",     67350046,      "14-05-2010",        "18:20:00",    98521117, "Telephone Visit",  "14-05-2010",    "17:22:00",        "Y",  "14-05-2010",    "18:20:00"
)

Created on 2019-02-24 by the reprex package (v0.2.1)

0 Likes

unlisted #8

Sent DM to OP about potentially PPI or private data here.

0 Likes

#9

One issue is that there are 102 rows that have dates (booking, checkin, and appointment) do not parse with mdy from lubridate - these appear to be in a different format. There are 12 distinct dates for APPOINTMENT_DATE,
and six appear to be in DD-MM-YYYY format, while the other six are in MM/DD/YYYY format. I am guessing that this is a big part of the problem.

0 Likes

#10
s<-tibble::tribble(
  ~FACILITY, ~DEPARTMENT, ~PROVIDER_ID, ~APPOINTMENT_DATE, ~APPOINTMENT_TIME, ~PATIENT_ID, ~APPOINTMENT_TYPE, ~BOOKING_DATE, ~BOOKING_TIME, ~SHOW_CODE, ~CHECKIN_DATE, ~CHECKIN_TIME,
  "SCH",       "MED",     67350046,       "4/12/2009",        "17:30:00",    12210741, "Telephone Visit",   "4/12/2009",    "15:05:00",        "Y",   "4/12/2009",    "17:30:00",
  "SCH",       "MED",     67350046,       "4/12/2009",        "17:40:00",     5491175, "Telephone Visit",   "4/12/2009",    "16:15:00",        "Y",   "4/12/2009",    "17:40:00",
  "SCH",       "MED",     67350046,       "4/12/2009",        "17:50:00",    15740599, "Telephone Visit",   "4/12/2009",    "16:43:00",        "Y",   "4/12/2009",    "17:50:00",
  "SCH",       "MED",     67350046,       "4/12/2009",        "18:00:00",    80420422, "Telephone Visit",   "4/12/2009",    "16:53:00",        "Y",   "4/12/2009",    "18:00:00",
  "SCH",       "MED",     67350046,       "4/12/2009",        "18:10:00",    86030202, "Telephone Visit",   "4/12/2009",    "16:57:00",        "Y",   "4/12/2009",    "18:10:00",
  "SCH",       "MED",     67350046,       "4/12/2009",        "18:20:00",    68651098, "Telephone Visit",   "4/12/2009",    "17:14:00",        "Y",   "4/12/2009",    "18:20:00",
  "SCH",       "MED",     67350046,       "4/12/2009",        "18:30:00",    91221095, "Telephone Visit",   "4/12/2009",    "17:01:00",        "Y",   "4/12/2009",    "18:30:00",
  "SCH",       "MED",     67350046,       "4/12/2009",        "18:50:00",    45771319, "Telephone Visit",   "4/12/2009",    "17:16:00",        "Y",   "4/12/2009",    "18:50:00",
  "SCH",       "MED",     67350046,       "4/12/2009",        "19:00:00",    63531063, "Telephone Visit",   "4/12/2009",    "17:25:00",        "Y",   "4/12/2009",    "19:00:00",
  "SCH",       "MED",     67350046,       "4/12/2009",        "19:10:00",    96011310, "Telephone Visit",   "4/12/2009",    "17:47:00",        "Y",   "4/12/2009",    "19:10:00",
  "SCH",       "MED",     67350046,       "4/12/2009",        "19:20:00",     1071301, "Telephone Visit",   "4/12/2009",    "17:54:00",        "Y",   "4/12/2009",    "19:20:00",
  "SCH",       "MED",     67350046,       "4/12/2009",        "19:30:00",    28841329, "Telephone Visit",   "4/12/2009",    "18:21:00",        "Y",   "4/12/2009",    "19:30:00",
  "SCH",       "MED",     67350046,       "4/12/2009",        "19:40:00",    95001285, "Telephone Visit",   "4/12/2009",    "18:40:00",        "Y",   "4/12/2009",    "19:40:00",
  "SCH",       "MED",     67350046,       "8/12/2009",        "17:30:00",    43170522, "Telephone Visit",   "8/12/2009",    "15:12:00",        "Y",   "8/12/2009",    "17:30:00",
  "SCH",       "MED",     67350046,       "8/12/2009",        "17:40:00",    85241162, "Telephone Visit",   "8/12/2009",    "17:38:00",        "Y",   "8/12/2009",    "17:47:00",
  "SCH",       "MED",     67350046,       "8/12/2009",        "18:00:00",     3340506, "Telephone Visit",   "8/12/2009",    "17:58:00",        "Y",   "8/12/2009",    "18:00:00",
  "SCH",       "MED",     67350046,       "8/12/2009",        "18:20:00",    76670349, "Telephone Visit",   "8/12/2009",    "17:49:00",        "Y",   "8/12/2009",    "18:20:00",
  "SCH",       "MED",     67350046,       "8/12/2009",        "18:30:00",    62731301, "Telephone Visit",   "8/12/2009",    "17:56:00",        "Y",   "8/12/2009",    "18:30:00",
  "SCH",       "MED",     67350046,       "8/12/2009",        "19:00:00",     3731365, "Telephone Visit",   "8/12/2009",    "18:07:00",        "Y",   "8/12/2009",    "19:00:00",
  "SCH",       "MED",     67350046,       "8/12/2009",        "19:10:00",    97390513, "Telephone Visit",   "8/12/2009",    "18:56:00",        "Y",   "8/12/2009",    "19:10:00",
  "SCH",       "MED",     67350046,      "31-12-2009",        "17:30:00",    63181235, "Telephone Visit",  "31-12-2009",    "15:19:00",        "Y",  "31-12-2009",    "17:30:00",
  "SCH",       "MED",     67350046,      "31-12-2009",        "17:40:00",    69411106, "Telephone Visit",  "31-12-2009",    "16:38:00",        "Y",  "31-12-2009",    "17:40:00",
  "SCH",       "MED",     67350046,      "31-12-2009",        "17:50:00",    45160188, "Telephone Visit",  "31-12-2009",    "16:54:00",        "Y",  "31-12-2009",    "17:50:00",
  "SCH",       "MED",     67350046,      "31-12-2009",        "18:00:00",    91450306, "Telephone Visit",  "31-12-2009",    "16:53:00",        "Y",  "31-12-2009",    "18:00:00",
  "SCH",       "MED",     67350046,      "31-12-2009",        "18:10:00",     5050502, "Telephone Visit",  "31-12-2009",    "17:09:00",        "Y",  "31-12-2009",    "18:10:00",
  "SCH",       "MED",     67350046,      "31-12-2009",        "18:20:00",    75900475, "Telephone Visit",  "31-12-2009",    "17:19:00",        "Y",  "31-12-2009",    "18:20:00",
  "SCH",       "MED",     67350046,      "31-12-2009",        "18:30:00",    20340517, "Telephone Visit",  "31-12-2009",    "17:32:00",        "Y",  "31-12-2009",    "18:30:00",
  "SCH",       "MED",     67350046,      "31-12-2009",        "18:50:00",     9370441, "Telephone Visit",  "31-12-2009",    "17:57:00",        "Y",  "31-12-2009",    "18:50:00",
  "SCH",       "MED",     67350046,      "31-12-2009",        "19:00:00",    91431322, "Telephone Visit",  "31-12-2009",    "17:58:00",        "Y",  "31-12-2009",    "19:00:00",
  "SCH",       "MED",     67350046,      "31-12-2009",        "19:10:00",    83251369, "Telephone Visit",  "31-12-2009",    "18:42:00",        "Y",  "31-12-2009",    "19:10:00",
  "SCH",       "MED",     67350046,      "31-12-2009",        "19:30:00",    82490338, "Telephone Visit",  "31-12-2009",    "16:12:00",        "Y",  "31-12-2009",    "19:30:00",
  "SCH",       "MED",     67350046,      "31-12-2009",        "19:40:00",    90960652, "Telephone Visit",  "31-12-2009",    "19:00:00",        "Y",  "31-12-2009",    "19:40:00",
  "SCH",       "MED",     67350046,        "8/1/2010",        "17:30:00",    54330589, "Telephone Visit",    "8/1/2010",    "16:41:00",        "P",            NA,            NA,
  "SCH",       "MED",     67350046,        "8/1/2010",        "17:40:00",    65701082, "Telephone Visit",    "8/1/2010",    "16:37:00",        "P",            NA,            NA,
  "SCH",       "MED",     67350046,        "8/1/2010",        "17:50:00",    97241181, "Telephone Visit",    "8/1/2010",    "16:49:00",        "P",            NA,            NA,
  "SCH",       "MED",     67350046,        "8/1/2010",        "18:00:00",    51920445, "Telephone Visit",    "8/1/2010",    "16:46:00",        "P",            NA,            NA,
  "SCH",       "MED",     67350046,        "8/1/2010",        "18:10:00",    91940202, "Telephone Visit",    "8/1/2010",    "17:00:00",        "P",            NA,            NA,
  "SCH",       "MED",     67350046,        "8/1/2010",        "18:20:00",    54330589, "Telephone Visit",    "8/1/2010",    "17:07:00",        "P",            NA,            NA,
  "SCH",       "MED",     67350046,        "8/1/2010",        "18:30:00",    60380961, "Telephone Visit",    "8/1/2010",    "17:07:00",        "P",            NA,            NA,
  "SCH",       "MED",     67350046,        "8/1/2010",        "18:50:00",     7230637, "Telephone Visit",    "8/1/2010",    "17:16:00",        "P",            NA,            NA,
  "SCH",       "MED",     67350046,        "8/1/2010",        "19:00:00",      370185, "Telephone Visit",    "8/1/2010",    "17:39:00",        "P",            NA,            NA,
  "SCH",       "MED",     67350046,        "8/1/2010",        "19:10:00",    91401298, "Telephone Visit",    "8/1/2010",    "17:45:00",        "P",            NA,            NA,
  "SCH",       "MED",     67350046,        "8/1/2010",        "19:20:00",    98480513, "Telephone Visit",    "8/1/2010",    "18:02:00",        "P",            NA,            NA,
  "SCH",       "MED",     67350046,        "8/1/2010",        "19:30:00",    39531029, "Telephone Visit",    "8/1/2010",    "18:05:00",        "P",            NA,            NA,
  "SCH",       "MED",     67350046,        "8/1/2010",        "19:40:00",    20691046, "Telephone Visit",    "8/1/2010",    "18:12:00",        "P",            NA,            NA,
  "SCH",       "MED",     67350046,       "10/1/2010",        "19:00:00",    39280227, "Telephone Visit",   "10/1/2010",    "16:20:00",        "N",            NA,            NA,
  "SCH",       "MED",     67350046,       "10/1/2010",        "19:10:00",    32030482, "Telephone Visit",   "10/1/2010",    "16:38:00",        "N",            NA,            NA,
  "SCH",       "MED",     67350046,       "10/1/2010",        "19:20:00",    37071301, "Telephone Visit",   "10/1/2010",    "18:17:00",        "N",            NA,            NA,
  "SCH",       "MED",     67350046,       "10/1/2010",        "19:45:00",    87420744, "In-Person Visit",   "10/1/2010",    "19:11:00",        "Y",   "10/1/2010",    "19:35:00",
  "SCH",       "MED",     67350046,      "14-01-2010",        "17:30:00",    71870098, "Telephone Visit",  "14-01-2010",    "16:23:00",        "Y",  "14-01-2010",    "17:30:00",
  "SCH",       "MED",     67350046,      "14-01-2010",        "17:40:00",    82130578, "Telephone Visit",  "14-01-2010",    "17:07:00",        "Y",  "14-01-2010",    "17:40:00",
  "SCH",       "MED",     67350046,      "14-01-2010",        "17:50:00",    40570786, "Telephone Visit",  "14-01-2010",    "17:10:00",        "Y",  "14-01-2010",    "17:50:00",
  "SCH",       "MED",     67350046,      "14-01-2010",        "18:00:00",    86170552, "Telephone Visit",  "14-01-2010",    "16:42:00",        "Y",  "14-01-2010",    "18:00:00",
  "SCH",       "MED",     67350046,      "14-01-2010",        "18:10:00",    65150619, "Telephone Visit",  "14-01-2010",    "17:19:00",        "Y",  "14-01-2010",    "18:10:00",
  "SCH",       "MED",     67350046,      "14-01-2010",        "18:20:00",    11851156, "Telephone Visit",  "14-01-2010",    "17:59:00",        "Y",  "14-01-2010",    "18:20:00",
  "SCH",       "MED",     67350046,      "14-01-2010",        "18:30:00",    13911370, "Telephone Visit",  "14-01-2010",    "17:43:00",        "Y",  "14-01-2010",    "18:30:00",
  "SCH",       "MED",     67350046,      "14-01-2010",        "18:50:00",    86680304, "Telephone Visit",  "14-01-2010",    "18:06:00",        "Y",  "14-01-2010",    "18:50:00",
  "SCH",       "MED",     67350046,      "14-01-2010",        "19:00:00",    69110801, "Telephone Visit",  "14-01-2010",    "17:49:00",        "Y",  "14-01-2010",    "19:00:00",
  "SCH",       "MED",     67350046,      "14-01-2010",        "19:10:00",    72930309, "Telephone Visit",  "14-01-2010",    "18:21:00",        "Y",  "14-01-2010",    "19:10:00",
  "SCH",       "MED",     67350046,      "14-01-2010",        "19:20:00",    76391368, "Telephone Visit",  "14-01-2010",    "18:09:00",        "Y",  "14-01-2010",    "19:20:00",
  "SCH",       "MED",     67350046,      "14-01-2010",        "19:30:00",    38580322, "Telephone Visit",  "14-01-2010",    "18:44:00",        "Y",  "14-01-2010",    "19:30:00",
  "SCH",       "MED",     67350046,      "14-01-2010",        "19:40:00",    31730200, "Telephone Visit",  "14-01-2010",    "19:02:00",        "Y",  "14-01-2010",    "19:40:00",
  "SCH",       "MED",     67350046,        "9/2/2010",        "17:30:00",    50050591, "Telephone Visit",    "9/2/2010",    "16:34:00",        "Y",    "9/2/2010",    "17:30:00",
  "SCH",       "MED",     67350046,        "9/2/2010",        "17:40:00",    50150350, "Telephone Visit",    "9/2/2010",    "16:57:00",        "Y",    "9/2/2010",    "17:40:00",
  "SCH",       "MED",     67350046,        "9/2/2010",        "17:50:00",    88160881, "Telephone Visit",    "9/2/2010",    "17:14:00",        "Y",    "9/2/2010",    "17:50:00",
  "SCH",       "MED",     67350046,        "9/2/2010",        "18:00:00",    94240791, "Telephone Visit",    "9/2/2010",    "17:21:00",        "Y",    "9/2/2010",    "18:00:00",
  "SCH",       "MED",     67350046,        "9/2/2010",        "18:20:00",    48631025, "Telephone Visit",    "9/2/2010",    "17:36:00",        "Y",    "9/2/2010",    "18:20:00",
  "SCH",       "MED",     67350046,        "9/2/2010",        "18:30:00",    52131015, "Telephone Visit",    "9/2/2010",    "17:31:00",        "Y",    "9/2/2010",    "18:30:00",
  "SCH",       "MED",     67350046,        "9/2/2010",        "18:40:00",    72090679, "Telephone Visit",    "9/2/2010",    "17:42:00",        "Y",    "9/2/2010",    "18:40:00",
  "SCH",       "MED",     67350046,        "9/2/2010",        "18:50:00",    75271274, "Telephone Visit",    "9/2/2010",    "17:51:00",        "Y",    "9/2/2010",    "18:50:00",
  "SCH",       "MED",     67350046,        "9/2/2010",        "19:00:00",    13020455, "Telephone Visit",    "9/2/2010",    "18:18:00",        "Y",    "9/2/2010",    "19:00:00",
  "SCH",       "MED",     67350046,        "9/2/2010",        "19:10:00",     4520787, "Telephone Visit",    "9/2/2010",    "18:49:00",        "Y",    "9/2/2010",    "19:10:00",
  "SCH",       "MED",     67350046,      "27-02-2010",        "18:15:00",    80620711, "In-Person Visit",  "27-02-2010",    "16:10:00",        "Y",  "27-02-2010",    "18:15:00",
  "SCH",       "MED",     67350046,      "27-02-2010",        "18:40:00",    45981296, "Telephone Visit",  "27-02-2010",    "15:21:00",        "Y",  "27-02-2010",    "18:40:00",
  "SCH",       "MED",     67350046,      "27-02-2010",        "18:50:00",    99371106, "Telephone Visit",  "27-02-2010",    "15:54:00",        "Y",  "27-02-2010",    "18:50:00",
  "SCH",       "MED",     67350046,      "27-02-2010",        "19:15:00",    71101068, "In-Person Visit",  "27-02-2010",    "16:12:00",        "Y",  "27-02-2010",    "19:12:00",
  "SCH",       "MED",     67350046,      "27-02-2010",        "19:30:00",    50611359, "Telephone Visit",  "27-02-2010",    "16:08:00",        "Y",  "27-02-2010",    "19:30:00",
  "SCH",       "MED",     67350046,      "27-02-2010",        "19:40:00",    81150308, "Telephone Visit",  "27-02-2010",    "16:17:00",        "Y",  "27-02-2010",    "19:40:00",
  "SCH",       "MED",     67350046,      "27-02-2010",        "19:50:00",    54571329, "Telephone Visit",  "27-02-2010",    "16:24:00",        "Y",  "27-02-2010",    "19:50:00",
  "SCH",       "MED",     67350046,      "27-02-2010",        "20:15:00",    72661327, "In-Person Visit",  "27-02-2010",    "16:45:00",        "Y",  "27-02-2010",    "20:06:00",
  "SCH",       "MED",     67350046,      "27-02-2010",        "20:30:00",    45610365, "In-Person Visit",  "27-02-2010",    "16:46:00",        "Y",  "27-02-2010",    "20:13:00",
  "SCH",       "MED",     67350046,      "14-03-2010",         "9:00:00",     1581300, "Telephone Visit",  "13-03-2010",    "20:06:00",        "Y",  "14-03-2010",     "9:00:00",
  "SCH",       "MED",     67350046,      "14-03-2010",         "9:10:00",    39561301, "Telephone Visit",  "13-03-2010",    "20:50:00",        "Y",  "14-03-2010",     "9:10:00",
  "SCH",       "MED",     67350046,      "14-03-2010",         "9:20:00",    45681028, "Telephone Visit",  "13-03-2010",    "21:39:00",        "Y",  "14-03-2010",     "9:20:00",
  "SCH",       "MED",     67350046,      "14-03-2010",         "9:30:00",     5770570, "Telephone Visit",  "13-03-2010",    "22:00:00",        "Y",  "14-03-2010",     "9:30:00",
  "SCH",       "MED",     67350046,      "14-03-2010",         "9:40:00",    62970903, "Telephone Visit",  "14-03-2010",     "7:42:00",        "Y",  "14-03-2010",     "9:40:00",
  "SCH",       "MED",     67350046,      "14-03-2010",         "9:50:00",     3110251, "Telephone Visit",  "14-03-2010",     "8:26:00",        "Y",  "14-03-2010",    "10:01:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "10:10:00",    11260298, "Telephone Visit",  "13-03-2010",    "20:39:00",        "Y",  "14-03-2010",    "10:10:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "10:20:00",    39471067, "Telephone Visit",  "14-03-2010",     "8:57:00",        "Y",  "14-03-2010",    "10:20:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "10:30:00",    58660262, "Telephone Visit",  "13-03-2010",    "20:46:00",        "Y",  "14-03-2010",    "10:30:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "10:40:00",    46581239, "Telephone Visit",  "14-03-2010",     "9:41:00",        "Y",  "14-03-2010",    "10:40:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "10:50:00",      400877, "Telephone Visit",  "14-03-2010",     "9:49:00",        "Y",  "14-03-2010",    "10:50:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "11:00:00",    36661178, "Telephone Visit",  "14-03-2010",     "9:59:00",        "Y",  "14-03-2010",    "11:00:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "11:20:00",    60820165, "Telephone Visit",  "14-03-2010",    "10:17:00",        "Y",  "14-03-2010",    "11:25:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "11:30:00",    51011175, "Telephone Visit",  "14-03-2010",    "10:33:00",        "Y",  "14-03-2010",    "11:30:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "11:40:00",    79631370, "Telephone Visit",  "14-03-2010",    "10:39:00",        "Y",  "14-03-2010",    "11:40:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "11:50:00",     6001242, "Telephone Visit",  "14-03-2010",    "10:58:00",        "Y",  "14-03-2010",    "11:50:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "12:00:00",    12970773, "Telephone Visit",  "14-03-2010",    "11:12:00",        "Y",  "14-03-2010",    "12:00:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "12:10:00",    20090865, "Telephone Visit",  "14-03-2010",    "11:13:00",        "Y",  "14-03-2010",    "12:10:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "13:30:00",     4190798, "In-Person Visit",  "14-03-2010",    "10:10:00",        "Y",  "14-03-2010",    "13:23:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "13:45:00",    70420937, "In-Person Visit",  "14-03-2010",    "10:38:00",        "Y",  "14-03-2010",    "13:15:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "14:00:00",    94661283, "In-Person Visit",  "14-03-2010",    "11:00:00",        "Y",  "14-03-2010",    "13:50:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "14:15:00",    91820845, "In-Person Visit",  "14-03-2010",    "11:20:00",        "Y",  "14-03-2010",    "14:22:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "14:45:00",    33640992, "In-Person Visit",  "14-03-2010",    "11:58:00",        "Y",  "14-03-2010",    "14:41:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "15:00:00",    99420809, "In-Person Visit",  "14-03-2010",    "14:05:00",        "Y",  "14-03-2010",    "14:58:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "15:15:00",    76811285, "In-Person Visit",  "14-03-2010",    "13:14:00",        "Y",  "14-03-2010",    "15:12:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "15:30:00",    70620487, "In-Person Visit",  "14-03-2010",    "13:47:00",        "Y",  "14-03-2010",    "15:52:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "16:00:00",    77080452, "In-Person Visit",  "14-03-2010",    "13:25:00",        "Y",  "14-03-2010",    "16:01:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "16:15:00",    59640859, "In-Person Visit",  "14-03-2010",    "15:16:00",        "Y",  "14-03-2010",    "16:13:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "16:30:00",    53681327, "In-Person Visit",  "14-03-2010",    "14:27:00",        "Y",  "14-03-2010",    "16:30:00",
  "SCH",       "MED",     67350046,      "14-03-2010",        "16:45:00",    66020217, "In-Person Visit",  "14-03-2010",    "16:13:00",        "Y",  "14-03-2010",    "16:18:00",
  "SCH",       "MED",     67350046,      "18-04-2010",         "9:00:00",    48950239, "Telephone Visit",  "17-04-2010",    "19:02:00",        "Y",  "18-04-2010",     "9:00:00",
  "SCH",       "MED",     67350046,      "18-04-2010",         "9:10:00",    55720597, "Telephone Visit",  "17-04-2010",    "19:02:00",        "Y",  "18-04-2010",     "9:10:00",
  "SCH",       "MED",     67350046,      "18-04-2010",         "9:20:00",    63270206, "Telephone Visit",  "17-04-2010",    "20:18:00",        "Y",  "18-04-2010",     "9:20:00",
  "SCH",       "MED",     67350046,      "18-04-2010",         "9:30:00",    34350507, "Telephone Visit",  "17-04-2010",    "20:24:00",        "Y",  "18-04-2010",     "9:30:00",
  "SCH",       "MED",     67350046,      "18-04-2010",         "9:40:00",    85410790, "Telephone Visit",  "17-04-2010",    "21:25:00",        "Y",  "18-04-2010",     "9:40:00",
  "SCH",       "MED",     67350046,      "18-04-2010",         "9:50:00",    58760397, "Telephone Visit",  "17-04-2010",    "23:00:00",        "Y",  "18-04-2010",     "9:50:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "10:10:00",    17091324, "Telephone Visit",  "17-04-2010",    "23:55:00",        "Y",  "18-04-2010",    "10:10:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "10:20:00",    27551239, "Telephone Visit",  "18-04-2010",     "7:24:00",        "Y",  "18-04-2010",    "10:20:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "10:30:00",    44910588, "Telephone Visit",  "18-04-2010",     "7:50:00",        "Y",  "18-04-2010",    "10:30:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "10:40:00",    84710811, "Telephone Visit",  "18-04-2010",     "8:21:00",        "Y",  "18-04-2010",    "10:40:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "10:50:00",     2031008, "Telephone Visit",  "18-04-2010",     "8:25:00",        "Y",  "18-04-2010",    "10:50:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "11:00:00",    57051304, "Telephone Visit",  "18-04-2010",     "8:30:00",        "Y",  "18-04-2010",    "11:00:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "11:20:00",    80430721, "Telephone Visit",  "18-04-2010",     "8:52:00",        "Y",  "18-04-2010",    "11:20:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "11:30:00",    35181170, "Telephone Visit",  "18-04-2010",     "9:00:00",        "Y",  "18-04-2010",    "11:30:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "11:40:00",    23941141, "Telephone Visit",  "18-04-2010",     "9:29:00",        "Y",  "18-04-2010",    "11:40:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "11:50:00",    81780581, "Telephone Visit",  "18-04-2010",     "9:35:00",        "Y",  "18-04-2010",    "11:50:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "12:00:00",    84921325, "Telephone Visit",  "18-04-2010",     "9:47:00",        "Y",  "18-04-2010",    "12:00:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "12:10:00",     7840708, "Telephone Visit",  "18-04-2010",    "10:02:00",        "Y",  "18-04-2010",    "12:10:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "13:30:00",    90890843, "Telephone Visit",  "18-04-2010",    "10:03:00",        "Y",  "18-04-2010",    "13:30:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "13:40:00",    65520243, "Telephone Visit",  "18-04-2010",    "10:03:00",        "Y",  "18-04-2010",    "13:40:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "13:50:00",    51631371, "Telephone Visit",  "18-04-2010",    "10:22:00",        "Y",  "18-04-2010",    "13:50:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "14:00:00",    39541320, "Telephone Visit",  "18-04-2010",    "11:16:00",        "Y",  "18-04-2010",    "14:00:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "14:10:00",    78741252, "Telephone Visit",  "18-04-2010",    "11:00:00",        "Y",  "18-04-2010",    "14:10:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "14:20:00",    30201029, "Telephone Visit",  "18-04-2010",    "11:29:00",        "Y",  "18-04-2010",    "14:20:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "14:40:00",    36581376, "Telephone Visit",  "18-04-2010",    "12:01:00",        "Y",  "18-04-2010",    "14:40:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "14:50:00",     5630527, "Telephone Visit",  "18-04-2010",    "12:22:00",        "Y",  "18-04-2010",    "14:50:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "15:00:00",     9030189, "Telephone Visit",  "18-04-2010",    "12:28:00",        "Y",  "18-04-2010",    "15:00:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "15:10:00",    86610579, "Telephone Visit",  "18-04-2010",    "13:49:00",        "Y",  "18-04-2010",    "15:10:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "15:20:00",    88050532, "Telephone Visit",  "18-04-2010",    "14:24:00",        "Y",  "18-04-2010",    "15:20:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "15:30:00",    11900820, "Telephone Visit",  "18-04-2010",    "14:16:00",        "Y",  "18-04-2010",    "15:30:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "16:20:00",    65560364, "Telephone Visit",  "18-04-2010",    "15:46:00",        "Y",  "18-04-2010",    "16:00:00",
  "SCH",       "MED",     67350046,      "18-04-2010",        "17:10:00",    84680527, "Telephone Visit",  "18-04-2010",    "16:38:00",        "Y",  "18-04-2010",    "17:10:00",
  "SCH",       "MED",     67350046,        "7/5/2010",        "17:30:00",    21130631, "Telephone Visit",    "7/5/2010",    "16:38:00",        "Y",    "7/5/2010",    "17:30:00",
  "SCH",       "MED",     67350046,        "7/5/2010",        "17:40:00",    66380930, "Telephone Visit",    "7/5/2010",    "16:49:00",        "Y",    "7/5/2010",    "17:40:00",
  "SCH",       "MED",     67350046,        "7/5/2010",        "17:50:00",    57270715, "Telephone Visit",    "7/5/2010",    "17:08:00",        "Y",    "7/5/2010",    "17:50:00",
  "SCH",       "MED",     67350046,        "7/5/2010",        "18:00:00",    74590916, "Telephone Visit",    "7/5/2010",    "16:42:00",        "Y",    "7/5/2010",    "18:00:00",
  "SCH",       "MED",     67350046,        "7/5/2010",        "18:10:00",    48591358, "Telephone Visit",    "7/5/2010",    "17:36:00",        "Y",    "7/5/2010",    "18:10:00",
  "SCH",       "MED",     67350046,        "7/5/2010",        "18:20:00",    48380640, "Telephone Visit",    "7/5/2010",    "17:27:00",        "Y",    "7/5/2010",    "18:20:00",
  "SCH",       "MED",     67350046,        "7/5/2010",        "18:30:00",    83630529, "Telephone Visit",    "7/5/2010",    "17:39:00",        "Y",    "7/5/2010",    "18:30:00",
  "SCH",       "MED",     67350046,        "7/5/2010",        "18:50:00",    24990769, "Telephone Visit",    "7/5/2010",    "17:43:00",        "N",            NA,            NA,
  "SCH",       "MED",     67350046,        "7/5/2010",        "19:00:00",    93730683, "Telephone Visit",    "7/5/2010",    "17:41:00",        "Y",    "7/5/2010",    "19:00:00",
  "SCH",       "MED",     67350046,        "7/5/2010",        "19:10:00",    90720562, "Telephone Visit",    "7/5/2010",    "17:52:00",        "Y",    "7/5/2010",    "19:10:00",
  "SCH",       "MED",     67350046,        "7/5/2010",        "19:20:00",     9130746, "Telephone Visit",    "7/5/2010",    "18:07:00",        "Y",    "7/5/2010",    "19:20:00",
  "SCH",       "MED",     67350046,        "7/5/2010",        "19:30:00",    41390157, "Telephone Visit",    "7/5/2010",    "18:42:00",        "Y",    "7/5/2010",    "19:30:00",
  "SCH",       "MED",     67350046,        "7/5/2010",        "19:40:00",    30790850, "Telephone Visit",    "7/5/2010",    "19:05:00",        "N",            NA,            NA,
  "SCH",       "MED",     67350046,      "14-05-2010",        "17:30:00",    15100895, "Telephone Visit",  "14-05-2010",    "16:27:00",        "Y",  "14-05-2010",    "17:30:00",
  "SCH",       "MED",     67350046,      "14-05-2010",        "17:40:00",     8820665, "Telephone Visit",  "14-05-2010",    "16:44:00",        "Y",  "14-05-2010",    "17:40:00",
  "SCH",       "MED",     67350046,      "14-05-2010",        "17:50:00",    24480005, "Telephone Visit",  "14-05-2010",    "17:02:00",        "Y",  "14-05-2010",    "17:50:00",
  "SCH",       "MED",     67350046,      "14-05-2010",        "18:00:00",    90990756, "Telephone Visit",  "14-05-2010",    "16:49:00",        "Y",  "14-05-2010",    "18:00:00",
  "SCH",       "MED",     67350046,      "14-05-2010",        "18:10:00",    10490595, "Telephone Visit",  "14-05-2010",    "17:06:00",        "Y",  "14-05-2010",    "18:10:00",
  "SCH",       "MED",     67350046,      "14-05-2010",        "18:20:00",    98521117, "Telephone Visit",  "14-05-2010",    "17:22:00",        "Y",  "14-05-2010",    "18:20:00"
)


# data is now in dataframe s

#Let us convert dates from character to proper dates


library(tidyverse)
library(lubridate)
#> 
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:base':
#> 
#>     date
names(s)
#>  [1] "FACILITY"         "DEPARTMENT"       "PROVIDER_ID"     
#>  [4] "APPOINTMENT_DATE" "APPOINTMENT_TIME" "PATIENT_ID"      
#>  [7] "APPOINTMENT_TYPE" "BOOKING_DATE"     "BOOKING_TIME"    
#> [10] "SHOW_CODE"        "CHECKIN_DATE"     "CHECKIN_TIME"

s %>% mutate(APPOINTMENT_DATE = mdy(APPOINTMENT_DATE)) %>% 
mutate(BOOKING_DATE = mdy(BOOKING_DATE)) %>% 
mutate(CHECKIN_DATE = mdy(CHECKIN_DATE)) %>% 

## note that there is a problem with 102 dates failing to parse
## Let us look at these

table(s$APPOINTMENT_DATE)
#> Warning: 102 failed to parse.

#> Warning: 102 failed to parse.

#> Warning: 102 failed to parse.
#> Error: Must use a vector in `[`, not an object of class matrix.

## OK two different date formats. this is likely the problem. #
## Possibly fixable with a casewhen #

s %>% 
mutate(BOOKING_DATE = case_when(
grepl("-", BOOKING_DATE) ~ dmy(BOOKING_DATE),
grepl("/", BOOKING_DATE) ~ mdy(BOOKING_DATE))) ->
s2
#> Warning: 102 failed to parse.

table(s2$BOOKING_DATE)
#> 
#> 2009-04-12 2009-08-12 2009-12-31 2010-01-14 2010-02-27 2010-03-13 
#>         13          7         12         13          9          6 
#> 2010-03-14 2010-04-17 2010-04-18 2010-05-14 2010-07-05 2010-08-01 
#>         24          7         25          6         13         13 
#> 2010-09-02 2010-10-01 
#>         10          4

## Now let us try to find the gap in days
## and see if we still get negative #s

s2 %>% 
group_by(PROVIDER_ID) %>% 
arrange(BOOKING_DATE) %>% 
mutate(days_gap = BOOKING_DATE - lag(BOOKING_DATE)) %>% 
select(PROVIDER_ID, BOOKING_DATE, days_gap) ->
s3

table(s3$days_gap)
#> 
#>   0   1  14  26  27  29  32  34  44  52 122 141 
#> 148   2   2   1   1   1   1   1   1   1   1   1

Created on 2019-02-24 by the reprex package (v0.2.1)strong text

0 Likes

#11

There are two formats for dates in your data, mixed in the same column.
This occurs for all three date columns.
It looks like the dates with dashes are day-month-year, while those with forward slashes are month/day/year.
Kind of a data nightmare.
Fortunately grepl allows you to detect when a dash or a forward slash is present, and mutate(case_when) allows you to use the right date formatting for each case.

0 Likes

listed #12
0 Likes

unlisted #13
0 Likes

listed #14
0 Likes

closed #15

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

0 Likes