Boost logo

Boost :

From: Carl Waldbieser (waldbie_at_[hidden])
Date: 2003-05-24 17:39:23


I have been experimenting with the Boost Date-Time library in the hopes that
I can use it in an application I am writing. The application deals with
determining whether of not students have received their required
immunization shots as required by most school districts. Many states in the
U.S. have different rules about how the immunization schedules must work, so
I recognized the flexibility of the Date-Time library as an asset. However,
there are currently some things that I am not sure are possible (or at least
not obvious to me) are very important to school districts and the states to
which they report.

One example deals with the way in which an immunization schedule is
organized. A student following the recommended schedule will typically need
to receive a certain number of doses of a given immunization. Each dose
will have a timeframe that will specify a valid time period in which the
shot can be received. For example, the first dose of a
Measles-Mumps-Rubella (MMR) shot might be required to be given no sooner
than 6 weeks from the date of the student's birth, and no longer than 2
months after that (or the shot would be considered overdue). (Note: those
figures are just made up off the top of my head, but they are useful just
for the example). Now within that seemingly simple rule, different school
districts want different levels of flexibility. Some districts want to
count the last day of the period as the first day that the shot is overdue;
others may want to consider it the last valid day. Some districts only want
to consider the month and year in which the student was born. As an
example, if it is invalid to have an innoculation prior to 12 months from
the date of birth, some districts require that a student born on Jan 15,
2000 who receives the shot on Jan 14, 2001 be considered valid, while others
require that the earlist the shot could be considered valid is Jan 15, 2001.

Th Boost Date-Time library provides several iterators (like week, month, and
year iterators) that make some of these tasks very easy to compute. Need a
date 2 months and 1 week from the current date? Create a month iterator,
std::advance by 2, dereference and create a week iteator, advance by 1,
ta-da! However, there are some situations that are not so easy. If I need
to find the date 1 day *before* the date 2 months from my start date, there
doesn't seem to be an easy way to do it (the iterators are all models of
Input Iterators, so there is no operator--).

The ability to create flexible offsets from a given date are extremely
useful, especially when the units involved are mixed (days, weeks, months,
years). The ability of the Date-Time library to handle situations like this
has really impressed me so far, but situations where the offset is a given
amount of one unit *less* than a given amount of another unit are equally
important in the application I have in mind. I realize that there are
larger issues that deal with much smaller and larger time resolutions than I
am working with, but I would really like to see some of this extra
flexability make it into the library!

Thanks for listening,
Carl Waldbieser
waldbie_at_[hidden]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk