Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleExample
Code Block
        {
            "id": "head-contact",
            "name": "Head Contact",
            "choices": [
                {
                    "id": "712a9d97-dc28-4f44-a9bc-f65f464243d2",
                    "durations": [
                        {
                            "id": "3b660054-13da-4a10-baae-3726b2b1d5b8",
                            "code": "7.6(a)",
                            "durationId": "minor"
                        }
                    ]
                },
                {
                    "id": "45bd6df7-85cd-4ab3-a1f3-dd19ca403772",
                    "durations": [
                        {
                            "id": "fc33dd8e-25ca-473b-ab0c-a88d30f109b6",
                            "code": "7.6(a)",
                            "durationId": "minor"
                        },
                        {
                            "id": "41a36d01-a5f1-4041-af78-105b177b9ff5",
                            "code": "7.6(a)",
                            "durationId": "minor"
                        }
                    ]
                },
                {
                    "id": "b81cffef-c35d-4a34-9fab-10f259a922d1",
                    "durations": [
                        {
                            "id": "f056be20-062c-4495-b36c-71a4290f5de2",
                            "code": "7.6(b)",
                            "durationId": "major"
                        },
                        {
                            "id": "00db3d81-87aa-4b71-b63c-44d61fb2e2cf",
                            "code": "7.6(e)",
                            "durationId": "game-misconduct"
                        }
                    ]
                },
                {
                    "id": "8f13e831-9718-44f9-b3b1-5d9e4979ef30",
                    "durations": [
                        {
                            "id": "177df463-3903-42b1-8b69-35970b1bab67",
                            "code": "7.6(c)",
                            "durationId": "match"
                        }
                    ]
                }
            ],
            "category": "07 Physical Fouls"
        },

  • 7.6 Head Contact
    Category: 07 Physical Fouls

    • Option 1

      • 7.6(a) Minor

    • Option 2

      • 7.6(a) Minor

      • 7.6(a) Minor

    • Option 3

      • 7.6(b) Major

      • 7.6(e) Game Misconduct

    • Option 3

      • 7.6(c) Match

7.6(a) is the infraction, Minor is the duration

...

Rule Models

Extracting the nested infractions of the rulebook into separate tables for simpler relations and querying.

Bit of a challenge coming up for the names of each part. Infractions have a Duration and belong to Rules which belong to Sections. Infractions are grouped as Options to require Major+GM or Double Minors to be selected togetherInfractions are categorized in the rulebook as rules. A rule (7.6 Head Contact) belongs to a section (7 Physical Fouls), has many infractions (7.6 (a) Head Contact - Minor) and has many options to apply those infractions (e.g., minor or double minor).

Options define how infractions are used by each office and what the scorekeeper can select. The part that combines double minors or majors and game misconducts as one and results in a time offset.

Purple requires i18n., gray are for backwards compatibility.

InfractionDuration

...

RuleSection

07 Physical Fouls

Property

Type

Description

id

uuid

officeId

id

Hockey Canada

name

string

Minor

description

string

abbreviation

string

length

number

Minutes

InfractionSection

07 Physical Fouls

Property

Type

Description

id

uuid

seasonId

id

2024-25

officeId

id

Hockey Canada

name

string

Physical Fouls

code

text

7

order

number

...

Rule

7.6 Head Contact

Property

Type

Description

id

uuid

seasonId

id

2024-25

officeId

id

Hockey Canada

name

string

Head Contact

code

string

7.6

sectionId

id

Physical Fouls

order

number

Infraction

...

RuleOption

This is a container that represents the options the scorekeeper can select.

This is very important when editing so you can make sure that double minors are deleted together or the GM is deleted together with the Major.

Also fun, HQ doesn’t combine majors and game misconducts, so this definitely needs to be configurable by branch.

Property

Type

Description

id

uuid

seasonId

id

2024-25

officeId

id

Hockey Canada

ruleId

id

7.6 Head Contact (07 Physical Fouls)

durationId

code

string

7.6 (b)

order

number

parentId

id

parentId

id

Minor

Allows overriding a parent

infraction

option by a lower office

externalId

order

uuid

For syncing with Spordle ID

legacyName

string

Used to set infraction on GamePenalty for limited backwards compatibility

