Deleting was broken because statistics were causing an integrity constraint.

Updating IDS bpmn to the latest for testing.
Adding a TODO
This commit is contained in:
Dan Funk 2020-04-02 12:58:52 -04:00
parent af5ab6a2c2
commit 534e8493a4
3 changed files with 32 additions and 25 deletions

View File

@ -6,7 +6,7 @@ from crc.api.common import ApiError, ApiErrorSchema
from crc.api.file import delete_file from crc.api.file import delete_file
from crc.models.api_models import Task, WorkflowApi, WorkflowApiSchema from crc.models.api_models import Task, WorkflowApi, WorkflowApiSchema
from crc.models.file import FileModel from crc.models.file import FileModel
from crc.models.stats import WorkflowStatsModel from crc.models.stats import WorkflowStatsModel, TaskEventModel
from crc.models.workflow import WorkflowModel, WorkflowSpecModelSchema, WorkflowSpecModel, WorkflowSpecCategoryModel, \ from crc.models.workflow import WorkflowModel, WorkflowSpecModelSchema, WorkflowSpecModel, WorkflowSpecCategoryModel, \
WorkflowSpecCategoryModelSchema WorkflowSpecCategoryModelSchema
from crc.services.workflow_processor import WorkflowProcessor from crc.services.workflow_processor import WorkflowProcessor
@ -116,6 +116,8 @@ def get_workflow(workflow_id, soft_reset=False, hard_reset=False):
def delete(workflow_id): def delete(workflow_id):
session.query(TaskEventModel).filter_by(workflow_id=workflow_id).delete()
session.query(WorkflowStatsModel).filter_by(workflow_id=workflow_id).delete()
session.query(WorkflowModel).filter_by(id=workflow_id).delete() session.query(WorkflowModel).filter_by(id=workflow_id).delete()
session.commit() session.commit()

View File

@ -48,6 +48,7 @@ class Task(object):
except jinja2.exceptions.UndefinedError as ue: except jinja2.exceptions.UndefinedError as ue:
raise ApiError(code="template_error", message="Error processing template for task %s: %s" % raise ApiError(code="template_error", message="Error processing template for task %s: %s" %
(self.name, str(ue)), status_code=500) (self.name, str(ue)), status_code=500)
# TODO: Catch additional errors and report back.
class OptionSchema(ma.Schema): class OptionSchema(ma.Schema):
class Meta: class Meta:

View File

