- Implemented Form301 component for displaying OSHA Form 301 equivalent, including employee and case information. - Created Osha component to manage OSHA recordkeeping, including tabs for 300 Log, 300A Summary, Hours & rates, and Submit to OSHA. - Added functionality for printing and downloading CSV files for OSHA submissions. - Integrated loading and error handling states for data fetching.
48 lines
2.3 KiB
TypeScript
48 lines
2.3 KiB
TypeScript
// Domain vocabularies shared by the server (database enums, validation) and the web app.
|
||
|
||
/** Ordered from least to most privileged. */
|
||
export const roles = ['reporter', 'supervisor', 'safety_manager', 'admin'] as const
|
||
export type Role = (typeof roles)[number]
|
||
|
||
export function hasRole(role: Role, minimum: Role): boolean {
|
||
return roles.indexOf(role) >= roles.indexOf(minimum)
|
||
}
|
||
|
||
export const incidentTypes = ['near_miss', 'hazard', 'injury', 'illness', 'property_damage', 'environmental'] as const
|
||
export type IncidentType = (typeof incidentTypes)[number]
|
||
|
||
export const severities = ['low', 'medium', 'high', 'critical'] as const
|
||
export type Severity = (typeof severities)[number]
|
||
|
||
/** Workflow: Reported → Triage → Investigation → Corrective actions → Verification → Closed. */
|
||
export const incidentStatuses = ['reported', 'triage', 'investigation', 'actions', 'verification', 'closed'] as const
|
||
export type IncidentStatus = (typeof incidentStatuses)[number]
|
||
|
||
export const areaKinds = ['building', 'area', 'line', 'other'] as const
|
||
export type AreaKind = (typeof areaKinds)[number]
|
||
|
||
export const employmentTypes = ['employee', 'temporary', 'contractor', 'visitor'] as const
|
||
|
||
export const treatmentLevels = ['none', 'first_aid', 'medical_treatment', 'hospitalized', 'fatality'] as const
|
||
|
||
export const rcaMethods = ['five_whys', 'fishbone', 'other'] as const
|
||
|
||
/** Fishbone (6M) categories. */
|
||
export const rootCauseCategories = ['people', 'process', 'equipment', 'materials', 'environment', 'management'] as const
|
||
|
||
export const actionKinds = ['corrective', 'preventive'] as const
|
||
|
||
export const actionStatuses = ['open', 'in_progress', 'done', 'verified', 'cancelled'] as const
|
||
|
||
/** Form 300 column M: injury or illness type. */
|
||
export const oshaCaseTypes = ['injury', 'skin_disorder', 'respiratory', 'poisoning', 'hearing_loss', 'other_illness'] as const
|
||
export type OshaCaseType = (typeof oshaCaseTypes)[number]
|
||
|
||
/** Form 300 columns G–J, most serious first. */
|
||
export const oshaOutcomes = ['death', 'days_away', 'restricted', 'other'] as const
|
||
export type OshaOutcome = (typeof oshaOutcomes)[number]
|
||
|
||
/** Cases recordable under 1904.8–1904.11 regardless of the general criteria. */
|
||
export const oshaSpecialCases = ['none', 'needlestick', 'medical_removal', 'hearing_loss', 'tuberculosis'] as const
|
||
export type OshaSpecialCase = (typeof oshaSpecialCases)[number]
|