Recipe catalog / appointment-request-kind
Classify a patient's appointment request
What does the patient primarily want from message: to schedule, reschedule, or cancel an appointment, get results, get a refill, or ask a question?
You need to route incoming patient portal messages or voicemail transcripts to the scheduling, results, or pharmacy queue by the main thing the patient asks for.
Explore this recipe interactively ยท Source and implementation guide
Use appointment-request-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 { appointmentRequestKind } from 'jev-recipes/appointment-request-kind';
const result = await appointmentRequestKind({
"message": "Hi, I am scheduled with Dr. Nguyen on Thursday at 2pm but my work shift changed. Is there anything available Friday morning instead?",
"minConfidence": 0.8
});
console.log(result);
Input contract
| Field | Type | Needed |
|---|---|---|
| message | string | Required |
| minConfidence | number | Optional |
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"
]
},
"verdict": {
"type": "string",
"enum": [
"schedule",
"reschedule",
"cancel",
"results",
"refill",
"question",
"unclear"
]
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"probabilities": {
"type": "object",
"propertyNames": {
"type": "string",
"enum": [
"schedule",
"reschedule",
"cancel",
"results",
"refill",
"question",
"unclear"
]
},
"additionalProperties": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"required": [
"schedule",
"reschedule",
"cancel",
"results",
"refill",
"question",
"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 appointment-request-kind.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"verdict": "reschedule",
"confidence": 0.9,
"probabilities": {
"schedule": 0.05,
"reschedule": 0.9,
"cancel": 0.02,
"results": 0.01,
"refill": 0,
"question": 0.01,
"unclear": 0.01
}
}
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
- Returns the primary request only. A message that both cancels and asks a question gets one label; split multi-request messages in code.
- Does not verify that the referenced appointment, prescription, or test exists in your system or belongs to the sender.
Related recipes
- turn-intent: Use turn-intent for the general communicative purpose of a message outside the appointment domain.
- cancellation-check: Use cancellation-check when you only need to know whether a message cancels something.