@ -4,7 +4,7 @@
<bpmn:startEvent id="StartEvent_1"> <bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>SequenceFlow_0hr4ghe</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_0hr4ghe</bpmn:outgoing>
</bpmn:startEvent> </bpmn:startEvent>
<bpmn:userTask id="Task_0nz6wkk" name="Enter IDS Study Identification" camunda:formKey="FormKey_StudyID"> <bpmn:userTask id="Task_0nz6wkk" name="Enter IDS Study Identification" camunda:formKey="IDS Study ID">
<bpmn:documentation>#### Instructions <bpmn:documentation>#### Instructions
According to selected Study Type: Treatment (TRE), IDS applicable for this type of study: Yes</bpmn:documentation> According to selected Study Type: Treatment (TRE), IDS applicable for this type of study: Yes</bpmn:documentation>
@ -39,7 +39,7 @@ According to selected Study Type: Treatment (TRE), IDS applicable for this type
<bpmn:incoming>SequenceFlow_1guaev4</bpmn:incoming> <bpmn:incoming>SequenceFlow_1guaev4</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1iiazgn</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_1iiazgn</bpmn:outgoing>
</bpmn:userTask> </bpmn:userTask>
<bpmn:userTask id="Task_10vwq9y" name="Enter IDS Fee Structure" camunda:formKey="FormKey_FeeStructure"> <bpmn:userTask id="Task_10vwq9y" name="Enter IDS Fee Structure" camunda:formKey="IDS Fee Structure">
<bpmn:documentation>#### How to <bpmn:documentation>#### How to
IDS service fees are based on the Protocol Owner identified in Common Study section of the workflow. IDS service fees are based on the Protocol Owner identified in Common Study section of the workflow.
@ -89,14 +89,15 @@ Protocol Owner: **(need to insert value here)**</bpmn:documentation>
</bpmn:endEvent> </bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_0t9ss6z" sourceRef="ExclusiveGateway_1b69uum" targetRef="Task_0o7fpjo" /> <bpmn:sequenceFlow id="SequenceFlow_0t9ss6z" sourceRef="ExclusiveGateway_1b69uum" targetRef="Task_0o7fpjo" />
<bpmn:sequenceFlow id="SequenceFlow_0y21euo" sourceRef="ExclusiveGateway_14igy57" targetRef="Task_0euyl7m" /> <bpmn:sequenceFlow id="SequenceFlow_0y21euo" sourceRef="ExclusiveGateway_14igy57" targetRef="Task_0euyl7m" />
<bpmn:userTask id="Task_0euyl7m" name="Review Pharmacy Manual Status" camunda:formKey="FormKey_PharManualStauts"> <bpmn:userTask id="Task_0euyl7m" name="Review Pharmacy Manual Status" camunda:formKey="Pharmacy Manual Status">
<bpmn:documentation>{% if IRB_UplCnt.DrugDeviceDocument.PharmacyManual &gt; 0 %} <bpmn:documentation>{% if IRB_UplCnt.DrugDeviceDocument.PharmacyManual &gt; 0 %}
{% if IRB_UplCnt.DrugDeviceDocument.PharmacyManual = 1 %} {% if IRB_UplCnt.DrugDeviceDocument.PharmacyManual == 1 %}
{{IRB_UplCnt.DrugDeviceDocument.PharmacyManual ~ "Pharmacy Manual Uploaded"}} {{IRB_UplCnt.DrugDeviceDocument.PharmacyManual}} Pharmacy Manual Uploaded
"This manual will be sent as part of your IDS Submission" "This manual will be sent as part of your IDS Submission"
{% else %} {% else %}
{{IRB_UplCnt.DrugDeviceDocument.PharmacyManual ~ "Pharmacy Manuals Uploaded"}} {{IRB_UplCnt.DrugDeviceDocument.PharmacyManual}} Pharmacy Manuals Uploaded
"These manuals will be sent as part of your IDS Submission "These manuals will be sent as part of your IDS Submission
{% endif %}
{% else %} {% else %}
"The Pharmacy Manual has not been uploaded. If you do not intend to upload a manual before you IDS submission, please complete the questions below. If you do intend to upload a manual, you do not need to complete them" "The Pharmacy Manual has not been uploaded. If you do not intend to upload a manual before you IDS submission, please complete the questions below. If you do intend to upload a manual, you do not need to complete them"
{% endif %}</bpmn:documentation> {% endif %}</bpmn:documentation>
@ -125,15 +126,10 @@ Protocol Owner: **(need to insert value here)**</bpmn:documentation>
<bpmn:userTask id="Task_0uxe1xf" name="Specify Submission Type" camunda:formKey="SubmissionType"> <bpmn:userTask id="Task_0uxe1xf" name="Specify Submission Type" camunda:formKey="SubmissionType">
<bpmn:extensionElements> <bpmn:extensionElements>
<camunda:formData> <camunda:formData>
<camunda:formField id="isWaiver" label="Will Study submit an IDS Waiver?" type="enum"> <camunda:formField id="isWaiver" label="Will Study submit an IDS Waiver?" type="boolean">
<camunda:properties>
<camunda:property id="enum_type" value="radio" />
</camunda:properties>
<camunda:validation> <camunda:validation>
<camunda:constraint name="required" config="true" /> <camunda:constraint name="required" config="true" />
</camunda:validation> </camunda:validation>
<camunda:value id="WaiverYes" name="Yes" />
<camunda:value id="WaiverNo" name="No" />
</camunda:formField> </camunda:formField>
</camunda:formData> </camunda:formData>
</bpmn:extensionElements> </bpmn:extensionElements>
@ -146,12 +142,12 @@ Protocol Owner: **(need to insert value here)**</bpmn:documentation>
<bpmn:outgoing>SequenceFlow_1w7dlq7</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_1w7dlq7</bpmn:outgoing>
</bpmn:exclusiveGateway> </bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_14hktr4" name="Full Submission" sourceRef="ExclusiveGateway_1vv218v" targetRef="Task_06lq8jt"> <bpmn:sequenceFlow id="SequenceFlow_14hktr4" name="Full Submission" sourceRef="ExclusiveGateway_1vv218v" targetRef="Task_06lq8jt">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">isWaiver = False</bpmn:conditionExpression> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">isWaiver == False</bpmn:conditionExpression>
</bpmn:sequenceFlow> </bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1w7dlq7" name="Waiver" sourceRef="ExclusiveGateway_1vv218v" targetRef="Task_03qocve"> <bpmn:sequenceFlow id="SequenceFlow_1w7dlq7" name="Waiver" sourceRef="ExclusiveGateway_1vv218v" targetRef="Task_03qocve">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">isWaiver == True</bpmn:conditionExpression> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">isWaiver == True</bpmn:conditionExpression>
</bpmn:sequenceFlow> </bpmn:sequenceFlow>
<bpmn:userTask id="Task_03qocve" name="Submit Waiver" camunda:formKey="FormKey_SubmitWaiver"> <bpmn:userTask id="Task_03qocve" name="Submit Waiver" camunda:formKey="Submit Waiver">
<bpmn:extensionElements> <bpmn:extensionElements>
<camunda:formData> <camunda:formData>
<camunda:formField id="FormField_Upload" label="Upload " type="file" /> <camunda:formField id="FormField_Upload" label="Upload " type="file" />
@ -161,19 +157,26 @@ Protocol Owner: **(need to insert value here)**</bpmn:documentation>
<bpmn:outgoing>SequenceFlow_0yzkn64</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_0yzkn64</bpmn:outgoing>
</bpmn:userTask> </bpmn:userTask>
<bpmn:sequenceFlow id="SequenceFlow_0yzkn64" sourceRef="Task_03qocve" targetRef="Task_14y55zq" /> <bpmn:sequenceFlow id="SequenceFlow_0yzkn64" sourceRef="Task_03qocve" targetRef="Task_14y55zq" />
<bpmn:userTask id="Task_14y55zq" name="Approve Waiver"> <bpmn:userTask id="Task_14y55zq" name="Approve Waiver" camunda:formKey="Approve Waiver">
<bpmn:extensionElements>
<camunda:formData>
<camunda:formField id="FormField_isApporved" label="Waiver Approved?" type="boolean" />
<camunda:formField id="FormField_FileUpload" label="IDS Waiver Application approved by IDS" type="file" />
</camunda:formData>
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0yzkn64</bpmn:incoming> <bpmn:incoming>SequenceFlow_0yzkn64</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0jqi0ps</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_0jqi0ps</bpmn:outgoing>
</bpmn:userTask> </bpmn:userTask>
<bpmn:sequenceFlow id="SequenceFlow_0jqi0ps" sourceRef="Task_14y55zq" targetRef="ExclusiveGateway_0mat0ea" /> <bpmn:sequenceFlow id="SequenceFlow_0jqi0ps" sourceRef="Task_14y55zq" targetRef="ExclusiveGateway_0mat0ea" />
<bpmn:userTask id="UserTask_0uvz4r8" name="Review Investigator&#39;s Brochure Status" camunda:formKey="FormKey_InvestBrochStauts"> <bpmn:userTask id="UserTask_0uvz4r8" name="Review Investigator&#39;s Brochure Status" camunda:formKey="Investigator&#39;s Brochure Status">
<bpmn:documentation>{% if IRB_UplCnt.DrugDeviceDocument.InvestigatorBrochure &gt; 0 %} <bpmn:documentation>{% if IRB_UplCnt.DrugDeviceDocument.InvestigatorBrochure &gt; 0 %}
{% if IRB_UplCnt.DrugDeviceDocument.InvestigatorBrochure == 1 %} {% if IRB_UplCnt.DrugDeviceDocument.InvestigatorBrochure == 1 %}
{{IRB_UplCnt.DrugDeviceDocument.InvestigatorBrochure ~ "Pharmacy Manual Uploaded"}} {{IRB_UplCnt.DrugDeviceDocument.InvestigatorBrochure}} Pharmacy Manual Uploaded
"This brochure will be sent as part of your IDS Submission" "This brochure will be sent as part of your IDS Submission"
{% else %} {% else %}
{{IRB_UplCnt.DrugDeviceDocument.InvestigatorBrochure ~ "Pharmacy Manuals Uploaded"}} {{IRB_UplCnt.DrugDeviceDocument.InvestigatorBrochure}} Pharmacy Manuals Uploaded
"These brochures will be sent as part of your IDS Submission "These brochures will be sent as part of your IDS Submission
{% endif %}
{% else %} {% else %}
"The Investigator's Brochure has not been uploaded. If you do not intend to upload a manual before you IDS submission, please complete the questions below. If you do intend to upload a manual, you do not need to complete them" "The Investigator's Brochure has not been uploaded. If you do not intend to upload a manual before you IDS submission, please complete the questions below. If you do intend to upload a manual, you do not need to complete them"
{% endif %}</bpmn:documentation> {% endif %}</bpmn:documentation>
@ -199,16 +202,17 @@ Protocol Owner: **(need to insert value here)**</bpmn:documentation>
</bpmn:userTask> </bpmn:userTask>
<bpmn:sequenceFlow id="SequenceFlow_0jwnfzy" sourceRef="ExclusiveGateway_14igy57" targetRef="UserTask_0uvz4r8" /> <bpmn:sequenceFlow id="SequenceFlow_0jwnfzy" sourceRef="ExclusiveGateway_14igy57" targetRef="UserTask_0uvz4r8" />
<bpmn:sequenceFlow id="SequenceFlow_13fzv9y" sourceRef="UserTask_0uvz4r8" targetRef="ExclusiveGateway_1b69uum" /> <bpmn:sequenceFlow id="SequenceFlow_13fzv9y" sourceRef="UserTask_0uvz4r8" targetRef="ExclusiveGateway_1b69uum" />
<bpmn:userTask id="UserTask_06sfx4u" name="Review IVRS/IWRS/IXRS Manual Status" camunda:formKey="FormKey_IVRS/IWRS/IXRS ManualStauts"> <bpmn:userTask id="UserTask_06sfx4u" name="Review IVRS/IWRS/IXRS Manual Status" camunda:formKey="IVRS/IWRS/IXRS Manual Status">
<bpmn:documentation>{% if IRB_UplCnt.DrugDeviceDocument.IVRSIWRSIXRSManual &gt; 0 %} <bpmn:documentation>{% if IRB_UplCnt.DrugDeviceDocument.IVRSIWRSIXRSManual &gt; 0 %}
{% if IRB_UplCnt.DrugDeviceDocument.IVRSIWRSIXRSManual = 1 %} {% if IRB_UplCnt.DrugDeviceDocument.IVRSIWRSIXRSManual == 1 %}
{{IRB_UplCnt.DrugDeviceDocument.IVRSIWRSIXRSManual ~ "Pharmacy Manual Uploaded"}} {{IRB_UplCnt.DrugDeviceDocument.IVRSIWRSIXRSManual}} Pharmacy Manual Uploaded
"This manual will be sent as part of your IDS Submission" "This manual will be sent as part of your IDS Submission"
{% else %} {% else %}
{{IRB_UplCnt.DrugDeviceDocument.IVRSIWRSIXRSManual ~ "Pharmacy Manuals Uploaded"}} {{IRB_UplCnt.DrugDeviceDocument.IVRSIWRSIXRSManual}} Pharmacy Manuals Uploaded
"These manuals will be sent as part of your IDS Submission "These manuals will be sent as part of your IDS Submission
{% endif %}
{% else %} {% else %}
"The IVRS/IWRS/IXRS Manual has not been uploaded. If you do not intend to upload a manual before you IDS submission, please complete the questions below. If you do intend to upload a manual, you do not need to complete them" "The IVRS/IWRS/IXRS Manual has not been uploaded. If you do not intend to upload a manual before you IDS submission, please complete the questions below. If you do intend to upload a manual, you do not need to complete them"
{% endif %}</bpmn:documentation> {% endif %}</bpmn:documentation>
<bpmn:extensionElements> <bpmn:extensionElements>
<camunda:formData> <camunda:formData>
@ -252,7 +256,7 @@ Protocol Owner: **(need to insert value here)**</bpmn:documentation>
<bpmn:sequenceFlow id="SequenceFlow_1lys0jq" sourceRef="ExclusiveGateway_14igy57" targetRef="UserTask_06sfx4u" /> <bpmn:sequenceFlow id="SequenceFlow_1lys0jq" sourceRef="ExclusiveGateway_14igy57" targetRef="UserTask_06sfx4u" />
<bpmn:sequenceFlow id="SequenceFlow_0m01j99" sourceRef="UserTask_06sfx4u" targetRef="ExclusiveGateway_1b69uum" /> <bpmn:sequenceFlow id="SequenceFlow_0m01j99" sourceRef="UserTask_06sfx4u" targetRef="ExclusiveGateway_1b69uum" />
<bpmn:sequenceFlow id="SequenceFlow_06jbdfp" sourceRef="Task_0o7fpjo" targetRef="ExclusiveGateway_0mat0ea" /> <bpmn:sequenceFlow id="SequenceFlow_06jbdfp" sourceRef="Task_0o7fpjo" targetRef="ExclusiveGateway_0mat0ea" />
<bpmn:userTask id="Task_0o7fpjo" name="Enter Staff Training" camunda:formKey="FormKey_StaffTraining"> <bpmn:userTask id="Task_0o7fpjo" name="Enter Staff Training" camunda:formKey="Staff Training">
<bpmn:extensionElements> <bpmn:extensionElements>
<camunda:formData> <camunda:formData>
<camunda:formField id="FormField_isStaffTraining" label="Is there any sponsor-required protocol training for IDS staff (web training, slide review, etc) that must be completed prior to beginning the study?" type="enum"> <camunda:formField id="FormField_isStaffTraining" label="Is there any sponsor-required protocol training for IDS staff (web training, slide review, etc) that must be completed prior to beginning the study?" type="enum">