I’ve been working with the National 211 Data Platform (NDP) in conjunction with a data managers from several 211s towards creating, among other things, a 211 Profile for HSDS. We’ve hit a snag trying to use the schedule
table with existing real-world data.
Many software systems where resource data originates provide a single plain text field for schedule data. It’s gross, but that’s the reality for now. Here’s a sample of real schedules provided by the NDP for reference:
<u>Women:</u>Monday - Friday, 9:00am - 11:00am<u>Men:</u>Monday - Friday, 2:00pm -
4:00pm<u>Meals:</u>
Monday - Friday, 11:30am - 1:00pm"
Monday - Friday, 8 a.m. - 5 p.m.
Mon-Thu 7am-5pm, every other Fri 7am-5pm
Mon-Fri - 6:30am to 6:00pm
Mon V - V; Tue V - V; Wed V - V; Thu V - V; Fri V - V;
Mon 8:30am - 5pm; Tue 8:30am - 5pm; Wed 8:30am - 5pm; Thu 8:30am - 5pm; Fri 8:30am - 5pm;
Mon 9am - 5pm; Tue 9am - 5pm; Wed 9am - 5pm; Thu 9am - 5pm; Fri 9am - 5pm;
Mon - Fri 8:00 am - 5:00 pm
Mon - Fri 8:00 am - 4:30 pm
211 data managers are drafting how they would like to be able to represent data, both in an interface and under the hood. I’ve been pushing for using the HSDS schedule
schema under the hood, but there are two problems:
- The source data will be retained in the
description
field for a schedule record, but where a single schedule requires more than once record (for exampleMon-Thu 7am-5pm, every other Fri 7am-5pm
), that description will have to be duplicated across each record, which breaks the rules of normalization. - Further, where an entity has more than one schedule, each with different times on different days, it can be difficult or impossible to determine which schedule rows should be grouped together. We might consider matching by
valid_from
andvalid_to
values, but not all records will have that info, nor can we guarantee they will line up cleanly even when they are present.
The solution proposed by our work group is to move the current schedule
fields into a table called hours
, and then simplify schedule
to (more or less) description
, valid_from
, and valid_to
. There would be a 1:many relationship from schedule
to hours
, thereby allowing hours
to a) be grouped and b) share a global description.
It’s an intuitive abstraction that looks similar to the pattern used for location
and address
.
@davidraznick suggested we could use attribute
s to group schedule records and add the description, but also acknowledged it’s a little hacky and wouldn’t negate the description duplication problem. Of more importance to me is that it’s not obvious; developers would have to know to look for attributes, and know what to do with them, whereas the table structure suggested above is self documenting.
I’m very interested in getting feedback from others about how you have solved these challenges with schedule data, and whether you think there is merit to abstracting hours
a level below schedule
.