knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(appointment)

The {appointment} package allows you to be able to set clinic appointments in a nicely formatted style. It has two functions - appt_next() and appt_last. Both of which take three arguments - clinic date (c_date), duration of pills (d_pills), and next appointment date (days). d_pills and days are mutually exclusive.

We are going to create some useful scenarios:

  1. Imagine a patient who comes to the clinic on Friday, 3rd September 2021 and had 2 weeks worth of medications dispensed. He is expected to come for next check up on the last day of his medication.
clinic_date <- "2021-09-03"
pill_days <- 14

appt_next(clinic_date, pill_days)
  1. Imagine a patient who came to the hospital on Saturday, 4th September 2021. He has now be adjudged to be healthy so he does not require anymore medications but will still require a follow up a week after.
clinic_date <- "2021-09-04"
follow_up_days <- 7

appt_next(clinic_date, follow_up_days)
  1. Finally, let us assume a patient who comes to the clinic on the first of September 2021. He remembers that he was given 20 days worth of medications during the last appointment but could not remember the exact appointment date. You'd like to know the date to pull his last clinic records.
clinic_date <- "2021-09-01"
d_pills <- 20

appt_last(clinic_date, d_pills)


stephenbalogun/appointment documentation built on Dec. 23, 2021, 5:31 a.m.