error:
message: Resource SDCWorkflow/id not found
message: No such step <[pato to step]> in wf <wf-1>
message: Forms does not match in the step and given document
message: Can't update steps of wf in <(completes/canceled)> statuses
message: Can't update step in <(completed/skipped)> status
message: Given document has different id than document in step: <doc1> != <doc2>
Try complete step with given document. Call sign on that document and extract data. If everything is ok - mark step as completed. If one of the validations fails - returns error
If workflow step was:
in in-progress status - set completed status
in in-amendment status - set amended status
Returns patches for workflow or error
patch - pair of [step, patch-obj]
step - path to item in WF (array)
[] - path for wf root
[section1] - path for section in 1st level
[section1 form1] - path for form, located in 2st level (real path in WF object = {items: {section1: {items: {form1: {.. form ...}}}}})
patch-obj - item object with changed fields (example: {status: "completed"})
error:
message: Resource SDCWorkflow/id not found
message: No such step <[path to step]> in wf <wf-1>
message: Forms does not match in the step and given document
message: Can't update steps of wf in <(completes/canceled)> statuses
message: Can't update step in <(completed/skipped/amended)> status
message: Given document has different id than document in step: <doc1> != <doc2>
message: Can't complete step %s in wf %s, due to valdation errors
message: Can't complete this step because :sdc/enable-when rule failed: ...
message: Can't complete this step because :sdc/enable-when rule is false
error:
message: Can't complete step <[path to step]> in wf <wf-idk>, due to valdation errors
errors: [{:resourceType "Observation", :export/idx 0} ;; failed export resource (with its index in Finalize)
[{:path [], :message "Property code is required"} ;; errors with it's location
{:path [], :message "Property status is required"}]]
[section1 form1] - path for form, located in 2st level (real path in WF object = {items: {section1: {items: {form1: {.. form ...}}}}})
patch-obj - item object with changed fields (example: {status: "completed"})
Request:
POST /rpc?
method: aidbox.sdc/skip-step,
params:
id: wf-1
step: [phisical-exam]
reason: Some reason
Result:
Error
error:
message: Resource SDCWorkflow/id not found
message: Can't skip step in workflow with status: '<(new/in-progress)>'
message: No such step <[path to step]> in wf <wf-1>
message: Can't skip stateless form step
message: Can't skip step in status '<(completed/amended/in-amendment)>': <[path to step]>
message: Something wrong: Can't find document with id : <doc1>
Set in-amendment status for step and try to amend document.
Additionally if workflow was in completed status - change it status to in-amendment and creates History addendum with timestamp and user
Returns patches for workflow or error
patch - pair of [step, patch-obj]
step - path to item in WF (array)
[] - path for wf root
[section1] - path for section in 1st level
[section1 form1] - path for form, located in 2st level (real path in WF object = {items: {section1: {items: {form1: {.. form ...}}}}})
patch-obj - item object with changed fields (example: {status: "completed"})
Request:
POST /rpc?
method: 'aidbox.sdc/amend-step,
params:
id: wf-1
step: [phisical-exam]
Result:
Error
error:
message: Resource SDCWorkflow/id not found
message: Can't amend step in workflow with '<(new/in-progress/canceled)>' status
message: No such step <[path to step]> in wf <wf-1>
message: Can't amend stateless form step
message: Something wrong: Can't find document with id : <doc1>
message: Can't amend this step because :sdc/enable-when rule failed
message: Can't amend this step because :sdc/enable-when rule is false
message: Can't amend step %s in wf %s, due to document amending errors
If you supply document through parameters - you need to specify them for the whole WF
Result:
Error
error:
message: Resource SDCWorkflow/id not found
message: Can't complete workflow in status: <(completed/canceled)>
message: Can't complete workflow due to sign errors
error:
message: Can't complete workflow due to sign errors,
errors: [{:message "..." :errors [...]}]
Success
result:
updates:
- [[] {status: "completed"}]
cancel-workflow
Tries skip all non-finalized steps and mark WF as canceled.
Finalized step is step in skipped, completed or amended status
Returns patches for workflow or error
patch - pair of [step, patch-obj]
step - path to item in WF (array)
[] - path for wf root
[section1] - path for section in 1st level
[section1 form1] - path for form, located in 2st level (real path in WF object = {items: {section1: {items: {form1: {.. form ...}}}}})
patch-obj - item object with changed fields (example: {status: "completed"})
Request:
POST /rpc?
method: aidbox.sdc/cancel-workflow,
params:
id: wf-1
reason: My private reason
Result:
Error
error:
message: Resource SDCWorkflow/id not found
message: Can't cancel workflow in status: <(completed/canceled)>
message: Can't skip workflow due to skip-document errors
Success
result:
updates:
- [[section1 questionnaire] {status: "skipped", skip-reason "My private reason"}]
- [[section1] {status: "skipped", skip-reason "My private reason"}]
- [[] {status: "canceled", cancel-reason "My private reason"}]
amend-workflow
Set in-amendment status for WF and all completed/amended steps.
Additionally creates History Addendum with user and timestamp
Returns patches for workflow or error
patch - pair of [step, patch-obj]
step - path to item in WF (array)
[] - path for wf root
[section1] - path for section in 1st level
[section1 form1] - path for form, located in 2st level (real path in WF object = {items: {section1: {items: {form1: {.. form ...}}}}})
patch-obj - item object with changed fields (example: {status: "completed"})
Request:
POST /rpc?
method: aidbox.sdc/amend-workflow,
params:
id: wf-1
Result:
Error
error:
message: Resource SDCWorkflow/id not found
message: Can't amend workflow in status: <(new/in-progress/in-amendment/canceled)>
message: Can't amend workflow due to amend-document errors
errors: [...]
POST /rpc?
content-type: text/yaml
method: aidbox.sdc/add-workflow-note
params:
id: wf-1
user:
id: user-1
resourceType: User
text: "Some important note on this workflow"
Result:
result:
date: '2022-11-11T11:11:10.111Z'
text: Some important note on this workflow
type: aidbox.sdc.addendum/Note
user:
id: user-1
resourceType: User
target:
id: wf-1
resourceType: SDCWorkflow
id: 168d0d5f-d496-46fa-8bac-ccd9f9e335cf
resourceType: SDCAddendum
Server responds with HTTP 422 Unprocessable Entity if wrong workflow id is provided.
Request:
POST /rpc?
method: aidbox.sdc/add-workflow-note
params:
id: some-unknown-wf-id
user:
id: user-1
resourceType: User
text: "Some important note on this workflow"
Result:
Error
error:
message: Resource not found
get-workflow-addendums
Returns collection of addendums for the given workflow.
This is the preferred way to retrieve Addendums related to a Workflow.
Use this API (aidbox.sdc/get-workflow-addendums) instead of the low-level Addendum API (aidbox.sdc.addendum/get-addendums).
Params:
Request:
POST /rpc?
method: aidbox.sdc/get-workflow-addendums
params:
id: wf-1