Vegman
Design · Domain Model Proposal

Domain Model Proposal

A proposal, not a decision. Every entity and relationship below is open to challenge; the open decisions are listed at the end.

Version 0.1, 5 September 2026. A starting proposal for how the product models a school and everything that must be timetabled. It is shaped after the XHSTT standard so that any solver can be plugged in and so that a school can be exported as a benchmark instance, and it is extended where Israeli primary schools need more than the standard offers.

Overview

The model separates four concerns that timetabling products usually tangle together: what the school is (organisation and people), what must happen each week (curriculum and the events it generates), what the rules are (constraints, each traceable to a requirement ID), and what the solver produced (a timetable version with its assignments and its score). Application logic works on the first three and produces the fourth; no frontend concept appears anywhere in the model.

Summary

Bottom line

Adopt this model as the domain layer now, implement it as plain data classes with no framework dependency, and write two adapters first: an importer from the Tik-Tak export, and an exporter to XHSTT. That gives a scored benchmark of Mevo Hagalil's real timetable before a single solver line is written. The open decisions at the end (rooms, students, hour placement) do not block that.

Detailed explanation

The diagram

Boxes are entities. Lines are relationships with cardinality: 1 one, * many, 0..1 optional. Read from the top: organisation feeds curriculum, curriculum generates events, constraints govern events, and a timetable assigns them.

classDiagram
direction TB

class School {
  id
  name
  sector
  weekStructure : TimeGrid
}
class Grade {
  id
  level : 1..12
  name
}
class Class {
  id
  name
  homeroom : Staff
}
class StudentGroup {
  id
  kind : class | half | level | cross | cohort
  drawnFrom : Class[]
}
class Student {
  id
  name
}
class Staff {
  id
  name
  role : teacher | assistant | soldier
  contract : OfekHadash | OzLaTmura
  frontalHours
  individualHours
  stayingHours
  subjects : Subject[]
}
class Availability {
  slot : TimeSlot
  state : unavailable | preferNot
  reason
}
class Subject {
  id
  name
  isCore
  roomType : RoomType
}
class CurriculumLine {
  grade : Grade
  subject : Subject
  weeklyPeriods
  pattern : 2+2+1
  coTeaching : rule
}
class Event {
  id
  subject : Subject 0..1
  duration : periods
  kind : lesson | activity | meeting | individual | staying
  fixedAt : TimeSlot 0..1
  pinned
}
class StaffSlot {
  role : lead | co | assistant | soldier
  assigned : Staff 0..1
}
class EventGroup {
  id
  kind : sameCourse | linked
}
class TimeGrid {
  days
  periodsPerDay
  clockTimes
}
class TimeSlot {
  day
  period
  isLongDay
}
class RoomType {
  id
  name
}
class Room {
  id
  name
  type : RoomType
  capacity
}
class Constraint {
  id
  type : XHSTT-style
  hard
  weight
  params
  implements : RequirementId
}
class Timetable {
  id
  version
  status : draft | published
  basedOn : Timetable 0..1
}
class Assignment {
  event : Event
  slots : TimeSlot[]
  room : Room 0..1
  staff : Staff[]
}
class Violation {
  constraint : Constraint
  cost
  explanation
}

School "1" --> "*" Grade
School "1" --> "1" TimeGrid
TimeGrid "1" --> "*" TimeSlot
Grade "1" --> "*" Class
Class "1" --> "1" Staff : homeroom
Class "1" --> "*" StudentGroup : drawn from
StudentGroup "*" --> "*" Student : optional
Staff "1" --> "*" Availability
Staff "*" --> "*" Subject : teaches
Grade "1" --> "*" CurriculumLine
CurriculumLine "*" --> "1" Subject
CurriculumLine "1" --> "*" Event : generates per class
Event "*" --> "*" StudentGroup : attendees
Event "1" --> "*" StaffSlot
StaffSlot "*" --> "0..1" Staff
Event "*" --> "0..1" RoomType : requires
Event "*" --> "0..1" EventGroup
Room "*" --> "1" RoomType
Constraint "*" --> "*" Event : governs
Constraint "*" --> "*" Staff : governs
Timetable "1" --> "*" Assignment
Assignment "1" --> "1" Event
Assignment "*" --> "*" TimeSlot
Assignment "*" --> "0..1" Room
Timetable "1" --> "*" Violation
Violation "*" --> "1" Constraint

