AI for Mental & Behavioral Health Clinicians
Capable · M18 · lesson 18 of 24 · queued
Preview — browse every lesson free. Enroll to mark lessons complete, open partner links and save your progress. Login & enroll →
Structured Output for EHR Paste-Back
📖
now learning

Structured Output for EHR Paste-Back

15 min

The AI draft is correct, in Maria's voice, every fact sourced. Then comes the part nobody trained her for: getting it into SimplePractice. The model returned one flowing narrative; her EHR template wants seven separate fields. So at 10:15 PM she is slicing a paragraph apart by hand, and on Tuesday she pastes the Assessment into the Plan field, on Thursday the minutes land in the wrong client's note still sitting open in another tab, and once, memorably, the second half of a sentence simply disappears between copy and paste. Copy-paste is the last unautomated step in her workflow, and it is the step where transcription errors are born. This lesson teaches structured output: prompting the AI to return the note as labeled blocks or JSON that map one-to-one onto your EHR's progress note template, so paste-back becomes a mechanical field-for-field transfer with nothing to slice and nothing to lose. You will build the labeled-block output schema for your own EHR, see how it adapts to SimplePractice, TherapyNotes, and Valant templates, and finish with a saved AI note EHR template schema that turns ten minutes of error-prone surgery into ninety seconds of verified pasting.

The Last Mile: Where Good Drafts Become Bad Records

Think of the AI draft as a perfectly packed moving truck and your EHR as the house. Everything you own arrived intact; now it has to get into the right rooms. Unstructured output hands you the truck's contents as one undifferentiated pile on the lawn, and you carry items in one armload at a time, at night, tired. The errors that happen at this stage are not clinical errors and not model errors; they are transfer errors, and they are uniquely embarrassing because every upstream step worked. A payer reviewer does not care that the Assessment language was excellent if it appears in the Plan field. A board investigator does not care that the model drafted accurately if the signed note is missing the second half of the risk paragraph because a paste truncated.

Transfer errors in EHR paste-back cluster into four types. Field misplacement: content lands in the wrong section, Subjective material in Objective, Assessment in Plan, which in a structured review reads as a clinician who does not know what the sections mean. Truncation: partial selection or a clipboard hiccup drops words, often at the end of a section, which is statistically where plans, follow-ups, and safety language live. Cross-chart contamination: the most dangerous one, content pasted into the wrong client's open note, a HIPAA incident and a clinical record error in a single keystroke. Format mangling: rich-text artifacts, stray markdown symbols, or collapsed line breaks that make the note look machine-generated, which invites exactly the scrutiny you do not want. Every one of these shrinks when the output arrives pre-sliced into the exact fields the EHR template expects, because the unit of transfer stops being "a paragraph I must interpret" and becomes "a labeled block I match to a labeled field."

Labeled Blocks or JSON: Choosing Your Container

Structured output comes in two practical containers. The first is the labeled-block format: plain text with unambiguous section markers, each block corresponding to one EHR field. It is human-readable, pastes cleanly, and works in every tool with zero technical setup, which makes it the default recommendation for clinicians pasting by hand. The second is JSON (JavaScript Object Notation): machine-readable key-value pairs like "subjective": "Client reported...". JSON matters when something automated sits between the model and the EHR, a practice-built script, an integration, an EHR vendor's import function, because software can parse JSON reliably while it cannot reliably parse prose. The decision rule is simple: human pastes, labeled blocks; software pastes, JSON. Most solo and small-practice clinicians live in labeled blocks; group practices with technical staff or EHR integrations graduate to JSON, and the underlying schema, the list of fields and the rules for each, is identical in both containers, so nothing is wasted by starting simple.

One warning either way: structure is about transfer, not truth. A beautifully structured note can still contain a hallucinated quote, and a structured field is, if anything, easier to skim-and-sign than a paragraph because it looks finished. The structured output instruction rides on top of the system prompt's never-invent rules and the next lesson's anti-hallucination suffix; it replaces none of them. Your line-by-line read before signing survives every formatting improvement in this chapter, because the signature is a legal attestation, not a formatting step.

The Labeled-Block Output Schema, In Full

Here is the instruction block you append to your prompt stack (system prompt, then few-shot examples, then this). It defines the contract between the model's output and your EHR's fields:

