5.1 Penalty End Date and Removal Date Calculation
This section explains how the Penalty End Date and Removal Date are calculated for penalties associated with driver offences. These dates are derived based on a penalty's configuration and the offence details.
5.1.1 Finding the offence or Conviction Date
Before calculating the End Date or Removal Date, we determine whether to use the offence Date or Conviction Date for the calculation. This depends on the penalty's configuration in lookup table and the driver's license status.
Process Overview
- Penalty Lookup: Find penalty details from the lookup table using the penalty code.
- Date Preference: Decide whether to use the offence Date or Conviction Date:
- If the penalty specifies a special rule for disqualified licenses and the license status is disqualified, use the Conviction Date.
- Otherwise, fall back on the default preference (
Conviction Date
oroffence Date
).
- Output: Use the selected date as the base date for further calculations.
Mermaid Diagram for Finding offence or Conviction Date
5.1.2 End Date Calculation
The End Date is the date after which the penalty is no longer applicable. This is determined as follows:
Process Overview
- Penalty Lookup: Check if the penalty exists in lookup table. If not, the End Date is
null
. - Check Disqualification: If the driver is pending disqualification, the End Date is also
null
. - Date Calculation: Add the penalty's
endPeriod
(number of years) to the offence or Conviction Date. - Output: The resulting date is the penalty's End Date.
Mermaid Diagram for End Date Calculation
5.1.3 Removal Date Calculation
The Removal Date is when the penalty record is removed from the system. It is calculated as follows:
Process Overview
- Penalty Lookup: If the penalty doesn't exist in the lookup table, the Removal Date is
null
. - Date Calculation: Add the penalty's
period
(number of years) to the offence or Conviction Date. - Output: The resulting date is the Removal Date.
Mermaid Diagram for Removal Date Calculation
Key Terms and Variables Explained
Lookup Table:
- A table containing penalty configuration for different offence codes.
- Is present in firestore at this path:
/config/lookUp/licensePenalty/codes
Penalty:
- A rule associated with a offence code.
- Found in a lookup table using the offence code.
- Contains:
endPeriod
: Number of years to calculate the End Date.period
: Number of years to calculate the Removal Date.overrideCalculationType
: Rules for prioritizing Conviction Date or offence Date.
offence Date:
- The date when the offence occurred.
Conviction Date:
- The date when the driver was convicted for the offence.
offence or Conviction Date:
- The base date for calculating penalty-end date and penalty-removal date. Derived based on rules from the penalty.
Example Walkthrough
Given:
- Penalty Code:
CD40
- offence Date:
2020-01-01
- Conviction Date:
2021-01-01
- Penalty Data:
endPeriod
:10 years
period
:11 years
overrideCalculationType
: Use offence Date if Disqualified
- License Status: Disqualified
Steps:
- Find penalty data for
CD40
in the lookup. - Check
overrideCalculationType
:- If the license is disqualified, use offence Date.
- Else, use Conviction Date.
- Calculate End Date: Add
10 years
to the selected date. - Calculate Removal Date: Add
11 years
to the selected date.
Result:
- End Date:
2030-01-01
- Removal Date:
2031-01-01
Status: Draft (Pending Review)
Category: Protected
Authored By: Sohan on Jan 15, 2025