A third party system produces an HTML table of parent teacher bookings:
Blocks Teacher 1 Teacher 2 Teacher 3
3:00 pm Stu A Stu B
3:10 pm Stu B Stu C
...
5:50 pm Stu D Stu A Stu E
The number of columns changes depending on how many teachers have bookings. The number of rows changes depending on how many slots we create.
The end result needs to be a hash for each teacher like:
{ name: "Teacher 1", email: "teacher.1@school.edu", appointments: [
{ start: "15:00", end: "15:08", attendees: [
{ name: "Stu A Parent 1", email: "stuap1@example.com" },
{ name: "Stu A Parent 2", email: "stuap2@example.com" }
] },
{ start: "15:10", end: "15:18", attendees: [
{ name: "Stu B Parent", email: "stubp@example.com" }
] },
...
{ start: "17:50", end: "17:58", attendees: [
{ name: "Stu D Parent 1", email: "studp1@example.com" },
{ name: "Stu D Parent 2", email: "studp2@example.com" }
] },
] },
I think it makes most sense to ETL process each teacher as a row so this time I've transposed the rows and columns in Numbers and saved that as a CSV:
Blocks,3:00 pm,3:10 pm,...,5:50 pm
Teacher 1,Stu A,Stu B,...,Stu D
Teacher 2,Stu B,,...,Stu C
Teacher 3,Stu D,Stu A,...,Stu E
I'm trying to make the whole process as simple as possible for the office staff to use so is it possible to do the transposing of rows and columns in Kiba (or plain Ruby)? In Kiba I assume I'd have to process all the rows, accumulating a hash per teacher and then at the end output each teacher's hash?