ScribeberryScribeberry Docs

Guided Forms

Fill any FHIR Questionnaire in real time from a live clinical conversation, with confidence, evidence and provenance on every answer.

Guided Forms turn a live conversation into structured answers on your form. You register a FHIR Questionnaire once. During a visit you stream audio (or send your own transcript), and Scribeberry fills the fields your UI has unlocked, as people speak.

  • Any form. FHIR R4 or R5 Questionnaire, including enableWhen logic. You don't write code per form.
  • Field-level output. Each answer carries the exact linkId, a typed value, a confidence score, the verbatim quote it came from, and a reference to any earlier answer it corrects.
  • Your UI stays in charge. You decide which fields are active. Clinician-entered answers are never overwritten.
  • Canadian-resident. Speech and AI run in Canadian data centres. Scribeberry stores no audio, transcripts or answers.

1. Register your Questionnaire

curl -X PUT https://api.scribeberry.com/api/v1/questionnaires/uti-initial/versions/1.1.0 \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "resource": { "resourceType": "Questionnaire", "version": "1.1.0", "item": [ ... ] },
    "sectionLinkId": "initial",
    "extractableLinkIds": ["initial.patient.has-allergies", "initial.patient.allergies"]
  }'

The response is a compile report: field counts, conditional items, and anything Scribeberry can't honour (for example, a choice item with no options).

  • Versions are immutable. Re-sending the same content is safe. Changing the content of an existing version returns 409, so publish a new version instead.
  • extractableLinkIds is optional. It limits which fields the scribe may fill; the rest stay clinician-entered.
  • sectionLinkId is optional. It scopes the form to one top-level section.
  • Per-field prompt metadata (scribe-instruction). Any Questionnaire item can include an extension with url: "https://scribeberry.com/fhir/StructureDefinition/scribe-instruction" and a valueString telling the scribe how to summarize or format that field (especially useful for free-text summaries and prescription rationales).

1b. Admin prompt authoring & pre-publish sandbox

Before publishing a new form version to clinicians, form admins can refine per-field instructions with natural language and test extraction against sample consultations without storing any patient data:

# Suggest per-field instruction diffs from plain English
POST /api/v1/questionnaires/uti-initial/versions/1.1.0/instructions/tweak
{
  "current_instructions": {},
  "target_link_id": "initial.prescription.rationale",
  "prompt": "Always cite symptom duration, allergy clearance, and first-line reasoning."
}
 
# Run a stateless pre-publish test (auto-unlocks enableWhen gates in up to 2 passes)
POST /api/v1/questionnaires/uti-initial/versions/1.1.0/test
{
  "transcript": "32F with dysuria & frequency x3 days, sulfa allergy, no red flags, Rx nitrofurantoin 100mg BID x5d...",
  "field_instructions": {
    "initial.prescription.rationale": "Cite symptom duration, allergy clearance, and first-line reasoning."
  }
}

2. Start a realtime visit

Create a short-lived browser token on your server (Realtime in the browser). Then start a session with guidedForm:

import { Scribeberry } from '@scribeberry/sdk';
 
const sb = new Scribeberry({ getRealtimeToken });
 
const session = sb.realtime.transcribe({
  language: 'en-CA',
  guidedForm: {
    sessionId: 'enc-001',
    consent: true, // the patient agreed; no audio is accepted otherwise
    questionnaire: { id: 'uti-initial', version: '1.1.0' },
    activeLinkIds: ['initial.patient.has-allergies', 'initial.patient.pregnant'],
  },
});
 
session.on('extraction', (event) => {
  for (const field of event.extracted) {
    // field.linkId, field.value, field.confidence, field.evidence
    form.applyScribeAnswer(field, event.utterance_id, event.kind === 'correction');
  }
});
 
session.on('guidedFormDegraded', () => form.showManualEntryNotice());
 
// Stream 16 kHz mono PCM16 audio
session.sendAudio(chunk);

3. Keep the scribe in sync with your UI

When a gate opens or closes in your form (for example, pregnant = yes unlocks breastfeeding), tell the scribe. Newly unlocked fields are filled from what was already said.

