Legacy Task Forms to Task Manager Protocol JSON - Conversion Specification
This document provides a detailed technical specification for converting Legacy Task forms (OHIF-based) to Task Manager protocol JSON format.
Scope of This Document
This specification covers protocol JSON file creation only - the JSON structure you paste or upload into the Task Manager protocol editor. It does not cover API usage, protocol deployment, or task creation.
Protocol JSON File Structure
Task Manager protocol JSON files contain exactly two top-level keys:
This is the complete structure for a protocol JSON file.
Additional metadata (label, group_id, task_type, protocol_config, completion_tags, notes) is provided through the UI or API when uploading the protocol, not in the JSON file itself.
Form Schema Differences
Forms Require Conversion
Legacy Task forms and Task Manager forms use different schemas. Conversion is required to transform Legacy forms to Task Manager format.
Legacy Form Structure
Legacy forms are wrapped in a studyForm object with a components array:
Task Manager Form Structure
Task Manager forms have a flatter structure with a fields array:
Conversion Rules
Structure Transformation
| Legacy Structure | Task Manager Structure |
|---|---|
studyForm.components[] | fields[] |
No title | title (required) |
No description | description (required) |
No defaults | defaults (required object) |
Property Mappings
| Legacy Property | Task Manager Property | Notes |
|---|---|---|
components | fields | Rename array |
values | options | Rename array for select/radio/checkbox fields |
validate.required: true | requiredWhenVisible: true | Move from nested object to field level |
validate.required: false | requiredWhenVisible: false or omit | Optional fields |
conditional.json | visible | Unwrap JsonLogic from conditional object |
required: true | requiredWhenVisible: true | Some Legacy forms use required directly |
required: false | requiredWhenVisible: false or omit | Optional fields |
Field Type Conversions
| Legacy Type | Task Manager Type |
|---|---|
selectboxes | checkbox |
textfield | text |
textarea | text-area |
radio | radio (no change) |
select | select (no change) |
info | paragraph |
JsonLogic Operator Conversions
| Legacy Operator | Task Manager Operator | Notes |
|---|---|---|
== | === | Use strict equality |
!= | Convert to positive in check | See negation logic section |
JsonLogic Negation Handling
Legacy forms often use != for negation. Task Manager prefers positive value checks with the in operator.
Legacy pattern:
Task Manager pattern:
List all valid positive values explicitly.
OHIF-Specific Properties (Remove from Form)
These properties are specific to the OHIF viewer and should be removed from field options:
requireMeasurements- Remove from optionsmeasurementTools- Remove from optionscontainerType- Remove from formcontourVisibility- Remove from form
Viewer Configuration
OHIF viewer properties should be configured at the project level in Task Manager, not in the protocol JSON file.
Conversion Process
Step 1: Extract Form Components
From your Legacy form, extract the components array:
Step 2: Create Title and Description
Add a title and description for the form (these don't exist in Legacy forms):
Step 3: Create Defaults Object
Build a defaults object with an entry for every field that accepts user input. Use appropriate empty values based on field type:
Skip display-only fields like paragraph and instruction - they don't need defaults.
Step 4: Transform Each Component
For each component in the Legacy form:
- Rename
valuestooptions - Convert
validate.requiredorrequiredtorequiredWhenVisible - Unwrap
conditional.jsontovisible - Change field type if needed (selectboxes → checkbox, textfield → text, textarea → text-area)
- Convert
==to===in all JsonLogic expressions - Convert
!=to positiveinchecks - Remove OHIF properties (
requireMeasurements,measurementTools,containerType)
Step 5: Wrap in Protocol Structure
Wrap the converted form in the protocol JSON structure:
Step 6: Add E-signature Configuration (If Needed)
If your form requires e-signatures, replace null with an e-signature configuration:
Complete Conversion Example
This example uses a real diabetic retinopathy grading form for fundus images.
Legacy Form (Before)
Task Manager Protocol JSON (After)
Key Changes Highlighted
- Wrapped in form object with
title,description,defaults,fields components→fieldsvalues→optionsvalidate.required→requiredWhenVisibleconditional.json→visible(unwrapped)selectboxes→checkboxtextarea→text-area==→===in JsonLogic!=→inwith positive value list in JsonLogic- Removed
required: false(not needed when field is optional)
Conversion Checklist
- [ ] Extract Legacy form components array
- [ ] Create form
titleanddescription - [ ] Create
defaultsobject with all input field keys - [ ] Rename
componentstofields - [ ] Rename
valuestooptionsfor all select/radio/checkbox fields - [ ] Convert
validate.requiredandrequiredtorequiredWhenVisible - [ ] Unwrap
conditional.jsontovisible - [ ] Convert field types:
selectboxes→checkbox,textfield→text,textarea→text-area - [ ] Replace all
==with===in JsonLogic - [ ] Convert all
!=to positiveinchecks in JsonLogic - [ ] Remove OHIF properties (
requireMeasurements,measurementTools,containerType) - [ ] Wrap form in protocol structure with
formandesignature_configkeys - [ ] Add e-signature configuration if needed
- [ ] Validate JSON syntax
- [ ] Test by pasting into Task Manager protocol editor
Common Issues
Issue 1: Forgot to Create Defaults
Problem: Missing defaults object
Solution: Add a defaults object with an entry for every input field with appropriate empty value:
Issue 2: Didn't Unwrap Conditional
Problem: Left conditional.json structure intact
Solution: Unwrap to visible:
Issue 3: Didn't Convert Field Types
Problem: Used selectboxes, textfield, or textarea types
Solution: Convert to Task Manager types:
selectboxes→checkboxtextfield→texttextarea→text-area
Issue 4: Didn't Convert JsonLogic Operators
Problem: Used == or != in JsonLogic
Solution:
- Replace
==with=== - Replace
!=with positiveincheck listing all valid values
Issue 5: Left OHIF Properties in Form
Problem: Fields still have requireMeasurements or measurementTools
Solution: Remove these properties from the form JSON. Configure measurement tools at the project level instead.
Validation Rules
JsonLogic validation rules use the same syntax in both systems (with === for equality):
Best Practices
Form Design
- Descriptive Titles: Use clear form titles that describe the assessment
- Use Affirmative Logic: Prefer positive
inchecks over negation - Provide Helper Text: Use
helperTextto guide users - Validate Early: Use
validationrules to catch errors before submission - Test Conditional Logic: Verify all
visibleandrequiredWhenVisiblerules work correctly
Conversion Process
- Validate Source: Ensure Legacy form JSON is valid before starting
- Create Defaults First: Build the complete defaults object before converting fields
- Convert One Field at a Time: Systematic field-by-field conversion reduces errors
- Test Incrementally: Test form after converting each major section
- Keep Backups: Save both Legacy and converted versions
Conclusion
Converting Legacy Task forms to Task Manager protocol JSON requires systematic transformation of structure, properties, and operators.
Key Transformation Steps:
- Add
title,description, anddefaults(not present in Legacy forms) - Rename
components→fields,values→options - Convert
validate.required/required→requiredWhenVisible - Unwrap
conditional.json→visible - Convert field types (
selectboxes,textfield,textarea) - Update JsonLogic operators (
==→===,!=→in) - Remove OHIF-specific properties
- Wrap in protocol JSON structure
Migration Effort:
- Medium Complexity: Systematic transformations required
- Checklist-Driven: Follow conversion checklist to ensure completeness
- Testable: Each transformation can be verified incrementally
Related Documentation
- Protocol Form Technical Reference - Complete technical reference for protocol form schema, field types, validation rules, and JSON structure
- E-signature Configuration Reference - E-signature configuration options and examples
- Legacy Form Conversion Example - Detailed walkthrough of a diabetic retinopathy form conversion with before/after comparison