50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
export type DoshObligation = {
|
|
requires_jkkp6: boolean
|
|
requires_jkkp7: boolean
|
|
requires_jkkp8: boolean
|
|
requires_immediate_notification: boolean
|
|
reasons: string[]
|
|
}
|
|
|
|
export function computeDoshObligation(incident: {
|
|
is_fatality: boolean
|
|
is_serious_bodily_injury: boolean
|
|
is_dangerous_occurrence: boolean
|
|
is_occupational_disease: boolean
|
|
lost_days: number | null
|
|
}): DoshObligation {
|
|
const reasons: string[] = []
|
|
let requires_jkkp6 = false
|
|
let requires_jkkp7 = false
|
|
let requires_jkkp8 = false
|
|
let requires_immediate_notification = false
|
|
|
|
if (incident.is_fatality) {
|
|
reasons.push('Fatality — NADOPOD 2004 s.9(1)(a)')
|
|
requires_jkkp6 = true
|
|
requires_jkkp7 = true
|
|
requires_immediate_notification = true
|
|
}
|
|
if (incident.is_serious_bodily_injury) {
|
|
reasons.push('Serious bodily injury — NADOPOD 2004 s.9(1)(b)')
|
|
requires_jkkp6 = true
|
|
requires_jkkp7 = true
|
|
}
|
|
if (incident.is_dangerous_occurrence) {
|
|
reasons.push('Dangerous occurrence — NADOPOD 2004 s.9(1)(c)')
|
|
requires_jkkp6 = true
|
|
requires_jkkp7 = true
|
|
}
|
|
if ((incident.lost_days ?? 0) >= 4) {
|
|
reasons.push('Lost-time injury ≥4 days — NADOPOD 2004 s.9(1)(d)')
|
|
requires_jkkp6 = true
|
|
requires_jkkp7 = true
|
|
}
|
|
if (incident.is_occupational_disease) {
|
|
reasons.push('Occupational disease — NADOPOD 2004 s.11')
|
|
requires_jkkp8 = true
|
|
}
|
|
|
|
return { requires_jkkp6, requires_jkkp7, requires_jkkp8, requires_immediate_notification, reasons }
|
|
}
|