merge conflicts
This commit is contained in:
commit
2ac2514e32
|
@ -0,0 +1,26 @@
|
|||
FROM python:3.6-stretch
|
||||
|
||||
ENV PATH=/root/.local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
||||
|
||||
# install node and yarn
|
||||
RUN apt-get update
|
||||
RUN apt-get -y install postgresql-client
|
||||
|
||||
# config project dir
|
||||
RUN mkdir /crc-workflow
|
||||
WORKDIR /crc-workflow
|
||||
|
||||
# install python requirements
|
||||
RUN pip install pipenv
|
||||
ADD Pipfile /crc-workflow/
|
||||
ADD Pipfile.lock /crc-workflow/
|
||||
RUN pipenv install --dev
|
||||
|
||||
# include rejoiner code (gets overriden by local changes)
|
||||
COPY . /crc-workflow/
|
||||
|
||||
# run webserver by default
|
||||
CMD ["pipenv", "run", "python", "/crc-workflow/run.py"]
|
||||
|
||||
# expose ports
|
||||
EXPOSE 5000
|
148
crc/api.yml
148
crc/api.yml
|
@ -1,4 +1,4 @@
|
|||
openapi: "3.0.0"
|
||||
openapi: "3.0.2"
|
||||
info:
|
||||
version: 1.0.0
|
||||
title: Workflow Microservice
|
||||
|
@ -525,58 +525,156 @@ components:
|
|||
properties:
|
||||
id:
|
||||
readOnly: true
|
||||
type: integer
|
||||
format: int64
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
status:
|
||||
state:
|
||||
type: string
|
||||
form:
|
||||
$ref: "#/components/schemas/Form"
|
||||
documentation:
|
||||
type: string
|
||||
example:
|
||||
{
|
||||
id: study_identification,
|
||||
name: "Study Identification",
|
||||
state: "ready",
|
||||
type: "form",
|
||||
form: {
|
||||
key: "oncology_form",
|
||||
field: {
|
||||
id: "is_adult_patient",
|
||||
type: enum,
|
||||
label: "Is this study treating adult oncology patients?",
|
||||
options: ["yes", "no"],
|
||||
value: "yes"
|
||||
}
|
||||
}
|
||||
}
|
||||
id: study_identification
|
||||
name: Study Identification
|
||||
title: IRB Review
|
||||
documentation: "# Heading 1\n\nMarkdown documentation text goes here"
|
||||
type: form
|
||||
state: ready
|
||||
form:
|
||||
"key": "irb_review_form"
|
||||
"fields":
|
||||
- "id": "irb_review_type"
|
||||
"type": "enum"
|
||||
"label": "Select IRB Review Type"
|
||||
"options":
|
||||
- id: "emergency_use"
|
||||
name: "Emergency Use"
|
||||
- id: "humanitarian_device"
|
||||
name: "Humanitarian Device"
|
||||
- id: "non_human"
|
||||
name: "Non-Human"
|
||||
- id: "non_uva_agent"
|
||||
name: "Non-UVA Agent"
|
||||
- id: "exempt"
|
||||
name: "Exempt"
|
||||
- id: "non_engaged"
|
||||
name: "Non-Engaged"
|
||||
- id: "expedited"
|
||||
name: "Expedited"
|
||||
- id: "full_board"
|
||||
name: "Full Board"
|
||||
"defaultValue": "Full Board"
|
||||
"validation":
|
||||
- name: "required"
|
||||
config: "true"
|
||||
"properties":
|
||||
- id: "description"
|
||||
value: "Description text goes here"
|
||||
- id: "help"
|
||||
value: "# Heading 1\n\nMarkdown help text goes here"
|
||||
- id: "required_expression"
|
||||
value: "model.my_boolean_field_id && model.my_enum_field_value !== 'something'"
|
||||
- id: "hide_expression"
|
||||
value: "model.my_enum_field_value === 'something'"
|
||||
Form:
|
||||
properties:
|
||||
key:
|
||||
type: string
|
||||
fields:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/Field"
|
||||
example:
|
||||
"key": "irb_review_form"
|
||||
"fields":
|
||||
- "id": "irb_review_type"
|
||||
"type": "enum"
|
||||
"label": "Select IRB Review Type"
|
||||
"options":
|
||||
- id: "emergency_use"
|
||||
name: "Emergency Use"
|
||||
- id: "humanitarian_device"
|
||||
name: "Humanitarian Device"
|
||||
- id: "non_human"
|
||||
name: "Non-Human"
|
||||
- id: "non_uva_agent"
|
||||
name: "Non-UVA Agent"
|
||||
- id: "exempt"
|
||||
name: "Exempt"
|
||||
- id: "non_engaged"
|
||||
name: "Non-Engaged"
|
||||
- id: "expedited"
|
||||
name: "Expedited"
|
||||
- id: "full_board"
|
||||
name: "Full Board"
|
||||
"defaultValue": "Full Board"
|
||||
"validation":
|
||||
- name: "required"
|
||||
config: "true"
|
||||
"properties":
|
||||
- id: "description"
|
||||
value: "Description text goes here"
|
||||
- id: "help"
|
||||
value: "# Heading 1\n\nMarkdown help text goes here"
|
||||
- id: "required_expression"
|
||||
value: "model.my_boolean_field_id && model.my_enum_field_value !== 'something'"
|
||||
- id: "hide_expression"
|
||||
value: "model.my_enum_field_value === 'something'"
|
||||
Field:
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
readOnly: true
|
||||
label:
|
||||
type: string
|
||||
readOnly: true
|
||||
type:
|
||||
type: enum
|
||||
enum: ['text','number', 'enum']
|
||||
enum: ['string', 'long', 'boolean', 'date', 'enum']
|
||||
readOnly: true
|
||||
label:
|
||||
type: string
|
||||
readOnly: true
|
||||
options:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
$ref: "#/components/schemas/EnumFieldOption"
|
||||
readOnly: true
|
||||
defaultValue:
|
||||
type: string
|
||||
validation:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/FieldValidation"
|
||||
readOnly: true
|
||||
"properties":
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/FieldProperty"
|
||||
readOnly: true
|
||||
EnumFieldOption:
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
FieldValidation:
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
config:
|
||||
type: string
|
||||
FieldProperty:
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
value:
|
||||
type: string
|
||||
example:
|
||||
id: "required_expression"
|
||||
value: "model.should_require"
|
||||
Error:
|
||||
required:
|
||||
- code
|
||||
|
|
|
@ -2,7 +2,7 @@ import enum
|
|||
|
||||
from SpiffWorkflow import Task
|
||||
from flask_marshmallow.sqla import ModelSchema
|
||||
from marshmallow import post_load, fields, Schema
|
||||
from marshmallow import post_load, fields
|
||||
from marshmallow_enum import EnumField
|
||||
from sqlalchemy import func
|
||||
|
||||
|
@ -30,6 +30,7 @@ class StudyModel(db.Model):
|
|||
class StudySchema(ModelSchema):
|
||||
class Meta:
|
||||
model = StudyModel
|
||||
|
||||
protocol_builder_status = EnumField(ProtocolBuilderStatus)
|
||||
|
||||
|
||||
|
@ -95,24 +96,29 @@ class WorkflowModel(db.Model):
|
|||
class WorkflowSchema(ModelSchema):
|
||||
class Meta:
|
||||
model = WorkflowModel
|
||||
|
||||
status = EnumField(WorkflowStatus)
|
||||
|
||||
|
||||
class Task:
|
||||
def __init__(self, id, name, type, state, form):
|
||||
def __init__(self, id, name, title, type, state, form, documentation):
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.title = title
|
||||
self.type = type
|
||||
self.state = state
|
||||
self.form = form
|
||||
self.documentation = documentation
|
||||
|
||||
@classmethod
|
||||
def from_spiff(cls, spiff_task):
|
||||
instance = cls(spiff_task.id,
|
||||
spiff_task.task_spec.name,
|
||||
spiff_task.task_spec.description,
|
||||
spiff_task.get_state_name(),
|
||||
"task",
|
||||
{})
|
||||
{},
|
||||
spiff_task.task_spec.documentation)
|
||||
if hasattr(spiff_task.task_spec, "form"):
|
||||
instance.type = "form"
|
||||
instance.form = spiff_task.task_spec.form
|
||||
|
@ -124,25 +130,40 @@ class OptionSchema(ma.Schema):
|
|||
fields = ["id", "name"]
|
||||
|
||||
|
||||
class ValidationSchema(ma.Schema):
|
||||
class Meta:
|
||||
fields = ["name", "config"]
|
||||
|
||||
|
||||
class PropertiesSchema(ma.Schema):
|
||||
class Meta:
|
||||
fields = ["id", "value"]
|
||||
|
||||
|
||||
class FieldSchema(ma.Schema):
|
||||
class Meta:
|
||||
fields = ["id", "type", "label", "defaultValue", "options"]
|
||||
fields = [
|
||||
"id", "type", "label", "defaultValue", "options", "validation", "properties"
|
||||
]
|
||||
|
||||
options = fields.List(fields.Nested(OptionSchema))
|
||||
validation = fields.List(fields.Nested(ValidationSchema))
|
||||
properties = fields.List(fields.Nested(PropertiesSchema))
|
||||
|
||||
|
||||
class FormSchema(ma.Schema):
|
||||
class Meta:
|
||||
fields = ["key", "fields"]
|
||||
|
||||
fields = fields.List(fields.Nested(FieldSchema))
|
||||
|
||||
|
||||
class TaskSchema(ma.Schema):
|
||||
class Meta:
|
||||
fields = ["id", "name", "type", "state", "form"]
|
||||
fields = ["id", "name", "title", "type", "state", "form", "documentation"]
|
||||
|
||||
form = fields.Nested(FormSchema)
|
||||
|
||||
@post_load
|
||||
def make_task(self, data, **kwargs):
|
||||
return Task(**data)
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1gjhqt9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
|
||||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1gjhqt9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.6.0-dev">
|
||||
<bpmn:process id="Process_1ds61df" isExecutable="true">
|
||||
<bpmn:startEvent id="StartEvent_1">
|
||||
<bpmn:outgoing>SequenceFlow_0ik56h0</bpmn:outgoing>
|
||||
</bpmn:startEvent>
|
||||
<bpmn:sequenceFlow id="SequenceFlow_0ik56h0" sourceRef="StartEvent_1" targetRef="Task_User_Select_Type" />
|
||||
<bpmn:userTask id="Task_User_Select_Type" name="Set Type" camunda:formKey="Fact">
|
||||
<bpmn:userTask id="Task_User_Select_Type" name="Set Type" camunda:formKey="Get A Random Fun Fact">
|
||||
<bpmn:documentation>Here's some documentation</bpmn:documentation>
|
||||
<bpmn:extensionElements>
|
||||
<camunda:formData>
|
||||
<camunda:formField id="type" label="Type" type="enum" defaultValue="cat">
|
||||
|
@ -13,6 +14,42 @@
|
|||
<camunda:value id="cat" name="Cat Fact" />
|
||||
<camunda:value id="buzzword" name="Business Buzzword" />
|
||||
</camunda:formField>
|
||||
<camunda:formField id="is_anonymous" label="Do you want to remain anonymous?" type="boolean">
|
||||
<camunda:properties>
|
||||
<camunda:property id="description" value="Choose "yes" if you don't want us to use your name" />
|
||||
<camunda:property id="help" value="# Heading 1\n\nOh hey, it's Markdown text." />
|
||||
</camunda:properties>
|
||||
<camunda:validation>
|
||||
<camunda:constraint name="required" config="true" />
|
||||
</camunda:validation>
|
||||
</camunda:formField>
|
||||
<camunda:formField id="name" label="Your full name" type="string">
|
||||
<camunda:properties>
|
||||
<camunda:property id="description" value="Please enter your first and last name." />
|
||||
<camunda:property id="help" value="# Heading 1\n\nLook, it's some Markdown!" />
|
||||
<camunda:property id="hide_expression" value="model.is_anonymous" />
|
||||
</camunda:properties>
|
||||
<camunda:validation>
|
||||
<camunda:constraint name="required" config="true" />
|
||||
</camunda:validation>
|
||||
</camunda:formField>
|
||||
<camunda:formField id="should_send_greeting" label="Say hi to user?" type="enum" defaultValue="yes">
|
||||
<camunda:properties>
|
||||
<camunda:property id="label_expression" value="model.name ? 'Say hi to ' + model.name + '?' : 'Say hi?'" />
|
||||
<camunda:property id="hide_expression" value="model.is_anonymous" />
|
||||
</camunda:properties>
|
||||
<camunda:value id="no" name="No!" />
|
||||
<camunda:value id="yes" name="Yes!" />
|
||||
<camunda:value id="maybe" name="Meh." />
|
||||
</camunda:formField>
|
||||
<camunda:formField id="random_num" label="Pick a number, any number." type="enum">
|
||||
<camunda:properties>
|
||||
<camunda:property id="enum_type" value="checkbox" />
|
||||
</camunda:properties>
|
||||
<camunda:value id="Value_190fel2" name="42" />
|
||||
<camunda:value id="Value_2mknvfh" name="21" />
|
||||
<camunda:value id="Value_1atqgco" name="7" />
|
||||
</camunda:formField>
|
||||
</camunda:formData>
|
||||
<camunda:properties>
|
||||
<camunda:property name="type" value="string" />
|
||||
|
|
|
@ -6,13 +6,26 @@ from crc.models import StudyModel, WorkflowSpecModel, FileType, FileModel, FileD
|
|||
|
||||
|
||||
class ExampleDataLoader:
|
||||
studies = [StudyModel(id=1,
|
||||
title='The impact of fried pickles on beer consumption in bipedal software developers.',
|
||||
last_updated=datetime.datetime.now(),
|
||||
protocol_builder_status='in_process',
|
||||
primary_investigator_id='dhf8r',
|
||||
sponsor='Sartography Pharmaceuticals',
|
||||
ind_number='1234')]
|
||||
studies = [
|
||||
StudyModel(
|
||||
id=1,
|
||||
title='The impact of fried pickles on beer consumption in bipedal software developers.',
|
||||
last_updated=datetime.datetime.now(),
|
||||
protocol_builder_status='in_process',
|
||||
primary_investigator_id='dhf8r',
|
||||
sponsor='Sartography Pharmaceuticals',
|
||||
ind_number='1234'
|
||||
),
|
||||
StudyModel(
|
||||
id=2,
|
||||
title='Requirement of hippocampal neurogenesis for the behavioral effects of soft pretzels',
|
||||
last_updated=datetime.datetime.now(),
|
||||
protocol_builder_status='in_process',
|
||||
primary_investigator_id='dhf8r',
|
||||
sponsor='Makerspace & Co.',
|
||||
ind_number='5678'
|
||||
),
|
||||
]
|
||||
|
||||
workflow_specs = [WorkflowSpecModel(
|
||||
id="random_fact",
|
||||
|
|
Loading…
Reference in New Issue