Added study_id to workflow_api
This commit is contained in:
parent
09d8c8bcba
commit
24c818bf31
|
@ -427,7 +427,7 @@ paths:
|
||||||
- name: spec_id
|
- name: spec_id
|
||||||
in: path
|
in: path
|
||||||
required: true
|
required: true
|
||||||
description: The unique id of an existing workflow specification to modify.
|
description: The unique id of an existing workflow specification.
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
get:
|
get:
|
||||||
|
@ -1640,6 +1640,8 @@ components:
|
||||||
type: integer
|
type: integer
|
||||||
num_tasks_incomplete:
|
num_tasks_incomplete:
|
||||||
type: integer
|
type: integer
|
||||||
|
study_id:
|
||||||
|
type: integer
|
||||||
|
|
||||||
example:
|
example:
|
||||||
id: 291234
|
id: 291234
|
||||||
|
|
|
@ -191,7 +191,7 @@ class DocumentDirectory(object):
|
||||||
class WorkflowApi(object):
|
class WorkflowApi(object):
|
||||||
def __init__(self, id, status, next_task, navigation,
|
def __init__(self, id, status, next_task, navigation,
|
||||||
spec_version, is_latest_spec, workflow_spec_id, total_tasks, completed_tasks,
|
spec_version, is_latest_spec, workflow_spec_id, total_tasks, completed_tasks,
|
||||||
last_updated, is_review, title):
|
last_updated, is_review, title, study_id):
|
||||||
self.id = id
|
self.id = id
|
||||||
self.status = status
|
self.status = status
|
||||||
self.next_task = next_task # The next task that requires user input.
|
self.next_task = next_task # The next task that requires user input.
|
||||||
|
@ -204,13 +204,14 @@ class WorkflowApi(object):
|
||||||
self.last_updated = last_updated
|
self.last_updated = last_updated
|
||||||
self.title = title
|
self.title = title
|
||||||
self.is_review = is_review
|
self.is_review = is_review
|
||||||
|
self.study_id = study_id or ''
|
||||||
|
|
||||||
class WorkflowApiSchema(ma.Schema):
|
class WorkflowApiSchema(ma.Schema):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = WorkflowApi
|
model = WorkflowApi
|
||||||
fields = ["id", "status", "next_task", "navigation",
|
fields = ["id", "status", "next_task", "navigation",
|
||||||
"workflow_spec_id", "spec_version", "is_latest_spec", "total_tasks", "completed_tasks",
|
"workflow_spec_id", "spec_version", "is_latest_spec", "total_tasks", "completed_tasks",
|
||||||
"last_updated", "is_review", "title"]
|
"last_updated", "is_review", "title", "study_id"]
|
||||||
unknown = INCLUDE
|
unknown = INCLUDE
|
||||||
|
|
||||||
status = EnumField(WorkflowStatus)
|
status = EnumField(WorkflowStatus)
|
||||||
|
@ -221,7 +222,7 @@ class WorkflowApiSchema(ma.Schema):
|
||||||
def make_workflow(self, data, **kwargs):
|
def make_workflow(self, data, **kwargs):
|
||||||
keys = ['id', 'status', 'next_task', 'navigation',
|
keys = ['id', 'status', 'next_task', 'navigation',
|
||||||
'workflow_spec_id', 'spec_version', 'is_latest_spec', "total_tasks", "completed_tasks",
|
'workflow_spec_id', 'spec_version', 'is_latest_spec', "total_tasks", "completed_tasks",
|
||||||
"last_updated", "is_review", "title"]
|
"last_updated", "is_review", "title", "study_id"]
|
||||||
filtered_fields = {key: data[key] for key in keys}
|
filtered_fields = {key: data[key] for key in keys}
|
||||||
filtered_fields['next_task'] = TaskSchema().make_task(data['next_task'])
|
filtered_fields['next_task'] = TaskSchema().make_task(data['next_task'])
|
||||||
return WorkflowApi(**filtered_fields)
|
return WorkflowApi(**filtered_fields)
|
||||||
|
|
|
@ -408,7 +408,8 @@ class WorkflowService(object):
|
||||||
completed_tasks=processor.workflow_model.completed_tasks,
|
completed_tasks=processor.workflow_model.completed_tasks,
|
||||||
last_updated=processor.workflow_model.last_updated,
|
last_updated=processor.workflow_model.last_updated,
|
||||||
is_review=is_review,
|
is_review=is_review,
|
||||||
title=spec.display_name
|
title=spec.display_name,
|
||||||
|
study_id=processor.workflow_model.study_id or None
|
||||||
)
|
)
|
||||||
if not next_task: # The Next Task can be requested to be a certain task, useful for parallel tasks.
|
if not next_task: # The Next Task can be requested to be a certain task, useful for parallel tasks.
|
||||||
# This may or may not work, sometimes there is no next task to complete.
|
# This may or may not work, sometimes there is no next task to complete.
|
||||||
|
|
Loading…
Reference in New Issue