Entity catalogue

EntityWhat it isWhy it existsXHSTT equivalent
SchoolThe institution and its week structure.Multi-school tenancy from day one; the week grid is a property of the school, not a global.Instance
TimeGrid, TimeSlotDays, periods per day, clock times, and the derived slots. Tuesday with 5 periods and the period-7 "long day" are data, not code.R-02, R-07, Q-01.Times, TimeGroups
GradeA cohort ("מחזור"), the level at which curriculum is defined and grade-wide blocks happen.R-11, S-07, curriculum per grade (N-03).ResourceGroup of Classes
ClassA homeroom class with a homeroom teacher.R-01, R-06, S-02.Resource of type Class
StudentGroupAny audience of an event: a whole class, a half, an ability group across classes, a choir cohort. A class has exactly one group of kind "class".R-03 halves, hakbatsot, choir and orchestra blocks (S-06), future per-student scheduling.Resource of type Class or Student; the 2024 group-formation extension
StudentIndividual pupil. Optional in version 1; needed only when groups are defined by named pupils.Future high-school and US variants.Resource of type Student
StaffAnyone who occupies a slot: teacher, assistant, national-service soldier. Carries contract, hour basket, subjects and homeroom.R-03, R-04, R-09, R-10, S-03.Resource of type Teacher
AvailabilityA staff member's unavailable or dispreferred slots, with reason (part-time day, late arrival, staff meeting).R-09, R-10, S-05.AvoidUnavailableTimes
SubjectWhat is taught. Flags for core status and required room type.R-08, R-13, R-14, N-01.EventGroup / Course
CurriculumLinePer grade and subject: weekly periods, split pattern, co-teaching rule. Generates one set of events per class of that grade.R-13, N-03.Event with SplitEvents / DistributeSplitEvents
EventThe thing that gets a time: lesson, activity, meeting, individual hour, staying hour. May be fixed in advance or pinned by the user.Everything; S-06, S-07, S-08 for events without a class.Event
StaffSlotOne required adult on an event, with a role. Two slots express co-teaching; a pre-assigned slot expresses "always with the homeroom teacher".R-03, R-12.Resource slot on an Event
EventGroupTies events together: the five weekly math lessons of a class (same course), or events that must run simultaneously (linked: hakbatsot, grade-wide trip).R-11, R-12, hakbatsot.EventGroup, LinkEvents
RoomType, RoomKinds of spaces and actual rooms. Optional for Mevo Hagalil beyond the gym.Q-13; future high schools with labs.Resource of type Room
ConstraintA typed rule: hard or soft, weight, parameters, the entities it governs, and the requirement ID it implements.The whole R list, S-05.Constraint types
TimetableA versioned solution with a status, optionally based on a previous version.Re-planning several times a year; diffing.Solution
AssignmentAn event placed at slots, with a room and resolved staff.The output.SolutionEvent
ViolationOne broken constraint with its cost and a human-readable explanation.Explainability, the market gap.Cost report

How Vegman's rules map onto the model

RequirementModelled as
R-01, R-02School, Grade, Class, TimeGrid data.
R-03Events with two StaffSlots.
R-04Staff.frontalHours and derived counts; individual and staying hours as Events of those kinds (pending Q-03).
R-05Constraint LimitIdleTimes on Staff, counting individual and staying events as busy.
R-06Constraint on homeroom Staff: days starting at period 1 ≥ 3, soft.
R-07Constraint on Staff: days ending at period 7 = 2, soft.
R-08Constraint per Class per day on Subject counts.
R-09, R-10Availability rows.
R-11One Event per class, duration 3, StaffSlot pre-assigned to the homeroom, EventGroup linked per grade, constraint restricting slots to periods 4 to 6 and spreading grades over days.
R-12CurriculumLine.coTeaching rule producing Events with a lead slot pre-assigned to the homeroom and a co slot pre-assigned to x, y or z, duration 2.
R-13CurriculumLine.weeklyPeriods.
R-14Constraint AvoidTimes for core Subjects on last periods, soft.
S-05Availability rows with reason "meeting", or Events of kind meeting with no StudentGroup.
S-06, S-07Events with fixedAt set, several StudentGroups, pre-assigned StaffSlots.
S-08Events with zero StudentGroups.

