Recipe catalog / safety-incident-kind
Classify a safety event
What kind of safety event does report describe: a near miss, a first-aid injury, a medical-treatment injury, property damage, an environmental release, or an unsafe condition?
You need to sort free-text safety reports from workers, supervisors, or contractors into a fixed set of event kinds so each can be routed to the right investigation, form, or notification path.
Explore this recipe interactively ยท Source and implementation guide
Use safety-incident-kind in TypeScript
Install with npm install jev-recipes. Requires Node.js 22.9 or newer and ES modules. Set TYPESAFE_API_KEY in your server environment for live calls, which send input to TypeSafe and use API quota. See the installation guide.
import { safetyIncidentKind } from 'jev-recipes/safety-incident-kind';
const result = await safetyIncidentKind({
"report": "Warehouse B, 14:20. A forklift reversing out of aisle 7 came within about a metre of a contractor walking through the marked pedestrian crossing. The driver stopped when the spotter shouted. No contact, no injuries, nothing damaged. The contractor was not wearing a high-visibility vest and the mirror at the aisle end is missing.",
"minConfidence": 0.8
});
console.log(result);
Input contract
| Field | Type | Needed |
|---|---|---|
| report | string | Required |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"report": {
"type": "string"
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"report"
]
},
"result": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"model": {
"type": "string"
},
"usage": {
"type": "object",
"properties": {
"input_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"output_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"input_tokens",
"output_tokens"
],
"additionalProperties": false
},
"status": {
"type": "string",
"enum": [
"ready",
"review"
]
},
"verdict": {
"type": "string",
"enum": [
"near_miss",
"first_aid",
"medical_treatment",
"property_damage",
"environmental_release",
"unsafe_condition",
"unclear"
]
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"probabilities": {
"type": "object",
"propertyNames": {
"type": "string",
"enum": [
"near_miss",
"first_aid",
"medical_treatment",
"property_damage",
"environmental_release",
"unsafe_condition",
"unclear"
]
},
"additionalProperties": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"required": [
"near_miss",
"first_aid",
"medical_treatment",
"property_damage",
"environmental_release",
"unsafe_condition",
"unclear"
]
}
},
"required": [
"model",
"usage",
"status",
"verdict",
"confidence",
"probabilities"
],
"additionalProperties": false
}
}Saved example result
This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo safety-incident-kind.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"verdict": "near_miss",
"confidence": 0.87,
"probabilities": {
"near_miss": 0.87,
"first_aid": 0.01,
"medical_treatment": 0.01,
"property_damage": 0.01,
"environmental_release": 0.01,
"unsafe_condition": 0.07,
"unclear": 0.02
}
}
Evaluation evidence
No verified live accuracy measurement is available. Evaluate representative cases before using this decision in your workflow.
Use the evaluation guide to measure this decision on your own labeled cases.
Limitations
- Classifies what the report describes, not what happened. An understated report yields an understated kind.
- Does not decide recordability, reportability, or lost-time status under any regulation. Map kinds to your regulatory and notification rules in application code.
- A report describing several events is classified by the most consequential one; split multi-event reports in code when each matters.
Related recipes
- incident-severity-wording: Use incident-severity-wording to grade how severe an operational outage is, rather than what kind of workplace safety event occurred.
- failure-kind: Use failure-kind when the categories are caller-supplied rather than this fixed set of safety event kinds.