"Return the note in exactly the following labeled blocks, in this order, with each label on its own line in capitals between double colons. Do not add, remove, rename, or reorder blocks. Do not use markdown, bullets, or any formatting inside blocks: plain sentences only. If the information for a block was not provided, write [MISSING: block name] as that block's entire content.

::SESSION INFO:: date of service; start time; stop time; total minutes; CPT code; modality (in person / telehealth); diagnosis code as provided.
::SUBJECTIVE:: client's report in clinical language; direct quotes only if supplied verbatim.
::OBJECTIVE:: clinician's stated observations: presentation, affect, mental status, engagement.
::ASSESSMENT:: clinician's stated clinical assessment; progress toward the named treatment plan goal; medical-necessity linkage of symptoms, diagnosis, and intervention.
::RISK:: the clinician's stated risk assessment and actions, verbatim in substance; if risk content appears in the input without a clinician-stated assessment, this block must read [RISK CONTENT PRESENT: clinician assessment required] and nothing else.
::PLAN:: next steps, frequency, homework, referrals, as stated.
::MEASURES:: instrument names and scores exactly as provided (e.g., PHQ-9: 11); never estimated."

Read the design choices. The double-colon labels are deliberately ugly: nothing in clinical prose looks like ::ASSESSMENT::, so your eyes (or a script) can find boundaries instantly and a label can never be mistaken for content. The "do not add, remove, rename, or reorder" sentence prevents the model's helpful instinct to invent a ::INTERVENTIONS:: block your EHR has no field for. The no-markdown rule exists because EHR text fields render asterisks and pound signs literally, and a note full of bold markers announces "machine wrote this, human skimmed it." The [MISSING] convention carries forward from your system prompt: an empty block is ambiguous (did the model forget, or was nothing provided?), while [MISSING: total minutes] is an unambiguous work order. And the ::RISK:: block imports the hard rule unchanged: the model formats the clinician's stated assessment or it flags and stops; it never characterizes risk on its own.

Structure is about transfer, not truth. A labeled block can carry a hallucination as neatly as a fact, which is why the paste-back schema rides on top of the never-invent rules and never replaces the line-by-line read.

Mapping the Schema to SimplePractice, TherapyNotes, and Valant

The schema is yours; the field names are the EHR's, and the playbook's instruction is to test the mapping against your actual template, not the vendor's screenshots. In SimplePractice, a typical psychotherapy progress note template presents appointment details (date, time, and CPT code often pre-populated from the calendar and billing setup) plus free-text sections that many practices configure as SOAP or DAP. Your mapping: ::SESSION INFO:: is mostly verification rather than pasting, confirm the pre-populated time and code match what you supplied the model; ::SUBJECTIVE:: through ::PLAN:: paste into their corresponding sections; ::RISK:: goes wherever your template documents risk (many practices add a dedicated risk/safety section; if yours folds it into Assessment, paste it there, but keep it a distinct paragraph so it is findable in review); ::MEASURES:: maps to SimplePractice's measurement tools if you use them, or into Objective/Assessment text if you do not.

In TherapyNotes, the psychotherapy progress note is more granular and more structured: discrete fields for diagnosis, the treatment-plan objectives worked on, interventions, and content, plus a mental status section and a distinct risk area. Granularity is your friend here, but it means your schema may need a small fork: a TherapyNotes version of the instruction that splits ::ASSESSMENT:: into "progress toward objectives" and "clinical assessment" blocks matching the template's separation, and that emits a ::MENTAL STATUS:: block if your input includes the MSE observations TherapyNotes expects. In Valant, built for behavioral health group practices and heavier on structured clinical content and integrated outcome measures, the same logic applies with more fields: map ::MEASURES:: to Valant's measure entry rather than narrative text, and let the narrative blocks fill the documentation sections your group has standardized. The meta-rule across all three: open your real template, list its fields top to bottom in a two-column table (EHR field | schema block), adjust the schema until every EHR field has exactly one source block, and save that table with the schema. Where the EHR pre-populates a field (date, CPT from the calendar), your block becomes a cross-check, which is its own quiet error-catcher: when ::SESSION INFO:: says 53 minutes and the calendar says 45, something upstream needs your attention before, not after, the claim goes out.

