imednet.form_designer.builder module

class imednet.form_designer.builder.FormBuilder[source]

Bases: object

Builder class to construct iMedNet Form Designer payloads programmatically.

Manages ID generation and hierarchical structure.

add_field(type, label, question_name, required=False, choices=None, max_length=None, is_float=False)[source]

Add a standard field (Label + Control).

Parameters:
  • type (Literal['text', 'number', 'radio', 'dropdown', 'datetime', 'upload', 'checkbox', 'memo']) – Field type.

  • label (str) – Display label (HTML allowed).

  • question_name (str) – Variable OID.

  • required (bool) – If True, sets bl_req=’hard’.

  • choices (Optional[List[tuple[str, str]]]) – List of (text, code) for radios/dropdowns.

  • max_length (Optional[int]) – Max chars (text/memo) or digits (number).

  • is_float (bool) – For numbers, allow decimals.

Return type:

None

add_group_header(label)[source]

Add a group header (Label-only row).

Return type:

None

Parameters:

label (str) –

add_page()[source]

Add a new page to the form.

Return type:

None

add_section_header(label)[source]

Add a separator/section header.

Return type:

None

Parameters:

label (str) –

build()[source]

Return the final layout.

Return type:

ProtocolDeviationFormPayload

property current_page: Page