onReportApply callback.
This page explains how to enable, disable, and use it.
The same modal is reused to curate clinical actions (extras) — petitions, appointments, tests, referrals — through a parallel channel. There the gate is
showInsertionPreview and the presence of templateExtras (instead of template), and on Apply the items go to handleExtras. See Clinical Actions (Extras).How it fits into the flow
1
Recording → Stop
After the doctor stops recording, a background auto-review drafts a report. The draft is not shown yet — it waits, exactly like the Generate button.
2
User clicks Generate (or Regenerate)
The modal never opens on its own from the background auto-review. It mirrors the Generate button and waits for a user click. Every user-initiated result — including after a failed automatic generation — opens the modal.
3
Curate in the modal
The insertion preview opens with the report fields. The doctor can select, edit, or fill each one. Mandatory fields block Apply until they are filled.
4
Apply → onReportApply(curated)
On Apply, your app receives the curated payload — only the fields the doctor kept or edited — via
onReportApply. Your app then inserts it into the EHR/HIS.If the feature is disabled, an arriving report is passed straight through to your
handleReport callback instead (legacy behavior) — the modal never renders.Enabling the modal
The modal has two independent channels: one for reports and one for clinical actions (extras). Each is enabled only when its two conditions are true. Both share the same backend flag, but each has its own schema:showInsertionPreview flag is per API key and shared by both channels. The schemas are independent: you can enable the modal for reports only (template), extras only (templateExtras), or both.
Turn on the backend flag
The flag is per API key and lives in your Omniloy profile settings (showInsertionPreview). You cannot enable it from the frontend — contact support@omniloy.com to have it set for your key. Until it is true, the SDK ignores the modal entirely and falls back to handleReport.
Pass a template
Thetemplate is the JSON Schema that describes the report structure (the same schema used to generate the report). It must be present for the modal to open. See Clinical data schemas.
Disabling the modal (opting out)
The modal is off by default — it only appears when both enable conditions above are met. There is no special “off” switch: making either condition false disables it. You have two independent levers:
When disabled, generated reports are delivered to your
handleReport callback as before — no modal, no curation step. This is the legacy behavior.
Common mistakes when enabling/disabling
There is no prop or HTML attribute that toggles the feature
There is no prop or HTML attribute that toggles the feature
A
show-insertion-preview attribute appears in some demo code — it is a no-op: the SDK never reads it. The only enable/disable levers are the backend showInsertionPreview flag and the presence of template.Omitting onReportApply does not disable the modal
Omitting onReportApply does not disable the modal
If the feature is enabled, the modal still opens; on Apply it simply falls back to
handleReport (and warns if neither is wired). To not show the modal, use one of the two levers above.An empty template still counts as present
An empty template still counts as present
The gate only checks that
template is truthy, so passing {} (or an object with no properties) can open a modal with no fields. Pass a real JSON Schema, or omit template entirely.Using it
On the web component,
template and insertionPreviewClassNames are JSON props and onReportApply/handleReport are function props — assign them as JS properties on the element, not as HTML attributes. Functions cannot be HTML attributes, and the template attribute is stripped from the DOM after it is read (it is sensitive data).Props reference
InsertionPreviewClassNames keys (all optional): backdrop, panel, header, body, footer, group, row, gapRow, applyButton, cancelButton.
The CuratedReport and InsertionPreviewClassNames types are structural (Record<string, unknown> and a flat map of optional class-name strings) — type your handlers against those shapes directly.
What the doctor can do in the modal
- Select / deselect fields — only checked fields end up in the curated payload.
- Edit values inline (text, prose, number, boolean, date, enum, multi-enum, and arrays of objects).
- Fill gaps — empty fields the template expects are surfaced as gaps.
- Edit with voice — dictate to refine fields while the modal stays open.
- Apply — emits
onReportApply(curated). Disabled while any mandatory gap is unfilled. - Cancel — closes without emitting.
Template schema
Thetemplate is a standard JSON Schema object. Beyond the standard keywords, the modal understands:
required(standard) — the agent should produce the field when it can.mandatory(custom keyword) — stronger thanrequired: the doctor must review/fill it before Apply is allowed. Empty mandatory fields render as blocking gaps and disable Apply.- Field kinds are inferred from the schema:
string,prose(long text),number,boolean,date(viapattern),enum,multi-enum(array of enums), andarray-of-objects(with optionaloneOf+discriminatorfor per-row variants).
Quick checklist
- Backend flag
showInsertionPreviewistruefor your API key (contact support to enable). Shared by both channels. - For reports: you pass a
template(JSON Schema), withonReportApplywired for the curated payload andhandleReportas the fallback. - For extras: you pass a
templateExtras(JSON Schema), withhandleExtraswired to receive the curated items. See Clinical Actions (Extras). - (Optional)
insertionPreviewClassNamesset for host-side styling.
Next steps
- Clinical data schemas — design the
templateand use themandatorykeyword - Pre-fill from your EMR — feed existing form content into generation with
updateTemplate - Optional properties — full callback reference