Skip to main content

Writing schemas with AI

warning

RehabAlpha is still under active development. It is not yet HIPAA compliant and should only be used with dummy data.

AI tools such as ChatGPT, Gemini, and Claude can be very effective for drafting RehabAlpha schemas.

In many cases, using AI is the fastest way to go from a vague idea like:

  • “I need a PT evaluation template”
  • “I want a falls section”
  • “I need a Medicare-focused SNF template”

to a usable first draft.


Example prompt

Here is a simple starting prompt:

Review the documentation for RehabAlpha schemas at the following URLs:

1. https://docs.rehabalpha.com/guides/schemas/
2. https://docs.rehabalpha.com/guides/schemas/writing-your-own-schema


TASK:

Create a RehabAlpha evaluation schema for outpatient physical therapy. The clinician needs to document chief complaint, history, pain, knee range of motion, gait, assessment, and plan. Keep it clean and beginner-friendly.


REQUIREMENTS:

- Prevent broken references
- Prevent duplicate or inconsistent naming
- Prevent overcomplicated conditional logic
- Prefer reusable options nodes
- Prefer structured option values
- Keep the schema beginner-friendly
- Avoid deeply nested conditionals
- Keep the template focused and not overly long
- Do not use inline child objects unless necessary
- Optimize for readability over cleverness
- Use clear IDs with consistent naming
- Keep node IDs 100 characters or fewer and use only letters, numbers, underscores, and dashes
- Keep labels, tooltips, descriptions, and placeholders 256 characters or fewer
- A text node value may be a static string or a dynamic segment array; do not use template literals or Python-style f-strings
- To display a current-form input or prior value as read-only text, use exactly value: ['Literal text', { reference: 'input_or_reference_node_id', missingText: 'Optional replacement' }]
- Keep dynamic text arrays between 1 and 64 segments, include at least one reference segment, and use only literal strings or strict { reference, missingText? } objects
- Each dynamic text reference must identify an existing custom-schema input node or top-level temporal reference node; built-in form field paths and special variables are not valid segment references
- A current-form input referenced by dynamic text must be reachable from every template that can render that text; the same input or temporal reference may be repeated
- Keep static text values, or the combined literal and missingText content in dynamic text values, 1024 characters or fewer
- Treat dynamic text as escaped plain text; do not use expressions, HTML, or Markdown
- Remember that dynamic text renders only in create and edit forms, not saved detail pages, PDFs, or signed output
- Case templates may use live current-form input references in dynamic text, but they cannot use temporal reference nodes
- Keep option labels and option values 256 characters or fewer
- Keep each options node to 256 items or fewer
- Keep nesting depth under 16 levels, and prefer much shallower nesting when possible
- Knee ROM should include right and left flexion and extension as number inputs
- Include a yes/no pain question
- If pain is present, show pain location and pain level
- Use only supported RehabAlpha node types and properties
- Use only these special context variables in conditions: *disciplineId, *payorId, *payorType, *paymentModelType, *placeOfServiceId, and *templateType
- Use *disciplineId, not *discipline; valid values are OT, PT, and SLP
- Valid *payorType values are Commercial Insurance, Managed Care Part A, Managed Care Part B, Medicaid, Medicare Part A, Medicare Part B, Private Pay, and Workers' Compensation
- Valid *paymentModelType values are customFeeSchedule, durationBasedPayment, medicarePartBMPFS, and pdpmCaseMixPerDiem
- Treat *payorId, *payorType, and *paymentModelType as one assignment-time billing-episode snapshot; all three are null when no episode matches the effective discipline and date, and later payor edits or deletion do not change an existing episode's values
- Valid *placeOfServiceId values are POS codes: 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 31, 32, 33, 34, 41, 42, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 65, 66, 71, 72, 81, and 99
- Valid *templateType values are case, discharge, evaluation, progressReport, reevaluation, and treatment
- Match all special variable values exactly, including capitalization and spaces
- Set a literal input default with exactly defaultValue: literalValue
- To read a prior value, define exactly { id, type: 'reference', field: string, documentTypes: Array<'evaluation' | 'treatment' | 'progressReport' | 'reevaluation' | 'discharge'>, select: 'first' | 'previous' | 'latestNonEmpty', fallback?: literalValue }
- Each documentTypes value must be unique; list all five types to search any prior clinical document, or use an empty array to match no documents
- To use that value as an input default, set exactly defaultReference: 'reference_node_id' on the input
- Never combine defaultValue and defaultReference, and never use default, defaultFrom, or a nested reference.from object
- A reference field must identify an existing input, not another reference; a defaultReference source must have exactly the same input type as its destination
- A reference fallback must be a valid literal default for its source input; a select fallback cannot be an empty string and a multi-select fallback cannot be an empty array
- The same temporal reference ID may be used by defaultReference, a dynamic text reference segment, and as the field in showIf, conditional, switch, or multiSwitch conditions
- Keep reference nodes top-level, never place them in a child list, and use them only with clinical-document templates, never case templates


OUTPUT:

Return only the schema as a block of code in JSON5 format with no explanation.
Tip

Use the most powerful, longest thinking AI model you can get your hands on.


Prompt for a live goal summary

Add this task to your prompt when a form should summarize fixed, schema-defined goals as the clinician enters them:

Create make_walking_goal as a checkboxInput. Create walking_goal_description as a textInput, walking_goal_value as a numberInput, and walking_goal_date as a dateInput. Show those three inputs only when make_walking_goal is true.

Place all four inputs and goal_summary on the same evaluation template. Create goal_summary as a list with this inline text child:

{
id: 'walking_goal_summary',
type: 'text',
showIf: { field: 'make_walking_goal', equals: true },
value: [
{ reference: 'walking_goal_description' },
' · Target ',
{ reference: 'walking_goal_value' },
' by ',
{ reference: 'walking_goal_date' },
],
}

Do not create prior-document reference nodes for this summary. These dynamic text segments read the current form inputs live. For additional fixed goals, add one conditional text child per goal; do not invent a repeatable-list or interpolation API.

Live input segments update immediately while the clinician edits the form. They use the rehydrated input values when a saved document is reopened. They do not persist extra summary data.


Prompt for read-only goal targets

Add this task to your prompt when a treatment should display, but not edit, goal targets entered on an evaluation:

Create goal_target_date as a dateInput and goal_target_value as a numberInput on the evaluation template.

Create top-level reference nodes for both fields. Limit each reference to evaluation documents and use select: 'first'.

On the treatment template, add a text node with exactly this structured value:

value: [
'Evaluation goal: ',
{ reference: 'prior_goal_target_value', missingText: 'No target value' },
' by ',
{ reference: 'prior_goal_target_date', missingText: 'no target date' },
'.',
]

Do not add editable target-date or target-value inputs to the treatment template.

RehabAlpha formats current-form and temporal values the same way: dates as M/d/yyyy, times as h:mm a, booleans as Yes or No, and select values with their authored labels. It displays null and empty arrays as None, empty strings as , and arrays as comma-separated values. A reference with no available value uses missingText or displays ; a temporal reference fallback is a resolved value and uses the normal formatting rules.


Try it

Copy the example prompts above into your preferred AI tool and see what it produces.