Merge branch 'master' of github.com:sartography/cr-connect-workflow
This commit is contained in:
commit
1ccedbc9fd
|
@ -54,7 +54,11 @@ class Script(object):
|
||||||
return all_subclasses
|
return all_subclasses
|
||||||
|
|
||||||
def add_data_to_task(self, task, data):
|
def add_data_to_task(self, task, data):
|
||||||
task.data[self.__class__.__name__] = data
|
key = self.__class__.__name__
|
||||||
|
if key in task.data:
|
||||||
|
task.data[key].update(data)
|
||||||
|
else:
|
||||||
|
task.data[key] = data
|
||||||
|
|
||||||
class ScriptValidationError:
|
class ScriptValidationError:
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,8 @@ class StudyInfo(Script):
|
||||||
"details":
|
"details":
|
||||||
{},
|
{},
|
||||||
"approvals": {
|
"approvals": {
|
||||||
"id": 321,
|
"study_id": 12,
|
||||||
|
"workflow_id": 321,
|
||||||
"display_name": "IRB API Details",
|
"display_name": "IRB API Details",
|
||||||
"name": "irb_api_details",
|
"name": "irb_api_details",
|
||||||
"status": WorkflowStatus.not_started.value,
|
"status": WorkflowStatus.not_started.value,
|
||||||
|
@ -65,8 +66,14 @@ class StudyInfo(Script):
|
||||||
'Id': '12',
|
'Id': '12',
|
||||||
'Name': 'Certificate of Confidentiality Application',
|
'Name': 'Certificate of Confidentiality Application',
|
||||||
'count': 0,
|
'count': 0,
|
||||||
'required': False,
|
'required': True,
|
||||||
'code': 'AD_CoCApp'
|
'code': 'AD_CoCApp',
|
||||||
|
'display_name': 'Certificate of Confidentiality Application',
|
||||||
|
'file_id': 123,
|
||||||
|
'task_id': 'abcdef14236890',
|
||||||
|
'workflow_id': 456,
|
||||||
|
'workflow_spec_id': 'irb_api_details',
|
||||||
|
'status': 'complete',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -95,8 +102,6 @@ class StudyInfo(Script):
|
||||||
if cmd == 'documents_status':
|
if cmd == 'documents_status':
|
||||||
self.add_data_to_task(task, {cmd: StudyService().get_documents_status(study_id)})
|
self.add_data_to_task(task, {cmd: StudyService().get_documents_status(study_id)})
|
||||||
|
|
||||||
task.data["study"] = study_info
|
|
||||||
|
|
||||||
|
|
||||||
def check_args(self, args):
|
def check_args(self, args):
|
||||||
if len(args) != 1 or (args[0] not in StudyInfo.type_options):
|
if len(args) != 1 or (args[0] not in StudyInfo.type_options):
|
||||||
|
|
|
@ -80,7 +80,8 @@ class StudyService(object):
|
||||||
for workflow in workflows:
|
for workflow in workflows:
|
||||||
workflow: WorkflowModel = workflow
|
workflow: WorkflowModel = workflow
|
||||||
approvals.append({
|
approvals.append({
|
||||||
'id': workflow.id,
|
'study_id': study_id,
|
||||||
|
'workflow_id': workflow.id,
|
||||||
'display_name': workflow.workflow_spec.display_name,
|
'display_name': workflow.workflow_spec.display_name,
|
||||||
'name': workflow.workflow_spec.display_name,
|
'name': workflow.workflow_spec.display_name,
|
||||||
'status': workflow.status.value,
|
'status': workflow.status.value,
|
||||||
|
@ -94,7 +95,7 @@ class StudyService(object):
|
||||||
doc_service = Documents()
|
doc_service = Documents()
|
||||||
|
|
||||||
# Get PB required docs
|
# Get PB required docs
|
||||||
pb_docs = ProtocolBuilderService.get_required_docs(study_id)
|
pb_docs = ProtocolBuilderService.get_required_docs(study_id=study_id, as_objects=True)
|
||||||
|
|
||||||
# Get required docs for study
|
# Get required docs for study
|
||||||
study_docs = doc_service.get_documents(study_id=study_id, pb_docs=pb_docs)
|
study_docs = doc_service.get_documents(study_id=study_id, pb_docs=pb_docs)
|
||||||
|
@ -104,14 +105,29 @@ class StudyService(object):
|
||||||
|
|
||||||
# For each required doc, get file(s)
|
# For each required doc, get file(s)
|
||||||
for code, doc in study_docs.items():
|
for code, doc in study_docs.items():
|
||||||
|
if not doc['required']:
|
||||||
|
continue
|
||||||
|
|
||||||
doc['study_id'] = study_id
|
doc['study_id'] = study_id
|
||||||
doc['code'] = code
|
doc['code'] = code
|
||||||
doc_files = FileService.get_files(study_id=study_id, irb_doc_code=code)
|
|
||||||
|
# Make a display name out of categories if none exists
|
||||||
|
if 'Name' in doc and len(doc['Name']) > 0:
|
||||||
|
doc['display_name'] = doc['Name']
|
||||||
|
else:
|
||||||
|
name_list = []
|
||||||
|
for cat_key in ['category1', 'category2', 'category3']:
|
||||||
|
if doc[cat_key] not in ['', 'NULL']:
|
||||||
|
name_list.append(doc[cat_key])
|
||||||
|
doc['display_name'] = ' '.join(name_list)
|
||||||
|
|
||||||
# For each file, get associated workflow status
|
# For each file, get associated workflow status
|
||||||
|
doc_files = FileService.get_files(study_id=study_id, irb_doc_code=code)
|
||||||
for file in doc_files:
|
for file in doc_files:
|
||||||
doc['file_id'] = file.id
|
doc['file_id'] = file.id
|
||||||
|
doc['task_id'] = file.task_id
|
||||||
doc['workflow_id'] = file.workflow_id
|
doc['workflow_id'] = file.workflow_id
|
||||||
|
doc['workflow_spec_id'] = file.workflow_spec_id
|
||||||
|
|
||||||
if doc['status'] is None:
|
if doc['status'] is None:
|
||||||
workflow: WorkflowModel = session.query(WorkflowModel).filter_by(id=file.workflow_id).first()
|
workflow: WorkflowModel = session.query(WorkflowModel).filter_by(id=file.workflow_id).first()
|
||||||
|
|
|
@ -10,20 +10,30 @@
|
||||||
</bpmn:endEvent>
|
</bpmn:endEvent>
|
||||||
<bpmn:sequenceFlow id="Flow_0m7unlb" sourceRef="Activity_DisplayDocsAndApprovals" targetRef="EndEvent_1qvyxg7" />
|
<bpmn:sequenceFlow id="Flow_0m7unlb" sourceRef="Activity_DisplayDocsAndApprovals" targetRef="EndEvent_1qvyxg7" />
|
||||||
<bpmn:manualTask id="Activity_DisplayDocsAndApprovals" name="Display Documents and Approvals">
|
<bpmn:manualTask id="Activity_DisplayDocsAndApprovals" name="Display Documents and Approvals">
|
||||||
<bpmn:documentation>## Approvals
|
<bpmn:documentation># Documents & Approvals
|
||||||
| Name | Status | Help |
|
|
||||||
|:-------------- |:-------- |:------ |
|
> ## Protocol Document Management
|
||||||
|
> [Upload Protocol Here](/)
|
||||||
|
|
||||||
|
> ## Approvals
|
||||||
|
> | Name | Status | Help |
|
||||||
|
|:---- |:------ |:---- |
|
||||||
{% for approval in StudyInfo.approvals -%}
|
{% for approval in StudyInfo.approvals -%}
|
||||||
| [{{approval.display_name}}](/workflow/{{approval.id}}) | {{approval.status}} | [Context here](/help/{{approval.workflow_spec_id}}) |
|
| [{{approval.display_name}}](/study/{{approval.study_id}}/workflow/{{approval.workflow_id}}) | {{approval.status}} | [Context here](/help/{{approval.workflow_spec_id}}) |
|
||||||
{% endfor -%}
|
{% endfor %}
|
||||||
|
|
||||||
|
> ## Documents
|
||||||
|
> | Name | Status | Help | Download |
|
||||||
|
|:---- |:------ |:---- |:-------- |
|
||||||
|
{% for doc in StudyInfo.documents_status -%}
|
||||||
|
{% if doc.file_id is defined -%}
|
||||||
|
| [{{doc.display_name}}](/study/{{doc.study_id}}/workflow/{{doc.workflow_id}}/task/{{doc.task_id}}) | {{doc.status}} | [Context here](/help/documents/{{doc.code}}) | [Download](/file/{{doc.file_id}}) |
|
||||||
|
{%- else -%}
|
||||||
|
| {{doc.display_name}} | Not started | [Context here](/help/documents/{{doc.code}}) | No file yet |
|
||||||
|
{%- endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
## Documents
|
|
||||||
| Code | Status | Help |
|
|
||||||
|:-------------- |:-------- |:------ |
|
|
||||||
{% for doc in study.documents_status -%}
|
|
||||||
| [{{doc.code}}](/study/{{doc.study_id}}/workflow/{{doc.workflow_id}}) | {{doc.status}} | [Context here](/help/{{doc.workflow_spec_id}}) |
|
|
||||||
{% endfor -%}
|
|
||||||
</bpmn:documentation>
|
</bpmn:documentation>
|
||||||
<bpmn:extensionElements>
|
<bpmn:extensionElements>
|
||||||
<camunda:properties>
|
<camunda:properties>
|
||||||
|
|
Loading…
Reference in New Issue