Skip to main content

Protocol design

ProtocolDesign​

Returned by: JinkoClient.create_protocol_design, JinkoClient.create_protocol_design_from_csv, JinkoClient.create_protocol_design_from_json, JinkoClient.get_protocol_design, JinkoClient.iter_protocol_designs, JinkoClient.list_protocol_designs, Model.create_protocol_design, Trial.protocol_design

Also has every member of ProjectItem.

MemberKindDescription
export_csvmethodExport this protocol design revision as native CSV bytes.
armspropertyAccess the protocol arms of this design.

export_csv​

export_csv(*, revision: int | None = None) -> bytes

Export this protocol design revision as native CSV bytes.

arms​

Type: ProtocolArmsService

Access the protocol arms of this design.

Returns a ProtocolArmsService that provides a fully typed, object-oriented interface for reading and mutating arms. This is the recommended way to work with arms after the protocol design has been created.

Key operations:

  • arms.list() — return all arms as ProtocolArm handles.
  • arms.get(arm_id) — look up one arm by name.
  • arms.create(arm_id, control=..., overrides=..., ...) — append a new arm. overrides is a {component_id: formula} dict; keys can be raw strings or Component handles when the design is bound to a model.
  • arm.create_copy(new_id, overrides=...) — duplicate an arm and selectively patch its overrides.
  • arm.set_override(key, formula) — add or replace one override.
  • arm.remove_override(key) — remove an override entry.
  • arm.set_control(other_arm) / arm.set_id(name) — mutate arm metadata in place.
  • arm.delete() — remove an arm from the design.
  • arms.compare_overrides(left, right) — diff the overrides of two arms side by side.

Example — refine a protocol that was created from raw arm dicts::

protocol = client.get_protocol_design("pd-abc123")

# Append a new arm derived from an existing one
control = protocol.arms.get("control")
high = control.create_copy("high_dose", overrides={"Dose": "4.0"})

# Adjust an override on an existing arm
protocol.arms.get("treated").set_override("Dose", "3.0")

Example — build a protocol incrementally (create first, add arms through the typed API)::

protocol = model.create_protocol_design(
[{"armName": "control", "armOverrides": [{"key": "Dose", "formula": "1.0"}]}],
name="My protocol",
)
protocol.arms.create(
"treated",
control="control",
overrides={"Dose": "2.0", "route": "po"},
)