jevrecipes

Recipe catalog / instruction-readability

Grade how easy patient instructions are to follow

How easy are instructions to follow for a general reader, from dense jargon to plain and stepwise?

You are generating or reviewing after-visit instructions, discharge notes, or medication directions and need to catch wording a patient cannot act on.

Explore this recipe interactively ยท Source and implementation guide

Use instruction-readability 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 { instructionReadability } from 'jev-recipes/instruction-readability';

const result = await instructionReadability({
  "instructions": "Administer 500 mg PO BID with food x 10 days. Do not discontinue prematurely. If a dose is missed, take it as soon as possible unless the next dose is imminent. Contact the clinic for any rash or swelling.",
  "audience": "Adult patient with no medical background, reading the after-visit summary at home.",
  "minConfidence": 0.8
});
console.log(result);

Input contract

FieldTypeNeeded
instructionsstringRequired
audiencestringOptional
minConfidencenumberOptional
Full input and result schemas
{
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "instructions": {
        "type": "string"
      },
      "audience": {
        "type": "string"
      },
      "minConfidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "required": [
      "instructions"
    ]
  },
  "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
        }
      },
      "readability": {
        "type": "string",
        "enum": [
          "dense",
          "heavy",
          "mixed",
          "plain",
          "clear"
        ]
      }
    },
    "required": [
      "model",
      "usage",
      "status",
      "score",
      "level",
      "confidence",
      "probabilities",
      "readability"
    ],
    "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 instruction-readability.

{
  "model": "demo-fixture",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0
  },
  "status": "ready",
  "score": 1.14,
  "level": 1,
  "confidence": 0.82,
  "probabilities": {
    "0": 0.04,
    "1": 0.82,
    "2": 0.11,
    "3": 0.02,
    "4": 0.01
  },
  "readability": "heavy"
}

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