jevrecipes

Recipe catalog / care-urgency-wording

Grade the urgency a patient's wording asks for

How urgent is the care that message asks for, from routine to emergency, judged on what the patient's wording says rather than on medical assessment?

You need to sort patient messages into scheduling or response-time queues by the timeline the patient asks for, before or alongside clinical triage handled by protocol.

Explore this recipe interactively ยท Source and implementation guide

Use care-urgency-wording 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 { careUrgencyWording } from 'jev-recipes/care-urgency-wording';

const result = await careUrgencyWording({
  "message": "My daughter has had a fever of 101 since last night and now she says her ear really hurts. She is drinking fine and otherwise seems okay. Can someone see her today or tomorrow? I do not think it is an emergency, but I would rather not wait until next week.",
  "minConfidence": 0.8
});
console.log(result);

Input contract

FieldTypeNeeded
messagestringRequired
minConfidencenumberOptional
Full input and result schemas
{
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "message": {
        "type": "string"
      },
      "minConfidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "required": [
      "message"
    ]
  },
  "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"
        ]
      },
      "score": {
        "type": "number",
        "minimum": 0
      },
      "level": {
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991
      },
      "confidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "probabilities": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        }
      },
      "urgency": {
        "type": "string",
        "enum": [
          "routine",
          "soon",
          "prompt",
          "urgent",
          "emergency"
        ]
      }
    },
    "required": [
      "model",
      "usage",
      "status",
      "score",
      "level",
      "confidence",
      "probabilities",
      "urgency"
    ],
    "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 care-urgency-wording.

{
  "model": "demo-fixture",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0
  },
  "status": "ready",
  "score": 2.02,
  "level": 2,
  "confidence": 0.82,
  "probabilities": {
    "0": 0.02,
    "1": 0.06,
    "2": 0.82,
    "3": 0.08,
    "4": 0.02
  },
  "urgency": "prompt"
}

Evaluation evidence

Fixture only

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

Related recipes