The Ninety-Second Paste-Back Procedure

Structure only pays off if the transfer itself is disciplined, so here is the procedure as a habit loop. Step zero, one chart open. The cross-chart contamination error requires two open charts; the cheapest defense is a rule that only the client you are documenting is open during paste-back. Step one, verify the header. Read ::SESSION INFO:: against the EHR's pre-populated date, time, and code before pasting anything; mismatches here are billing problems caught for free. Step two, paste in template order. Top field to bottom field, one block per field, using paste-without-formatting (Ctrl+Shift+V or Cmd+Shift+V) so rich-text artifacts never enter the record. Step three, the ends check. Truncation eats endings, so after each paste glance at the last sentence of the block in the EHR and confirm it matches the last sentence in the draft. Step four, the [MISSING] sweep. Search the pasted note for the bracket character; every [MISSING] flag is a work order you resolve from memory or your session shorthand before signing, and a note signed with a [MISSING] flag still in it is a note you did not read. Step five, the line-by-line read and signature, which no step in this chapter has removed or ever will.

Practiced for a week, this runs in about ninety seconds per note. Multiply the eight minutes saved per note across Maria's eight clients and the structured schema returns roughly an hour a night, but the more important return is the error profile: field misplacement becomes nearly impossible (blocks are labeled), truncation gets caught at step three, contamination is blocked at step zero, and mangling dies with paste-without-formatting. The procedure is also teachable, which matters the moment you supervise anyone: Carmen can learn this in one sitting, and her supervisor can audit it by watching one paste-back rather than by proofreading every note from scratch.

The JSON Variant for Group Practices and Integrations

When Jordan's practice standardizes documentation across 25 clinicians, or when an EHR exposes an import pathway, the labeled blocks become JSON keys: {"session_info": {"date": "...", "start": "...", "stop": "...", "minutes": 53, "cpt": "90837", "modality": "telehealth", "dx": "F43.10"}, "subjective": "...", "objective": "...", "assessment": "...", "risk": "...", "plan": "...", "measures": {"phq9": 11}}. The instruction adds two technical rules: "Return valid JSON only, no text before or after the object" (models love adding a friendly preamble that breaks parsers) and "if a value was not provided, use the string \"MISSING\" rather than null, a guess, or an empty string" (so the missing-field convention survives the format change and remains searchable). The schema content is identical to the labeled blocks; only the container changed, which is why building the labeled-block version first is never wasted work.

Two governance notes for the group setting. First, the schema is a practice-level artifact: one approved schema per EHR template, version-controlled like the system prompt, so 25 clinicians produce structurally identical notes and the compliance officer can audit the structure once instead of 25 times. Second, automation raises the verification stakes rather than lowering them. A script that pastes faster than a human also propagates an error faster than a human, so any automated import keeps the clinician's read-and-sign step exactly where it was: after the content is in the chart and before the signature. Illinois WOPR-style rules and plain professional ethics agree on this point: the licensed clinician reviews and approves; the pipeline only moves text.

Testing the Mapping Before It Touches a Real Chart

Like the system prompt and the few-shot block, the schema gets an acceptance test before live use, run with fictional session shorthand. Test one, the full note: complete input, all fields supplied. Pass criteria: all seven blocks present, in order, correctly labeled, no extra blocks, no markdown, and every block's content traceable to the input. Test two, the gappy note: omit the minutes and the PHQ-9 score. Pass criteria: ::SESSION INFO:: contains [MISSING: total minutes], ::MEASURES:: contains [MISSING: PHQ-9 score], and no block contains a guessed value. Test three, the risk note: include unassessed risk content ("client mentioned passive SI") with no clinician assessment. Pass criteria: the ::RISK:: block reads [RISK CONTENT PRESENT: clinician assessment required] and nothing else, exactly as the system prompt requires; the structured format must not become a loophole through which the model squeezes a risk characterization because "the block needed content."

