-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JavaScript function to filter the "schedule" #141
Comments
The schedule table has "name" and "description" fields linking records from the Help Services table to the schedule table. (Airtable is a relational database, allowing us to connect records from one spreadsheet to another in the same "base." Base is Airtable lingo for the database.) We're using something called RRule to enter the times, a format for notating recurring calendar days for schedule information. This list is all the fields in the schedule table: id NOTE: freq - how often the frequency repeats, for example DAILY, WEEKLY, MONTHLY. byday - comma separated days of the week, SU,MO,TU,WE,TH,FR,SA. Where freq is MONTHLY each part can be preceded by a positive or negative integer to represent which occurrence in a month; for example, 2MO is the second Monday in a month, 3TH for third Thursday, -1FR is the last Friday. bymonthday - comma separated numeric days of the month if frequency is MONTHLY. Can be negative to represent days before the end of the month; for example, -5 is the 5th to last day in a month. valid_from and valid_to - for schedules with time (multiple months, for example) in which the service isn't available, this is only used on one or two records. |
If a service has multiple open and close times, each goes on it's own record, and that's why you'll see a few repetitions in the rows, for example, the times for Access the Law. |
A very rough draft, attempting to articulate the workings of the "schedule" table and begin a JavaScript function with pseudocode to filter the providers for all those with services available at the time a person switches the toggle. We're using recurrence rules, RRule, to translate the "Hours of operation" descriptions into a shared (and Human Services Data Specification compatible) format for writing recurring calendar events. This issue has a screen shot of the schedule table above here. To start, I'll introduce possible schedule “freq” variations:
The Available Now toggle filters the results of a specific category page (Basic Needs, Care, Education, and all the rest). Some things that come to mind for the function:
function availableNow () {
look for services available at all hours, every day
check if the service is only available during some months of the year
check if the service is available at all times of the year
look for monthly recurring events by day of week
look for an event happening on a specific numbered day, for example, the eleventh day of every month
display all providers using a subcategory.html style layout |
I think at the heart of this is an pseudocode:
|
The following mocks the schedule items and has already pulled day, month, date, hours, minutes from a time. The full code will have to pull the schedule items for a provider from the table, decompose the time into the components, and then call this function. A start at how to write this function:
|
PS one more thought: Instead of |
|
Write JavaScript function to filter the "schedule" table (a tab found along the menu bar in the Little Help Book Airtable) to display services available when the toggle is on. The schedule table is linked to the "Help Services" table, and the Hours of operation field.
The toggle is found on the category page, Basic Needs, Care, Education, Food, and the rest.
The text was updated successfully, but these errors were encountered: