2019-12-20 19:32:04 +00:00
openapi : "3.0.2"
2019-11-19 20:57:46 +00:00
info :
version : 1.0 .0
title : Workflow Microservice
license :
name : MIT
servers :
- url : http://localhost:5000/v1.0
paths :
2019-12-11 21:54:24 +00:00
# /v1.0/study
/study :
2019-11-19 20:57:46 +00:00
get :
2020-01-14 20:39:54 +00:00
operationId : crc.api.study.all_studies
2019-12-11 21:54:24 +00:00
summary : Provides a list of studies related to the current user.
2019-11-19 20:57:46 +00:00
tags :
2019-12-18 19:02:17 +00:00
- Studies
2019-12-11 21:54:24 +00:00
responses :
'200' :
description : An array of studies, ordered by the last modified date.
content :
application/json :
schema :
$ref : "#/components/schemas/Study"
default :
description : unexpected error
content :
application/json :
schema :
$ref : "#/components/schemas/Error"
2020-01-03 16:44:24 +00:00
post :
2020-01-14 20:39:54 +00:00
operationId : crc.api.study.add_study
2020-01-03 16:44:24 +00:00
summary : Creates a new study with the given parameters.
tags :
- Studies
requestBody :
content :
application/json :
schema :
$ref : '#/components/schemas/Study'
responses :
'200' :
description : Study created successfully.
content :
application/json :
schema :
$ref : "#/components/schemas/Study"
default :
description : unexpected error
content :
application/json :
schema :
$ref : "#/components/schemas/Error"
2019-12-18 19:02:17 +00:00
/study/{study_id}:
2019-12-11 21:54:24 +00:00
get :
2020-01-14 20:39:54 +00:00
operationId : crc.api.study.get_study
2019-12-18 19:02:17 +00:00
summary : Provides a single study
2019-12-11 21:54:24 +00:00
tags :
2019-12-18 19:02:17 +00:00
- Studies
2019-12-11 21:54:24 +00:00
parameters :
- name : study_id
in : path
required : true
description : The id of the study for which workflows should be returned.
schema :
type : integer
format : int32
responses :
'200' :
2019-12-18 19:02:17 +00:00
description : An Study Object
2019-12-11 21:54:24 +00:00
content :
application/json :
schema :
2019-12-18 19:02:17 +00:00
$ref : "#/components/schemas/Study"
2019-12-11 21:54:24 +00:00
default :
description : unexpected error
content :
application/json :
schema :
$ref : "#/components/schemas/Error"
2020-01-03 16:44:24 +00:00
post :
2020-01-14 20:39:54 +00:00
operationId : crc.api.study.update_study
2020-01-03 16:44:24 +00:00
summary : Updates an existing study with the given parameters.
tags :
- Studies
parameters :
- name : study_id
in : path
required : true
description : The id of the study for which workflows should be returned.
schema :
type : integer
format : int32
requestBody :
content :
application/json :
schema :
$ref : '#/components/schemas/Study'
responses :
'200' :
description : Study updated successfully.
content :
application/json :
schema :
$ref : "#/components/schemas/Study"
default :
description : unexpected error
content :
application/json :
schema :
$ref : "#/components/schemas/Error"
2019-12-18 19:02:17 +00:00
/study-update/{study_id}:
2019-12-11 21:54:24 +00:00
post :
2020-01-14 20:39:54 +00:00
operationId : crc.api.study.post_update_study_from_protocol_builder
2019-12-18 19:02:17 +00:00
summary : If the study is up-to-date with Protocol Builder, returns a 304 Not Modified. If out of date, return a 202 Accepted and study state changes to updating.
2019-12-11 21:54:24 +00:00
tags :
2019-12-18 19:02:17 +00:00
- Study Status
2019-11-19 20:57:46 +00:00
parameters :
2019-12-11 21:54:24 +00:00
- name : study_id
in : path
required : true
2019-12-18 19:02:17 +00:00
description : The id of the study that should be checked for updates.
2019-12-11 21:54:24 +00:00
schema :
type : integer
format : int32
2019-12-18 19:02:17 +00:00
responses :
'304' :
description : Study is currently up to date and does not need to be reloaded from Protocol Builder
'202' :
description : Request accepted, will preform an update. Study state set to "updating"
default :
description : unexpected error
content :
application/json :
schema :
$ref : "#/components/schemas/Error"
/study/{study_id}/workflows:
get :
2020-01-14 20:39:54 +00:00
operationId : crc.api.study.get_study_workflows
2019-12-18 19:02:17 +00:00
summary : Provides a list of workflows to be completed for the given study.
tags :
- Studies
parameters :
- name : study_id
2019-12-11 21:54:24 +00:00
in : path
required : true
2019-12-18 19:02:17 +00:00
description : The id of the study for which workflows should be returned.
2019-11-19 20:57:46 +00:00
schema :
type : integer
format : int32
responses :
'200' :
2019-12-18 19:02:17 +00:00
description : An array of workflows
2019-12-11 21:54:24 +00:00
content :
application/json :
2019-11-19 20:57:46 +00:00
schema :
2019-12-18 19:02:17 +00:00
type : array
items :
$ref : "#/components/schemas/Workflow"
default :
description : unexpected error
2019-11-19 20:57:46 +00:00
content :
application/json :
schema :
2019-12-11 21:54:24 +00:00
$ref : "#/components/schemas/Error"
2019-12-18 19:02:17 +00:00
post :
2020-01-14 20:39:54 +00:00
operationId : crc.api.study.add_workflow_to_study
2019-12-18 19:02:17 +00:00
summary : Starts a new workflow for the given study using the provided spec. This is atypical, and should be left to the protocol builder.
tags :
- Studies
parameters :
- name : study_id
in : path
required : true
description : The id of the study for which a workflow should start
schema :
type : integer
format : int32
2019-12-18 19:42:40 +00:00
requestBody :
content :
application/json :
schema :
$ref : '#/components/schemas/WorkflowSpec'
2019-12-18 19:02:17 +00:00
responses :
'200' :
description : An array of workflows
content :
application/json :
schema :
type : array
items :
$ref : "#/components/schemas/Workflow"
2019-11-19 20:57:46 +00:00
default :
description : unexpected error
content :
application/json :
schema :
$ref : "#/components/schemas/Error"
2019-12-18 19:02:17 +00:00
/workflow-specification :
get :
2020-01-14 20:39:54 +00:00
operationId : crc.api.workflow.all_specifications
2019-12-18 19:02:17 +00:00
summary : Provides a list of workflows specifications that can be added to a study manually. Please note that Protocol Builder will handle this most of the time.
tags :
2019-12-31 21:32:47 +00:00
- Workflows and Tasks
2019-12-18 19:02:17 +00:00
responses :
'200' :
description : An array of workflow specifications
content :
application/json :
schema :
type : array
items :
$ref : "#/components/schemas/WorkflowSpec"
default :
description : unexpected error
content :
application/json :
schema :
$ref : "#/components/schemas/Error"
2020-01-14 02:43:09 +00:00
post :
2020-01-14 20:39:54 +00:00
operationId : crc.api.workflow.add_workflow_specification
2020-01-14 02:43:09 +00:00
summary : Creates a new workflow specification with the given parameters.
tags :
- Workflows and Tasks
requestBody :
content :
application/json :
schema :
$ref : '#/components/schemas/WorkflowSpec'
responses :
'200' :
description : Workflow specification created successfully.
content :
application/json :
schema :
$ref : "#/components/schemas/WorkflowSpec"
default :
description : unexpected error
content :
application/json :
schema :
$ref : "#/components/schemas/Error"
2020-01-14 19:10:53 +00:00
/workflow-specification/{spec_id}:
put :
2020-01-14 20:39:54 +00:00
operationId : crc.api.workflow.update_workflow_specification
2020-01-14 19:10:53 +00:00
summary : Modifies an existing workflow specification with the given parameters.
tags :
- Workflows and Tasks
parameters :
- name : spec_id
in : path
required : false
description : The unique id of an existing workflow specification to modify.
schema :
type : string
requestBody :
content :
application/json :
schema :
$ref : '#/components/schemas/WorkflowSpec'
responses :
'200' :
description : Workflow specification created successfully.
content :
application/json :
schema :
$ref : "#/components/schemas/WorkflowSpec"
default :
description : unexpected error
content :
application/json :
schema :
$ref : "#/components/schemas/Error"
2019-12-27 18:50:03 +00:00
/file :
parameters :
- name : spec_id
in : query
required : false
description : The unique name of a specification
schema :
type : string
get :
2020-01-14 20:39:54 +00:00
operationId : crc.api.file.get_files
2019-12-27 18:50:03 +00:00
summary : Provides a list of files that match the given parameters (such as a spec id) IMPORTANT, only includes metadata, not the file content.
tags :
- Files
responses :
'200' :
description : An array of file descriptions (not the file content)
content :
application/json :
schema :
type : array
items :
$ref : "#/components/schemas/File"
default :
description : unexpected error
content :
application/json :
schema :
$ref : "#/components/schemas/Error"
post :
2020-01-14 20:39:54 +00:00
operationId : crc.api.file.add_file
2019-12-27 18:50:03 +00:00
summary : Add a new file
tags :
- Files
requestBody :
content :
multipart/form-data :
schema :
type : object
properties :
workflow_spec_id :
type : string
file :
type : string
format : binary
responses :
'200' :
description : Metadata about the uploaded file, but not the file content.
content :
application/json :
schema :
$ref : "#/components/schemas/File"
/file/{file_id}:
parameters :
- name : file_id
in : path
required : true
description : The id of the File requested
schema :
type : integer
get :
2020-01-14 20:39:54 +00:00
operationId : crc.api.file.get_file_info
2019-12-27 18:50:03 +00:00
summary : Returns metadata about a file.
tags :
- Files
responses :
'200' :
description : Returns the file information requested.
content :
application/json :
schema :
$ref : "#/components/schemas/File"
put :
2020-01-14 20:39:54 +00:00
operationId : crc.api.file.update_file
2019-12-27 18:50:03 +00:00
summary : Update a file
tags :
- Files
requestBody :
content :
multipart/form-data :
schema :
type : object
properties :
workflow_spec_id :
type : string
file :
type : string
format : binary
responses :
'200' :
description : Metadata about the uploaded file, but not the file content.
content :
application/json :
schema :
$ref : "#/components/schemas/File"
delete :
2020-01-14 20:39:54 +00:00
operationId : crc.api.file.delete_file
2019-12-27 18:50:03 +00:00
summary : Removes an existing file
tags :
- Files
responses :
'204' :
description : The file has been removed.
/file/{file_id}/data:
parameters :
- name : file_id
in : path
required : true
description : The id of the File requested
schema :
type : integer
get :
2020-01-14 20:39:54 +00:00
operationId : crc.api.file.get_file
2019-12-27 18:50:03 +00:00
summary : Returns only the file contents
tags :
- Files
responses :
'200' :
description : Returns the actual file
content :
application/octet-stream :
schema :
type : string
format : binary
example : '<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions></bpmn:definitions>'
# /v1.0/workflow/0
2019-12-11 21:54:24 +00:00
/workflow/{workflow_id}:
2019-12-30 18:15:39 +00:00
parameters :
2019-11-19 20:57:46 +00:00
- name : workflow_id
in : path
required : true
2019-12-11 21:54:24 +00:00
description : The id of the workflow
2019-11-19 20:57:46 +00:00
schema :
type : integer
format : int32
2019-12-30 18:15:39 +00:00
get :
2020-01-14 20:39:54 +00:00
operationId : crc.api.workflow.get_workflow
2019-12-30 18:15:39 +00:00
summary : Detailed information for a specific workflow instance
tags :
- Workflows and Tasks
2019-11-19 20:57:46 +00:00
responses :
'200' :
2019-12-11 21:54:24 +00:00
description : Returns details about the workflows state and current task
2019-11-19 20:57:46 +00:00
content :
application/json :
schema :
2019-12-11 21:54:24 +00:00
$ref : "#/components/schemas/Workflow"
2019-11-19 20:57:46 +00:00
default :
description : unexpected error
content :
application/json :
schema :
$ref : "#/components/schemas/Error"
2019-12-30 18:15:39 +00:00
delete :
2020-01-14 20:39:54 +00:00
operationId : crc.api.workflow.delete
2019-12-30 18:15:39 +00:00
summary : Removes an existing workflow
tags :
2019-12-30 18:34:18 +00:00
- Workflows and Tasks
2019-12-30 18:15:39 +00:00
responses :
'204' :
description : The workflow was removed
2019-12-19 16:58:51 +00:00
/workflow/{workflow_id}/tasks:
get :
2020-01-14 20:39:54 +00:00
operationId : crc.api.workflow.get_tasks
2019-12-19 16:58:51 +00:00
summary : Return a list of all tasks for this workflow
tags :
- Workflows and Tasks
parameters :
- name : workflow_id
in : path
required : true
description : The id of the workflow
schema :
type : integer
format : int32
responses :
'200' :
description : Expected response to a valid request
content :
application/json :
schema :
type : array
items :
$ref : "#/components/schemas/Task"
default :
description : unexpected error
content :
application/json :
schema :
$ref : "#/components/schemas/Error"
2019-12-18 19:02:17 +00:00
# /v1.0/workflow/0/task/0
2020-01-14 16:02:44 +00:00
/workflow/{workflow_id}/task/{task_id}:
2020-01-07 18:23:46 +00:00
parameters :
- name : workflow_id
in : path
required : true
description : The id of the workflow
schema :
type : integer
format : int32
2020-01-14 16:02:44 +00:00
- name : task_id
2020-01-07 18:23:46 +00:00
in : path
required : true
description : The id of the task
schema :
type : string
2020-01-14 16:02:44 +00:00
format : uuid
2019-11-19 20:57:46 +00:00
get :
2020-01-14 20:39:54 +00:00
operationId : crc.api.workflow.get_task
2019-12-18 19:02:17 +00:00
summary : Get details of specific task in specific workflow instance
2019-11-19 20:57:46 +00:00
tags :
2019-12-11 21:54:24 +00:00
- Workflows and Tasks
2019-11-19 20:57:46 +00:00
responses :
'200' :
description : Expected response to a valid request
content :
application/json :
schema :
$ref : "#/components/schemas/Task"
default :
description : unexpected error
content :
application/json :
schema :
$ref : "#/components/schemas/Error"
2020-01-14 16:02:44 +00:00
/workflow/{workflow_id}/task/{task_id}/data:
parameters :
- name : workflow_id
in : path
required : true
description : The id of the workflow
schema :
type : integer
format : int32
- name : task_id
in : path
required : true
description : The id of the task
schema :
type : string
format : uuid
2019-12-18 19:02:17 +00:00
put :
2020-01-14 20:39:54 +00:00
operationId : crc.api.workflow.update_task
2020-01-14 16:02:44 +00:00
summary : Exclusively for User Tasks, submits form data as a flat set of key/values.
2019-11-19 20:57:46 +00:00
tags :
2019-12-11 21:54:24 +00:00
- Workflows and Tasks
2020-01-14 16:02:44 +00:00
requestBody :
description : Key / Value pairs in JSON format.
required : true
content :
application/json :
schema :
type : object
example :
favorite_color : blue
capital_assyria : Assur
2019-11-19 20:57:46 +00:00
responses :
'201' :
description : Null response
default :
description : unexpected error
content :
application/json :
schema :
$ref : "#/components/schemas/Error"
components :
schemas :
2019-12-31 21:32:47 +00:00
DataModel :
properties :
id :
type : string
2019-12-11 21:54:24 +00:00
Study :
properties :
id :
2019-12-19 16:58:51 +00:00
type : integer
example : 1234
2019-12-11 21:54:24 +00:00
title :
type : string
example : The impact of fried pickles on beer consumption in bipedal software developers.
last_updated :
type : string
format : date_time
example : "2019-12-25T09:12:33.001Z"
2019-12-19 16:58:51 +00:00
protocol_builder_status :
2019-12-11 21:54:24 +00:00
type : string
2019-12-19 16:58:51 +00:00
enum : [ out_of_date, in_process, complete, updating]
2019-12-11 21:54:24 +00:00
example : done
2019-12-19 16:58:51 +00:00
primary_investigator_id :
2019-12-11 21:54:24 +00:00
type : string
example : dhf8r
sponsor :
type : string
example : "Sartography Pharmaceuticals"
ind_number :
type : string
example : "27b-6-42"
2019-12-18 19:02:17 +00:00
WorkflowSpec :
2019-12-11 21:54:24 +00:00
properties :
id :
type : string
2019-12-18 19:02:17 +00:00
display_name :
2019-12-11 21:54:24 +00:00
type : string
2019-12-18 19:02:17 +00:00
description :
2019-12-11 21:54:24 +00:00
type : string
2019-12-27 18:50:03 +00:00
File :
properties :
id :
type : number
readOnly : true
name :
type : string
example : "random_fact.bpmn"
version :
type : string
readOnly : true
last_updated :
type : string
format : date_time
example : "2019-12-25T09:12:33.001Z"
readOnly : true
type :
type : enum
enum : [ 'bpmn' , 'svg' , 'dmn' ]
readOnly : true
primary :
type : boolean
readOnly : true
content_type :
type : string
example : "application/xml"
workflow_spec_id :
type : string
example : "random_fact"
file :
type : file
format : binary
2019-12-11 21:54:24 +00:00
Workflow :
2019-11-19 20:57:46 +00:00
properties :
id :
readOnly : true
type : integer
format : int64
2019-12-18 19:02:17 +00:00
status :
2019-12-11 21:54:24 +00:00
type : enum
enum : [ 'user_input_required' , 'waiting' , 'complete' ]
2019-12-18 19:02:17 +00:00
study_id :
readOnly : true
type : integer
2020-01-06 14:18:13 +00:00
workflow_spec_id :
readOnly : true
type : String
2019-12-18 19:02:17 +00:00
current_task_ids :
type : array
items :
type : String
messages :
type : array
items :
type : String
2019-11-19 20:57:46 +00:00
example :
2019-12-11 21:54:24 +00:00
id : 291234
2019-12-18 19:02:17 +00:00
status : 'user_input_required'
current_task_ids : [ 'study_identification' , 'Detailed Reports' ]
workflow_spec :
id : 'prot_def'
display_name : 'Protocol Definition'
description : 'Collect some additional information about your protocol to complete forms and processes.'
bpmn_url : 'https://crconnect.viriginia.edu/prot_def.bpmn'
svg_url : 'https://crconnect.viriginia.edu/prot_def.svg'
2019-12-11 21:54:24 +00:00
messages : [
"Protocol Builder reports that the protocol process is complete for this study." ,
"IDS Submission Template was generated successfully."
]
Task :
2019-11-19 20:57:46 +00:00
properties :
id :
readOnly : true
2019-12-20 19:32:04 +00:00
type : string
2019-11-19 20:57:46 +00:00
name :
type : string
2019-12-20 20:39:02 +00:00
title :
type : string
2019-12-11 21:54:24 +00:00
type :
2019-11-19 20:57:46 +00:00
type : string
2019-12-20 19:32:04 +00:00
state :
2019-12-19 16:58:51 +00:00
type : string
2019-12-11 21:54:24 +00:00
form :
2019-12-18 19:02:17 +00:00
$ref : "#/components/schemas/Form"
2019-12-20 20:39:02 +00:00
documentation :
type : string
2019-11-19 20:57:46 +00:00
example :
2019-12-20 19:32:04 +00:00
id : study_identification
name : Study Identification
2019-12-20 20:39:02 +00:00
title : IRB Review
documentation : "# Heading 1\n\nMarkdown documentation text goes here"
2019-12-20 19:32:04 +00:00
type : form
state : ready
form :
"key": "irb_review_form"
"fields" :
- "id": "irb_review_type"
"type": "enum"
"label": "Select IRB Review Type"
"options" :
- id : "emergency_use"
name : "Emergency Use"
- id : "humanitarian_device"
name : "Humanitarian Device"
- id : "non_human"
name : "Non-Human"
- id : "non_uva_agent"
name : "Non-UVA Agent"
- id : "exempt"
name : "Exempt"
- id : "non_engaged"
name : "Non-Engaged"
- id : "expedited"
name : "Expedited"
- id : "full_board"
name : "Full Board"
"defaultValue": "Full Board"
"validation" :
- name : "required"
config : "true"
"properties" :
- id : "description"
value : "Description text goes here"
- id : "help"
value : "# Heading 1\n\nMarkdown help text goes here"
- id : "required_expression"
value : "model.my_boolean_field_id && model.my_enum_field_value !== 'something'"
- id : "hide_expression"
value : "model.my_enum_field_value === 'something'"
2019-12-18 19:02:17 +00:00
Form :
properties :
2019-12-20 19:32:04 +00:00
key :
type : string
2019-12-18 19:02:17 +00:00
fields :
type : array
items :
$ref : "#/components/schemas/Field"
2019-12-20 19:32:04 +00:00
example :
"key": "irb_review_form"
"fields" :
- "id": "irb_review_type"
"type": "enum"
"label": "Select IRB Review Type"
"options" :
- id : "emergency_use"
name : "Emergency Use"
- id : "humanitarian_device"
name : "Humanitarian Device"
- id : "non_human"
name : "Non-Human"
- id : "non_uva_agent"
name : "Non-UVA Agent"
- id : "exempt"
name : "Exempt"
- id : "non_engaged"
name : "Non-Engaged"
- id : "expedited"
name : "Expedited"
- id : "full_board"
name : "Full Board"
"defaultValue": "Full Board"
"validation" :
- name : "required"
config : "true"
"properties" :
- id : "description"
value : "Description text goes here"
- id : "help"
value : "# Heading 1\n\nMarkdown help text goes here"
- id : "required_expression"
value : "model.my_boolean_field_id && model.my_enum_field_value !== 'something'"
- id : "hide_expression"
value : "model.my_enum_field_value === 'something'"
2019-12-18 19:02:17 +00:00
Field :
properties :
id :
type : string
readOnly : true
type :
type : enum
2019-12-20 19:32:04 +00:00
enum : [ 'string' , 'long' , 'boolean' , 'date' , 'enum' ]
readOnly : true
label :
type : string
2019-12-18 19:02:17 +00:00
readOnly : true
options :
type : array
items :
2019-12-20 19:32:04 +00:00
$ref : "#/components/schemas/EnumFieldOption"
2019-12-18 19:02:17 +00:00
readOnly : true
2019-12-20 19:32:04 +00:00
defaultValue :
type : string
validation :
type : array
items :
$ref : "#/components/schemas/FieldValidation"
2019-12-18 19:02:17 +00:00
readOnly : true
2019-12-20 19:32:04 +00:00
"properties" :
type : array
items :
$ref : "#/components/schemas/FieldProperty"
readOnly : true
EnumFieldOption :
properties :
id :
type : string
name :
type : string
FieldValidation :
properties :
name :
type : string
config :
type : string
FieldProperty :
properties :
id :
type : string
2019-12-18 19:02:17 +00:00
value :
type : string
2019-12-20 19:32:04 +00:00
example :
id : "required_expression"
value : "model.should_require"
2019-11-19 20:57:46 +00:00
Error :
required :
- code
- message
properties :
code :
2019-12-11 21:54:24 +00:00
type : string
format : string
example : "access_denied"
2019-11-19 20:57:46 +00:00
message :
type : string
2019-12-11 21:54:24 +00:00
example : "You do not have permission to view the requested study."