session.updateActiveLinkIds(['initial.patient.breastfeeding'], []);

When the clinician enters or changes an answer, share it so later corrections use the same context:

session.updateAnswers([{ linkId: 'initial.history.previous-uti', value: true }]);

4. Finish the visit

const result = await session.stop({
  guidedForm: { status: 'completed', practitionerReference: 'Practitioner/pharm-123' },
});
 
result.guidedForm?.questionnaireResponse; // FHIR QuestionnaireResponse
result.guidedForm?.provenance; // companion Provenance (validator + scribe)

Every answer in the QuestionnaireResponse records its source (scribe-ai or pharmacist-manual), confidence, evidence and utterance. When an answer changed, it also records the previous value and what it corrected.

Events

EventWhen
guidedFormStartedSession accepted; includes active fields, fill_timing, and conflict_policy
extractionAn utterance or typed note filled or corrected fields (kind: extraction, correction, backfill, batch, conflict)
guidedFormDegradedOne utterance couldn't be processed; continue manually
guidedFormCompleteFinal QuestionnaireResponse and Provenance

Configurable fill timing & conflict policy

Pass fill_timing and conflict_policy on start.config.guidedForm:

  • fill_timing: "realtime" (default: fills live per utterance) or "end-of-visit" (buffers utterances and runs a single batch synthesis on stop).
  • conflict_policy: "latest-wins" (default: auto-updates and emits correction), "flag-for-review" (keeps the original answer and emits conflict with both current and proposed quotes), or "first-wins".
  • field_instructions: Optional per-linkId prompt overrides for the session.
  • live_dictation_partials: Optional boolean (default false). When true, Scribeberry extracts incrementally from live dictation partials without waiting for long silence pauses.
  • Typed notes mid-session: Send { "type": "note.live", "session_id": "enc-001", "text": "..." } for live-as-you-type updates in place, and { "type": "note.submit", "session_id": "enc-001", "text": "..." } to commit a typed or pasted summary on the same WebSocket.

Extraction event

{
  "type": "correction",
  "session_id": "enc-001",
  "utterance_id": 34,
  "transcript": "actually I did have a UTI a couple months ago",
  "extracted": [
    {
      "linkId": "initial.history.previous-uti",
      "value": true,
      "confidence": 0.89,
      "evidence": "I did have a UTI",
      "corrects_utterance_id": 9
    }
  ],
  "corrects_utterance_id": 9,
  "latency_ms": 1120
}

Typed notes, batch synthesis, or your own speech recognition

Send a single spoken utterance (mode: "utterance"), a typed/pasted pharmacist summary (mode: "note", up to 8,000 characters), or a full encounter transcript for end-of-visit synthesis (mode: "batch", up to 120 turns):

POST /api/v1/guided-forms/extract
{
  "session_id": "enc-001",
  "questionnaire": { "id": "uti-initial", "version": "1.1.0" },
  "active_linkIds": ["initial.patient.has-allergies", "initial.prescription.rationale"],
  "utterance": { "utterance_id": 1, "transcript": "32F with dysuria, allergic to sulfa, Rx nitrofurantoin 100mg BID x5d." },
  "field_instructions": {
    "initial.prescription.rationale": "Cite allergy clearance and symptom duration."
  },
  "context": { "utterances": [], "fields": [] },
  "options": { "mode": "note" }
}

The response is the same extraction event. Nothing is stored between calls.

Engines

EngineBest for
scribe-balanced (default)Best accuracy at real-time speed
scribe-swiftLowest latency
scribe-preciseLong, nuanced answers
scribe-classicPrevious generation

All engines run in Canada.

Good practice

  • Treat low confidence as a suggestion. Values under your threshold (we suggest 0.7) should be shown for one-tap confirmation, not auto-filled.
  • Never overwrite a clinician's entry with a scribe value. Surface it as a suggestion instead.
  • Questions don't fill fields. "Are you pregnant?" fills nothing; the answer does.
  • Audio: 16 kHz mono PCM16. See Audio format.

Guided-form extraction is billed as input and output tokens; streamed audio is billed as realtime transcription.