Boundaries and layers

The domain model is one package with no dependencies. Around it:

Open decisions

תכנון · הצעה למודל הדומיין

הצעה למודל הדומיין

הצעה, לא החלטה. כל ישות וקשר להלן פתוחים לערעור; ההחלטות הפתוחות מפורטות בסוף.

גרסה 0.1, 5 בספטמבר 2026. הצעה ראשונית לאופן שבו המוצר ממדל בית ספר ואת כל מה שיש לשבץ במערכת השעות. היא בנויה בהשראת תקן XHSTT, כך שניתן לחבר אליה כל פותר (solver) וכך שניתן לייצא בית ספר כמופע benchmark, והיא מורחבת במקומות שבהם בתי ספר יסודיים בישראל זקוקים ליותר ממה שהתקן מציע.

סקירה

המודל מפריד בין ארבעה עניינים שמוצרי מערכות שעות נוהגים לערבב יחד: מהו בית הספר (ארגון ואנשים), מה חייב לקרות בכל שבוע (תוכנית הלימודים והאירועים שהיא מייצרת), מהם הכללים (אילוצים, שכל אחד מהם ניתן למעקב עד מזהה הדרישה שלו), ומה הפותר הפיק (גרסת מערכת שעות עם השיבוצים שלה והציון שלה). הלוגיקה היישומית פועלת על שלושת הראשונים ומפיקה את הרביעי; שום מושג של frontend אינו מופיע בשום מקום במודל.

תקציר

שורה תחתונה

לאמץ את המודל הזה כשכבת הדומיין כבר עכשיו, לממש אותו כמחלקות נתונים פשוטות ללא תלות ב-framework, ולכתוב קודם כול שני מתאמים: מייבא מהייצוא של תיק-תק, ומייצא ל-XHSTT. כך מתקבל benchmark מנוקד של מערכת השעות האמיתית של מבוא הגליל עוד לפני שנכתבת שורת קוד אחת של פותר. ההחלטות הפתוחות שבסוף (חדרים, תלמידים, מיקום שעות) אינן חוסמות זאת.

הסבר מפורט

התרשים

התיבות הן ישויות. הקווים הם קשרים עם קרדינליות: 1 אחד, * רבים, 0..1 אופציונלי. קראו מלמעלה: הארגון מזין את תוכנית הלימודים, תוכנית הלימודים מייצרת אירועים, אילוצים שולטים באירועים, ומערכת שעות משבצת אותם.

classDiagram
direction TB

class School {
  id
  name
  sector
  weekStructure : TimeGrid
}
class Grade {
  id
  level : 1..12
  name
}
class Class {
  id
  name
  homeroom : Staff
}
class StudentGroup {
  id
  kind : class | half | level | cross | cohort
  drawnFrom : Class[]
}
class Student {
  id
  name
}
class Staff {
  id
  name
  role : teacher | assistant | soldier
  contract : OfekHadash | OzLaTmura
  frontalHours
  individualHours
  stayingHours
  subjects : Subject[]
}
class Availability {
  slot : TimeSlot
  state : unavailable | preferNot
  reason
}
class Subject {
  id
  name
  isCore
  roomType : RoomType
}
class CurriculumLine {
  grade : Grade
  subject : Subject
  weeklyPeriods
  pattern : 2+2+1
  coTeaching : rule
}
class Event {
  id
  subject : Subject 0..1
  duration : periods
  kind : lesson | activity | meeting | individual | staying
  fixedAt : TimeSlot 0..1
  pinned
}
class StaffSlot {
  role : lead | co | assistant | soldier
  assigned : Staff 0..1
}
class EventGroup {
  id
  kind : sameCourse | linked
}
class TimeGrid {
  days
  periodsPerDay
  clockTimes
}
class TimeSlot {
  day
  period
  isLongDay
}
class RoomType {
  id
  name
}
class Room {
  id
  name
  type : RoomType
  capacity
}
class Constraint {
  id
  type : XHSTT-style
  hard
  weight
  params
  implements : RequirementId
}
class Timetable {
  id
  version
  status : draft | published
  basedOn : Timetable 0..1
}
class Assignment {
  event : Event
  slots : TimeSlot[]
  room : Room 0..1
  staff : Staff[]
}
class Violation {
  constraint : Constraint
  cost
  explanation
}

