You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Area: InstrumentsInstrument authoring API, bundling, runtime, rendering, measures and the built-in libraryArea: SharedCross-tier packages (schemas, react-core, etc.) not covered by another areaDifficulty: HighMore than a day, or touches several workspacesFeatureType: a new capability that does not exist yetNeeds DecisionWell-defined, but blocked on a maintainer decision about direction or designPriority: MediumReal value; schedule normallyUpstreamThe fix belongs in a @douglasneuroinformatics/* package or a third-party dependency
Not implemented on main (d86740e), and upstream has nothing to build on yet. The latest @douglasneuroinformatics/libui-form-types is 1.5.0, and its only type change from our 1.4.0 is an optional variant: 'date' | 'datetime' on date fields. libui 6.18.0 has no signature component.
What works today
An INTERACTIVE instrument can draw on a <canvas> and call done({ signature: canvas.toDataURL('image/png') }) (render(done), packages/runtime-core/src/types/instrument.interactive.ts:40). Put it in a SERIES after the consent FORM. This also works for remote assignments, because the gateway forwards data for both series and scalar results (apps/gateway/src/Root.tsx:59-69). A form block cannot do this: Block.render receives only data and t and has no way to set a value.
Options
A new string variant, variant: 'signature', whose value is a PNG data URL. The value is a string, so both ScalarField conditional types (libui-form-types, and packages/runtime-core/src/types/instrument.form.ts:129-145) already map it to StringField. The record stays $Json and the gateway needs no change. 1.5.0's datetime follows the same pattern.
A new kind: 'signature' with a structured value (strokes). This needs a new ScalarFieldValue member, a new arm in both ScalarField conditional types, a $StaticFieldKind entry, and a renderer wherever the value is shown. Much more work for little gain.
$$FormInstrumentStringField (packages/schemas/src/instrument/instrument.form.ts:30-42) must get the variant by hand. Its satisfies z.ZodType<...> cannot catch a missing union member, because ZodType is declared out Output. runtime-core derives its StringField from the upstream one, so the bump changes its types with no edit there and nothing points you at the schema. Without the variant, InstrumentsService.create rejects every instrument that uses it.
translateScalarField (packages/instrument-utils/src/translate.ts:63-97) ends in .exhaustive(), so the compiler flags it. Add 'signature' to the first arm.
apps/web/src/hooks/useInstrumentVisualization.ts:219-227 spreads record.data into every row, so the data URL lands in the subject table and in every export from it. xlsx 0.18.5 throws Text length must not exceed 32767 characters in write_ws_xml_cell, and a signature PNG at device resolution can exceed that. The Excel path needs a placeholder for these columns. feat: add the instrument hub and record provenance #1807 rewrites this hook and the subject table and builds the instrument-hub table on the same hook, so land this part after it.
The record view lists only measures, and packages/react-core/src/components/InstrumentSummary/InstrumentSummaryGroup.tsx:21-26 prints strings as text. Render signature fields from data as an <img> with a translated alt, found by walking instrument.content for variant: 'signature', including what a dynamic field's render returns. Don't tell authors to add a const measure for it: that copies the data URL into computedMeasures, and from there into the API export.
runtime-core bundles libui-form-types into its .d.ts (packages/runtime-core/config/api-extractor.json:4), so external authors see the variant only after a @opendatacapture/runtime-v1 release.
ODC: bump both catalog entries, then update the schema and translate.ts. Put the field in a new demo form, not in DNP_GENERAL_CONSENT_FORM, which the happiness series and several e2e specs drive. Follow .agents/docs/playbooks/add-instrument.md, and also extend the exact instrument list asserted in apps/api/src/demo/__tests__/demo.service.test.ts. Update packages/instrument-guidelines/AGENTS.md (a release; its string section also lacks combobox).
react-core and web: the image in the summary, and the export handling.
Unit tests: packages/schemas/src/instrument/__tests__/instrument.form.test.ts, packages/instrument-utils/src/__tests__/translate.test.ts, packages/react-core/src/components/InstrumentSummary/__tests__/InstrumentSummary.test.tsx and apps/web/src/utils/__tests__/excel.test.ts. E2E: draw with page.mouse in a new spec modelled on testing/src/specs/form-block.spec.ts, check the image in subject-detail.spec.ts, and run one pass through gateway-assignment.spec.ts.
Open questions
Is a drawn image enough, or must the signature be bound to an identity (signer name, timestamp, audit log entry)?
Should signature columns be left out of tabular exports by default? They are identifying, and the subject-table export includes raw data with no opt-out.
Should there be a typed-name fallback for keyboard-only users?
Triage note written with Claude Code. Code references point at main @ d86740e.
Area: InstrumentsInstrument authoring API, bundling, runtime, rendering, measures and the built-in libraryArea: SharedCross-tier packages (schemas, react-core, etc.) not covered by another areaDifficulty: HighMore than a day, or touches several workspacesFeatureType: a new capability that does not exist yetNeeds DecisionWell-defined, but blocked on a maintainer decision about direction or designPriority: MediumReal value; schedule normallyUpstreamThe fix belongs in a @douglasneuroinformatics/* package or a third-party dependency
Activity
joshunrau commentedon Oct 26, 2026
Not implemented on
main(d86740e), and upstream has nothing to build on yet. The latest@douglasneuroinformatics/libui-form-typesis 1.5.0, and its only type change from our 1.4.0 is an optionalvariant: 'date' | 'datetime'ondatefields. libui 6.18.0 has no signature component.What works today
An
INTERACTIVEinstrument can draw on a<canvas>and calldone({ signature: canvas.toDataURL('image/png') })(render(done),packages/runtime-core/src/types/instrument.interactive.ts:40). Put it in aSERIESafter the consentFORM. This also works for remote assignments, because the gateway forwardsdatafor both series and scalar results (apps/gateway/src/Root.tsx:59-69). A formblockcannot do this:Block.renderreceives onlydataandtand has no way to set a value.Options
stringvariant,variant: 'signature', whose value is a PNG data URL. The value is a string, so bothScalarFieldconditional types (libui-form-types, andpackages/runtime-core/src/types/instrument.form.ts:129-145) already map it toStringField. The record stays$Jsonand the gateway needs no change. 1.5.0'sdatetimefollows the same pattern.kind: 'signature'with a structured value (strokes). This needs a newScalarFieldValuemember, a new arm in bothScalarFieldconditional types, a$StaticFieldKindentry, and a renderer wherever the value is shown. Much more work for little gain.FILEpath.FILEis an instrument kind, not a field, so the signature cannot sit in the consent form. It needs storage (apps/api/src/instrument-records/instrument-records.service.ts:93-97returns 503 without it), and remote assignments drop files (File instruments can be assigned remotely, but the patient's files are discarded and the record stays pending forever #1708 proposes refusing them). Consent is a main use of remote assignments, so this does not fit.I recommend option 1.
Gotchas with option 1
$$FormInstrumentStringField(packages/schemas/src/instrument/instrument.form.ts:30-42) must get the variant by hand. Itssatisfies z.ZodType<...>cannot catch a missing union member, becauseZodTypeis declaredout Output. runtime-core derives itsStringFieldfrom the upstream one, so the bump changes its types with no edit there and nothing points you at the schema. Without the variant,InstrumentsService.createrejects every instrument that uses it.translateScalarField(packages/instrument-utils/src/translate.ts:63-97) ends in.exhaustive(), so the compiler flags it. Add'signature'to the first arm.apps/web/src/hooks/useInstrumentVisualization.ts:219-227spreadsrecord.datainto every row, so the data URL lands in the subject table and in every export from it.xlsx0.18.5 throwsText length must not exceed 32767 charactersinwrite_ws_xml_cell, and a signature PNG at device resolution can exceed that. The Excel path needs a placeholder for these columns. feat: add the instrument hub and record provenance #1807 rewrites this hook and the subject table and builds the instrument-hub table on the same hook, so land this part after it.packages/react-core/src/components/InstrumentSummary/InstrumentSummaryGroup.tsx:21-26prints strings as text. Render signature fields fromdataas an<img>with a translatedalt, found by walkinginstrument.contentforvariant: 'signature', including what adynamicfield'srenderreturns. Don't tell authors to add aconstmeasure for it: that copies the data URL intocomputedMeasures, and from there into the API export.touch-action: none, or a finger scrolls the page instead of drawing. Breakout Task paddle does not follow a finger dragged across a touch screen #1672 is the same bug in Breakout..d.ts(packages/runtime-core/config/api-extractor.json:4), so external authors see the variant only after a@opendatacapture/runtime-v1release.Plan
StringFieldSignaturecomponent, its arm inStringField.tsx, and a Clear label inlibui.json. Plain pointer events andtoDataURLare enough, so libui needs no new dependency. Indicate required vs optional fields #390 and Use the form type info to provide software keyboard hints #1586 also change libui'sFormand could ship in the same release.translate.ts. Put the field in a new demo form, not inDNP_GENERAL_CONSENT_FORM, which the happiness series and several e2e specs drive. Follow.agents/docs/playbooks/add-instrument.md, and also extend the exact instrument list asserted inapps/api/src/demo/__tests__/demo.service.test.ts. Updatepackages/instrument-guidelines/AGENTS.md(a release; its string section also lackscombobox).Unit tests:
packages/schemas/src/instrument/__tests__/instrument.form.test.ts,packages/instrument-utils/src/__tests__/translate.test.ts,packages/react-core/src/components/InstrumentSummary/__tests__/InstrumentSummary.test.tsxandapps/web/src/utils/__tests__/excel.test.ts. E2E: draw withpage.mousein a new spec modelled ontesting/src/specs/form-block.spec.ts, check the image insubject-detail.spec.ts, and run one pass throughgateway-assignment.spec.ts.Open questions
Triage note written with Claude Code. Code references point at
main@d86740e.