legacyDuration

string

Used to set duration on GamePenalty for limited backwards compatibility

Behaviour Options

severity

enum

Low | Medium | High | Severe

requiresIncidentReport

boolean

isTimed

boolean

isServable

boolean

Infraction Option Models

Options define how infractions are used by each office and what the scorekeeper can select.

The part that combines double minors or majors and game misconducts as one and results in a time offset.

This is very important when editing so you can make sure that double minors are deleted together or the GM is deleted together with the Major.

Also fun, HQ doesn’t combine majors and game misconducts, so this definitely needs to be configurable by branch.

InfractionOption

...

number

RuleOptionMember

These are the effective infractions upon selecting the option. Order is significant and allows for sequencing penalties as consecutive (e.g., major = 0, GM = 1) or parallel (same order) for start times

Property

Type

Description

id

uuid

optionId

id

infractionId

id

7.6 (b)

No unique constraint to allow for double minors

order

number

Infraction Models

When creating a penalty, you’re presented with a list of rules and then select an option. That option then results in one or many penalties that are linked to an infraction.

InfractionDuration

Minor, Major, Match, Misconduct, Game Misconduct

Property

Type

Description

id

uuid

officeId

id

Hockey Canada

name

string

Minor

description

string

abbreviation

string

length

number

Minutes

Infraction

7.6(b) - Head Contact - Minor

Property

Type

Description

id

uuid

seasonId

id

2024-25

officeId

id

Hockey Canada

ruleId

id

7.6 Head Contact

(07 Physical Fouls)

durationId

id

Minor

code

string

7.6 (b)

order

number

parentId

id

Allows overriding a parent

option

infraction by a lower office

order

number

InfractionOptionMember

These are the effective infractions upon selecting the option. Order is significant and allows for sequencing penalties as consecutive (e.g., major = 0, GM = 1) or parallel (same order) for start times

...

Property

...

Type

...

Description

...

id

...

uuid

...

optionId

...

id

...

infractionId

...

id

...

7.6 (b)

No unique constraint to allow for double minors

...

order

...

number

...

externalId

uuid

For syncing with Spordle ID

legacyName

string

Used to set infraction on GamePenalty for limited backwards compatibility

legacyDuration

string

Used to set duration on GamePenalty for limited backwards compatibility

Behaviour Options

severity

enum

Low | Medium | High | Severe

requiresIncidentReport

boolean

isTimed

boolean

isServable

boolean

Accumulation Models

When creating a penalty, we need to check for accumulation rules to stack an additional infraction.

Typical examples are 3x Stick Infraction → Game Ejection or 2x Misconduct → Game Ejection.

InfractionAccumulation

This acts as a grouping that defines the count of the member infractions necessary and what the resulting infraction is.

Property

Type

Description

id

uuid

seasonId

id

2023-24

officeId

id

Hockey Canada

name

string

Stick Infractions

count

number

3

infractionId

id

Resulting infraction when accumulation reached

4.8 (b)

InfractionAccumulationMember

These are the list of infractions that are part of the accumulation group. Order is not significant; any member infraction counts towards the accumulation group.

...

Yellow are new properties, red are deprecated.

GamePenalty

Instances of an infraction in a game are called penalties. This is a scoresheet artifact.

Property

Type

Description

id

uuid

gameId

id

teamId

id

participantId

id

servedById

id

isInjured

boolean

Necessary for suspensions

Time

gameTime

GameTime

Time of infraction

startTime

GameTime

Time the penalty started to be served

endTime

GameTime

Time the penalty ceased to be served

isEnded

boolean

Whether or not the penalty was ended

Infraction

infractionId

id

durationId

id

Technically not really necessary since the durationId is part of the infraction above

optionId

id

Link penalties part of the same option group when creating instead of trying to reverse them as we currently do

accumulationId

id

Link penalties that were created by an accumulation rule

Legacy infraction options (deprecated)

infraction

string

Infraction “id” which is something like “head-contact” in the rulebook

duration

string

Duration “id” which is something like “minor” in the rulebook

code

string

Infraction “code”

Penalties are consisted linked if they have the same participantId, gameTime and optionId or have an accumulationId that matches.

...