Skip to Content
ToolsEmergency care routing

Emergency care routing

ctx.HEALTH_CALCULATOR.emergencyRouting returns the emergency, crisis, and safety lines for a country. The numbers come from code, not the model.

Input

FieldTypeWhat it means
concern"medical_emergency" | "self_harm" | "personal_safety" | "mental_health_support" | "substance_use_support"What the person needs help with.
countrystringOptional. The country’s name, for example "South Africa".

Returns

{ country: "South Africa", emergency: "112 from a mobile, or 10177 for an ambulance", mentalHealth: "SADAG Suicide Crisis Line: 0800 567 567. SADAG 24-hour support: 0800 12 13 14. SMS: 31393.", personalSafety: "Police emergency response: 10111.", source: "South African government/SADAG public crisis resources; verify locally when possible.", }

nonEmergency is set where there is one, such as NHS 111 in the United Kingdom.

Use it

import { workflow } from "@loops/sdk"; type Concern = { country?: string }; export const emergencyWorkflow = workflow<Concern>({ id: "emergency-lines", execute: async ({ step, event }) => step.do("Look up emergency numbers", ({ ctx }) => ctx.HEALTH_CALCULATOR.emergencyRouting({ country: event.body.country, concern: "medical_emergency", }), ), });

Pair it with symptom red flags and route only when a flag fires.

What it won’t invent

Country numbers are given for South Africa, the United Kingdom, Ireland, the United Arab Emirates, and Saudi Arabia. Everywhere else it says to call the local emergency number and points to findahelpline.com for crisis lines.

Last updated on