School "1" --> "*" Grade
School "1" --> "1" TimeGrid
TimeGrid "1" --> "*" TimeSlot
Grade "1" --> "*" Class
Class "1" --> "1" Staff : homeroom
Class "1" --> "*" StudentGroup : drawn from
StudentGroup "*" --> "*" Student : optional
Staff "1" --> "*" Availability
Staff "*" --> "*" Subject : teaches
Grade "1" --> "*" CurriculumLine
CurriculumLine "*" --> "1" Subject
CurriculumLine "1" --> "*" Event : generates per class
Event "*" --> "*" StudentGroup : attendees
Event "1" --> "*" StaffSlot
StaffSlot "*" --> "0..1" Staff
Event "*" --> "0..1" RoomType : requires
Event "*" --> "0..1" EventGroup
Room "*" --> "1" RoomType
Constraint "*" --> "*" Event : governs
Constraint "*" --> "*" Staff : governs
Timetable "1" --> "*" Assignment
Assignment "1" --> "1" Event
Assignment "*" --> "*" TimeSlot
Assignment "*" --> "0..1" Room
Timetable "1" --> "*" Violation
Violation "*" --> "1" Constraint

קטלוג הישויות

ישותמה זהלמה זה קייםמקבילה ב-XHSTT
School (בית ספר)המוסד ומבנה השבוע שלו.ריבוי בתי ספר (multi-tenancy) מהיום הראשון; רשת השבוע היא מאפיין של בית הספר, לא משתנה גלובלי.Instance
TimeGrid (רשת זמן), TimeSlot (משבצת זמן)ימים, שיעורים ביום, שעות שעון, והמשבצות הנגזרות מהם. יום שלישי עם 5 שיעורים ו"היום הארוך" עם שיעור 7 הם נתונים, לא קוד.R-02, R-07, Q-01.Times, TimeGroups
Grade (שכבה)מחזור (cohort), הרמה שבה מוגדרת תוכנית הלימודים ושבה מתקיימים בלוקים שכבתיים.R-11, S-07, תוכנית לימודים לכל שכבה (N-03).ResourceGroup של Classes
Class (כיתה)כיתת אם עם מחנך/ת.R-01, R-06, S-02.Resource מסוג Class
StudentGroup (קבוצת תלמידים)כל קהל של אירוע: כיתה שלמה, חצי כיתה, הקבצה חוצת כיתות, מחזור מקהלה. לכיתה יש בדיוק קבוצה אחת מסוג "class".R-03 חצאי כיתות, הקבצות, בלוקים של מקהלה ותזמורת (S-06), שיבוץ עתידי ברמת התלמיד הבודד.Resource מסוג Class או Student; הרחבת יצירת הקבוצות מ-2024
Student (תלמיד/ה)תלמיד/ה בודד/ת. אופציונלי בגרסה 1; נדרש רק כאשר קבוצות מוגדרות לפי תלמידים בשמם.גרסאות עתידיות לתיכונים ולארה"ב.Resource מסוג Student
Staff (איש/אשת צוות)כל מי שתופס משבצת: מורה, סייע/ת, חייל/ת שירות לאומי. נושא/ת חוזה, סל שעות, מקצועות וכיתת חינוך.R-03, R-04, R-09, R-10, S-03.Resource מסוג Teacher
Availability (זמינות)המשבצות שבהן איש צוות אינו זמין או מעדיף שלא, עם סיבה (יום חלקי, הגעה מאוחרת, ישיבת צוות).R-09, R-10, S-05.AvoidUnavailableTimes
Subject (מקצוע)מה שמלמדים. דגלים לסטטוס ליבה ולסוג החדר הנדרש.R-08, R-13, R-14, N-01.EventGroup / Course
CurriculumLine (שורת תוכנית לימודים)לכל שכבה ומקצוע: שיעורים שבועיים, תבנית פיצול, כלל הוראה משותפת. מייצרת סדרת אירועים אחת לכל כיתה בשכבה.R-13, N-03.Event עם SplitEvents / DistributeSplitEvents
Event (אירוע)הדבר שמקבל זמן: שיעור, פעילות, ישיבה, שעה פרטנית, שעת שהייה. עשוי להיות קבוע מראש או נעוץ על ידי המשתמש.הכול; S-06, S-07, S-08 לאירועים ללא כיתה.Event
StaffSlot (משבצת צוות)מבוגר אחד נדרש על אירוע, עם תפקיד. שתי משבצות מבטאות הוראה משותפת; משבצת ששובצה מראש מבטאת "תמיד עם המחנך/ת".R-03, R-12.משבצת Resource על Event
EventGroup (קבוצת אירועים)קושרת אירועים זה לזה: חמשת שיעורי המתמטיקה השבועיים של כיתה (אותו קורס), או אירועים שחייבים להתקיים בו-זמנית (מקושרים: הקבצות, טיול שכבתי).R-11, R-12, הקבצות.EventGroup, LinkEvents
RoomType (סוג חדר), Room (חדר)סוגי מרחבים וחדרים בפועל. אופציונלי עבור מבוא הגליל מעבר לאולם הספורט.Q-13; תיכונים עתידיים עם מעבדות.Resource מסוג Room
Constraint (אילוץ)כלל מטיפוס מוגדר: קשיח או רך, משקל, פרמטרים, הישויות שהוא שולט בהן, ומזהה הדרישה שהוא מממש.כל רשימת ה-R, S-05.טיפוסי Constraint
Timetable (מערכת שעות)פתרון מנוהל גרסאות עם סטטוס, המבוסס אופציונלית על גרסה קודמת.תכנון מחדש כמה פעמים בשנה; השוואה בין גרסאות.Solution
Assignment (שיבוץ)אירוע שמוקם במשבצות, עם חדר ואנשי צוות שנקבעו.הפלט.SolutionEvent
Violation (הפרה)אילוץ אחד שהופר, עם העלות שלו והסבר קריא לאדם.יכולת הסבר, הפער בשוק.דוח עלויות

