ores.refdata.calendar_rule
Table of Contents
One row per indefinite, timeless recurring holiday rule for a
base-less calendar
template – the QuantLib-transcribed calendars and any base-less
user-authored template alike. Mirrors
ores::analytics::quant::domain::calendar_rule plus the usual
refdata plumbing; a calendar's full rule set is the batch input to
that pure engine at materialisation time (see the parent task's
* Revision section for the two-stage rule/materialisation design).
One-off irregular dates (jubilees, special closings) are not
modelled here – they belong in
calendar_exception instead, so a rule
stays a timeless, indefinitely-repeating pattern.
Flags
:seed_country_sentinel:: the eventing integration test seeds a
synthetic calendar (always country_code ZZ) as this entity's
calendar_code parent, and the calendars insert trigger validates
country_code against the countries table for the write tenant – the
test must seed the ZZ sentinel country before the calendar insert (see
refdata_calendars_create.sql's country_code_validation paste
block).
Columns
id
UUID uniquely identifying this rule row.
Surrogate key – a calendar can have many rules, so there is no single natural key column.
calendar_code
The calendar this rule belongs to.
References ores_refdata_calendars_tbl.code (soft FK) – only
meaningful for base-less calendars (calendar.base_calendar_code is
null).
std::string("TARGET")
kind
Which of the four rule shapes this row is.
Soft-enum: fixed_date | nth_weekday_of_month |
last_weekday_of_month | easter_offset, matching
ores::analytics::quant::domain::calendar_rule_kind exactly, mapped
1:1 at the refdata/quant boundary.
std::string("fixed_date")
month
Month number (1-12), for fixed_date, nth_weekday_of_month, and
last_weekday_of_month rules.
Null for easter_offset rules, whose month varies by year.
12
day
Day of month (1-31), for fixed_date rules only.
Null for every other rule kind.
25
weekday
Weekday (0=Sunday..6=Saturday, std::chrono::weekday's c_encoding), for
nth_weekday_of_month and last_weekday_of_month rules.
Null for fixed_date and easter_offset rules.
1
occurrence
Which occurrence of the weekday in the month (1-4), for
nth_weekday_of_month rules only.
Null for every other rule kind (last_weekday_of_month always means
the last one, no count needed).
3
day_offset
Signed day offset from Easter Sunday, for easter_offset rules only
(e.g. -2 = Good Friday, +1 = Easter Monday).
Null for every other rule kind.
std::nullopt
shift
How this holiday is re-observed when it falls on a weekend, if at all.
Soft-enum: none | nearest_weekday | roll_forward_to_monday,
matching ores::analytics::quant::domain::observance_shift.
std::string("none")
effective_from
First year this rule is active (inclusive).
Null means active for every year up to effective_to (or
indefinitely, if that is also null).
std::nullopt
effective_to
Last year this rule is active (inclusive).
Null means active for every year from effective_from (or
indefinitely, if that is also null).
std::nullopt
SQL
Flags
Foreign keys
calendar_code
Insert trigger
Validations
| column | validation_function |
C++
Flags
Repository
Domain includes
#include <boost/uuid/uuid.hpp> #include <chrono> #include <optional> #include <string>
Entity includes
#include <optional> #include <string> #include "sqlgen/Timestamp.hpp" #include "sqlgen/PrimaryKey.hpp"
Conventions
Qt
Detail fields
| field | label | widget | type | is_key | is_required | immutable | placeholder | combo_fetch_fn | combo_fetch_include | combo_allow_blank | combo_domain_type | combo_display_field | combo_code_field | combo_tooltip_field | combo_sort_field | combo_watcher_name | combo_label | spin_min |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | Id | idEdit | line_edit | true | true | Calendar rule id | ||||||||||||
| calendar_code | Calendar | calendarCombo | dynamic_combo | true | true | fetch_calendars | ores.qt/LookupFetcher.hpp | refdata::domain::calendar | name | code | code | version | calendarRuleCalendarWatcher | calendars | ||||
| kind | Kind | kindEdit | line_edit | true | fixed_date/nth_weekday_of_month/last_weekday_of_month/easter_offset | |||||||||||||
| month | Month | monthSpin | spin_box | |||||||||||||||
| day | Day | daySpin | spin_box | |||||||||||||||
| weekday | Weekday | weekdaySpin | spin_box | |||||||||||||||
| occurrence | Occurrence | occurrenceSpin | spin_box | |||||||||||||||
| day_offset | Day Offset | dayOffsetSpin | spin_box | -9999 | ||||||||||||||
| shift | Shift | shiftEdit | line_edit | true | none/nearest_weekday/roll_forward_to_monday | |||||||||||||
| effective_from | Eff. From | effectiveFromSpin | spin_box | |||||||||||||||
| effective_to | Eff. To | effectiveToSpin | spin_box |
Columns (Qt model)
| enum_name | field | header | type | width | hidden_by_default |
|---|---|---|---|---|---|
| CalendarCode | calendar_code | Calendar | string | 100 | |
| Kind | kind | Kind | string | 140 | |
| Month | month | Month | int | 70 | true |
| Day | day | Day | int | 60 | true |
| Weekday | weekday | Weekday | int | 70 | true |
| Occurrence | occurrence | Occurrence | int | 90 | true |
| DayOffset | day_offset | Day Offset | int | 90 | true |
| Shift | shift | Shift | string | 140 | |
| EffectiveFrom | effective_from | From | int | 70 | |
| EffectiveTo | effective_to | To | int | 70 | |
| Version | version | Version | int | 70 | |
| ModifiedBy | modified_by | Modified By | string | auto |
Table display
| column | header |
|---|---|
| calendar_code | Calendar |
| kind | Kind |
| month | Month |
| day | Day |
| shift | Shift |
| effective_from | From |
| effective_to | To |
| modified_by | Modified By |
| version | Version |
See also
- ores.refdata — component group overview.
- ores.refdata.calendar — the parent calendar template this rule belongs to.
- Materialise QuantLib calendar holidays and support calendar adjustments — parent task.