Adds more useful metadata to approvals and documents status scripts. Fleshes out and pretties up Documents & Approvals screen
This commit is contained in:
parent
47de010a88
commit
af1bb9f80d
|
@ -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',
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
@ -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()
|
||||
|
|
|
@ -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 & Approvals
|
||||
|
||||
> ## Protocol Document Management
|
||||
> [Upload Protocol Here](/)
|
||||
|
||||
> ## Approvals
|
||||
> | Name | Status | Help |
|
||||
|:---- |:------ |:---- |
|
||||
{% 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 %}
|
||||
|
||||
|
||||
## Documents
|
||||
| Code | Status | Help |
|
||||
|:-------------- |:-------- |:------ |
|
||||
> ## Documents
|
||||
> | Name | Status | Help | Download |
|
||||
|:---- |:------ |:---- |:-------- |
|
||||
{% for doc in StudyInfo.documents_status -%}
|
||||
| [{{doc.code}}](/study/{{doc.study_id}}/workflow/{{doc.workflow_id}}) | {{doc.status}} | [Context here](/help/{{doc.workflow_spec_id}}) |
|
||||
{% 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 %}
|
||||
|
||||
|
||||
</bpmn:documentation>
|
||||
<bpmn:extensionElements>
|
||||
<camunda:properties>
|
||||
|
|
Loading…
Reference in New Issue