Then test four, the round trip: take the passing full-note output and actually paste it into a test or training client in your EHR (most platforms support a dummy chart; never use a real client for testing), running the five-step procedure. This is where you discover that your template has a field your schema forgot, or that your EHR's risk section sits above Assessment rather than below, ordering your schema should mirror so paste-back proceeds top to bottom without scrolling. Adjust the schema, update the two-column mapping table, date the version, and log the four test results with the rest of your prompt-stack documentation. When your EHR vendor updates the template, and they do, quietly, rerun test four; the mapping table makes the diff obvious in one glance.

The Applied Problem: Your EHR Paste-Back Schema

Your artifact is the EHR Paste-Back Schema, v1.0: the labeled-block instruction adapted to your actual EHR template, the two-column mapping table that proves the fit, and the logged four-test validation. It is the third layer of your prompt stack, and the L2 capstone leans on it directly: the capstone's four progress notes, its intake, and its treatment plan are all produced as structured blocks and transferred by the five-step procedure, which is what makes "clinician-verified line by line" practical at capstone scale instead of aspirational.

Step one: open your real progress note template, SimplePractice, TherapyNotes, Valant, or whatever you run, and list every field top to bottom in the left column of a table. Step two: copy the seven-block schema from this lesson and rename, split, or reorder blocks until each EHR field has exactly one source block in the right column; fork a variant per template if you document in more than one (a TherapyNotes psychotherapy note and a group-therapy note are different mappings). Step three: append the schema instruction to your prompt stack beneath the system prompt and few-shot block, and save the dated master, ehr-paste-back-schema-v1.0-2026-06.txt, beside the others. Step four: run the four-test validation, full, gappy, risk, round trip, with fictional shorthand and a dummy chart, and log results. Step five: run your first real note through the five-step paste-back procedure with the schema live, and time it; by night three the ninety seconds is real.

"Done" looks like: a one-page schema file with the mapping table and test log, a prompt stack that now returns notes pre-sliced for your exact template, and a paste-back that consists of matching labels to fields, checking endings, sweeping for [MISSING], and reading before signing. The ten-minute slicing surgery is gone, the four transfer errors have named defenses, and the documentation kit you will assemble for the capstone has its transport layer.

Key Takeaways

  • Copy-paste is the last unautomated step in the AI documentation workflow and the birthplace of transfer errors: field misplacement, truncation (which preferentially eats the endings where plans and safety language live), cross-chart contamination (a HIPAA incident plus a record error in one keystroke), and format mangling. Structured output shrinks all four by making the unit of transfer a labeled block matched to a labeled field.
  • Choose the container by who pastes: labeled blocks for humans (readable, zero setup, the default for solo practice), JSON for software (parsers need machine-readable keys). The schema, the fields and the rules for each, is identical in both, so starting with labeled blocks wastes nothing.
  • The seven-block schema (::SESSION INFO::, ::SUBJECTIVE::, ::OBJECTIVE::, ::ASSESSMENT::, ::RISK::, ::PLAN::, ::MEASURES::) uses deliberately ugly double-colon labels no clinical prose can imitate, bans markdown because EHR fields render it literally, forbids adding or reordering blocks, and writes [MISSING: field] instead of guessing, so every gap is an unambiguous work order.
  • The ::RISK:: block imports the hard rule unchanged: the model formats the clinician's stated assessment or outputs [RISK CONTENT PRESENT: clinician assessment required] and nothing else. The structured format must never become a loophole that pressures the model into characterizing risk because the block "needed content."
  • Map the schema to your real template, not vendor screenshots: SimplePractice's configurable SOAP/DAP sections with pre-populated session details (your ::SESSION INFO:: becomes a billing cross-check), TherapyNotes' granular objectives/interventions/mental-status fields (fork the schema to match), and Valant's structured content with integrated measures (route ::MEASURES:: to measure entry). Keep a two-column mapping table and rerun the round-trip test when the vendor quietly updates the template.
  • The five-step paste-back procedure: one chart open, verify the header against pre-populated fields, paste in template order without formatting, check the last sentence of every block, sweep for [MISSING] flags, then the line-by-line read and signature, which no formatting improvement removes, because the signature is a legal attestation.
  • Your artifact is the EHR Paste-Back Schema v1.0: the adapted instruction, the mapping table, and the logged four-test validation (full, gappy, risk, round trip on a dummy chart). It is the third layer of the prompt stack and the transport layer for the L2 capstone's clinician-verified documentation kit.