Merge branch 'master' of github.com:sartography/cr-connect-workflow

This commit is contained in:
Dan Funk 2020-04-24 07:01:40 -04:00
commit 1ccedbc9fd
4 changed files with 55 additions and 20 deletions

View File

@ -54,7 +54,11 @@ class Script(object):
return all_subclasses
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:

View File

@ -50,7 +50,8 @@ class StudyInfo(Script):
"details":
{},
"approvals": {
"id": 321,
"study_id": 12,
"workflow_id": 321,
"display_name": "IRB API Details",
"name": "irb_api_details",
"status": WorkflowStatus.not_started.value,
@ -65,8 +66,14 @@ class StudyInfo(Script):
'Id': '12',
'Name': 'Certificate of Confidentiality Application',
'count': 0,
'required': False,
'code': 'AD_CoCApp'
'required': True,
'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':
self.add_data_to_task(task, {cmd: StudyService().get_documents_status(study_id)})
task.data["study"] = study_info
def check_args(self, args):
if len(args) != 1 or (args[0] not in StudyInfo.type_options):

View File

@ -80,7 +80,8 @@ class StudyService(object):
for workflow in workflows:
workflow: WorkflowModel = workflow
approvals.append({
'id': workflow.id,
'study_id': study_id,
'workflow_id': workflow.id,
'display_name': workflow.workflow_spec.display_name,
'name': workflow.workflow_spec.display_name,
'status': workflow.status.value,
@ -94,7 +95,7 @@ class StudyService(object):
doc_service = Documents()
# 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
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 code, doc in study_docs.items():
if not doc['required']:
continue
doc['study_id'] = study_id
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
doc_files = FileService.get_files(study_id=study_id, irb_doc_code=code)
for file in doc_files:
doc['file_id'] = file.id
doc['task_id'] = file.task_id
doc['workflow_id'] = file.workflow_id
doc['workflow_spec_id'] = file.workflow_spec_id
if doc['status'] is None:
workflow: WorkflowModel = session.query(WorkflowModel).filter_by(id=file.workflow_id).first()

View File

@ -10,20 +10,30 @@
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_0m7unlb" sourceRef="Activity_DisplayDocsAndApprovals" targetRef="EndEvent_1qvyxg7" />
<bpmn:manualTask id="Activity_DisplayDocsAndApprovals" name="Display Documents and Approvals">
<bpmn:documentation>## Approvals
| Name | Status | Help |
|:-------------- |:-------- |:------ |
<bpmn:documentation># Documents &amp; Approvals
&gt; ## Protocol Document Management
&gt; [Upload Protocol Here](/)
&gt; ## Approvals
&gt; | Name | Status | Help |
|:---- |:------ |:---- |
{% for approval in StudyInfo.approvals -%}
| [{{approval.display_name}}](/workflow/{{approval.id}}) | {{approval.status}} | [Context here](/help/{{approval.workflow_spec_id}}) |
{% endfor -%}
| [{{approval.display_name}}](/study/{{approval.study_id}}/workflow/{{approval.workflow_id}}) | {{approval.status}} | [Context here](/help/{{approval.workflow_spec_id}}) |
{% endfor %}
&gt; ## Documents
&gt; | 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:extensionElements>
<camunda:properties>