כיצד הכללים של ווגמן ממופים על המודל

דרישהממודל כ-
R-01, R-02נתוני School, Grade, Class, TimeGrid.
R-03Events עם שני StaffSlots.
R-04Staff.frontalHours וספירות נגזרות; שעות פרטניות ושעות שהייה כ-Events מהסוגים האלה (בכפוף ל-Q-03).
R-05Constraint מסוג LimitIdleTimes על Staff, הסופר אירועים פרטניים ואירועי שהייה כזמן תפוס.
R-06Constraint על Staff מחנכים: ימים שמתחילים בשיעור 1 ≥ 3, רך.
R-07Constraint על Staff: ימים שמסתיימים בשיעור 7 = 2, רך.
R-08Constraint לכל Class לכל יום על ספירות Subject.
R-09, R-10שורות Availability.
R-11Event אחד לכל כיתה, משך 3, StaffSlot ששובץ מראש למחנך/ת, EventGroup מקושרת לכל שכבה, אילוץ המגביל את המשבצות לשיעורים 4 עד 6 ופורס את השכבות על פני ימים.
R-12כלל CurriculumLine.coTeaching המייצר Events עם משבצת lead ששובצה מראש למחנך/ת ומשבצת co ששובצה מראש ל-x, y או z, משך 2.
R-13CurriculumLine.weeklyPeriods.
R-14Constraint מסוג AvoidTimes על Subjects ליבה בשיעורים אחרונים, רך.
S-05שורות Availability עם סיבה "meeting", או Events מסוג meeting ללא StudentGroup.
S-06, S-07Events עם fixedAt מוגדר, כמה StudentGroups, StaffSlots ששובצו מראש.
S-08Events ללא StudentGroups כלל.

גבולות ושכבות

מודל הדומיין הוא חבילה אחת ללא תלויות. סביבו:

החלטות פתוחות