Beispiel #1
0
def checklist_workflow():
    EXTERNAL_REVIEW_GROUP = 'External Reviewer'
    EXECUTIVE_GROUP = 'EC-Executive'

    setup_workflow_graph(Checklist,
                         auto_start=True,
                         nodes={
                             'start':
                             Args(Generic, start=True, name=_("Start")),
                             'external_review':
                             Args(ExternalReview,
                                  name=_("External Review"),
                                  group=EXTERNAL_REVIEW_GROUP,
                                  is_delegatable=False,
                                  is_dynamic=True),
                             'external_review_review':
                             Args(ExternalReviewReview,
                                  name=_("External Review Review"),
                                  group=EXECUTIVE_GROUP),
                         },
                         edges={
                             ('start', 'external_review'):
                             Args(guard=is_external_review_checklist),
                             ('external_review', 'external_review_review'):
                             None,
                             ('external_review_review', 'external_review'):
                             Args(guard=checklist_review_review_failed),
                         })
Beispiel #2
0
def meeting_workflow():
    from ecs.meetings.models import Meeting
    from ecs.meetings.workflow import MeetingAgendaPreparation, MeetingAgendaSending, MeetingDay, MeetingProtocolSending

    setup_workflow_graph(Meeting, 
        auto_start=True, 
        nodes={
            'meeting_agenda_generation': Args(MeetingAgendaPreparation, start=True),
            'meeting_agenda_sending': Args(MeetingAgendaSending),
            'meeting_day': Args(MeetingDay),
            'meeting_protocol_sending': Args(MeetingProtocolSending, end=True),
        }, 
        edges={
            ('meeting_agenda_generation', 'meeting_agenda_sending'): None,
            ('meeting_agenda_sending', 'meeting_day'): None,
            ('meeting_day', 'meeting_protocol_sending'): None,
        }
    )
Beispiel #3
0
def vote_workflow():
    EXECUTIVE_GROUP = 'EC-Executive'
    OFFICE_GROUP = 'EC-Office'
    SIGNING_GROUP = 'EC-Signing'

    setup_workflow_graph(
        Vote,
        auto_start=True,
        nodes={
            'executive_vote_review':
            Args(VoteReview,
                 name=_("Executive Vote Review"),
                 group=EXECUTIVE_GROUP),
            'internal_vote_review':
            Args(VoteReview,
                 name=_("Internal Vote Review"),
                 group=OFFICE_GROUP),
            'office_vote_finalization':
            Args(VoteReview,
                 start=True,
                 name=_("Office Vote Finalization"),
                 group=OFFICE_GROUP),
            'final_office_vote_review':
            Args(VoteReview, name=_("Office Vote Review"), group=OFFICE_GROUP),
            'vote_signing':
            Args(VoteSigning, group=SIGNING_GROUP, name=_("Vote Signing")),
        },
        edges={
            ('office_vote_finalization', 'internal_vote_review'):
            Args(guard=internal_vote_review_required),
            ('office_vote_finalization', 'executive_vote_review'):
            Args(guard=internal_vote_review_required, negated=True),
            ('internal_vote_review', 'office_vote_finalization'):
            Args(guard=is_final, negated=True),
            ('internal_vote_review', 'executive_vote_review'):
            Args(guard=is_final),
            ('executive_vote_review', 'final_office_vote_review'):
            Args(guard=is_final, negated=True),
            ('executive_vote_review', 'vote_signing'):
            Args(guard=is_final),
            ('final_office_vote_review', 'executive_vote_review'):
            None,
        })
Beispiel #4
0
def vote_workflow():
    from ecs.core.models import Vote
    from ecs.core.workflow import VoteFinalization, VoteReview, VoteSigning, VotePublication
    from ecs.core.workflow import is_executive_vote_review_required, is_final, is_b2upgrade

    setup_workflow_graph(Vote, 
        auto_start=True, 
        nodes={
            'start': Args(Generic, start=True, name="Start"),
            'review': Args(Generic, name="Review Split"),
            'b2upgrade': Args(Generic, name="B2 Upgrade", end=True),
            'executive_vote_finalization': Args(VoteReview, name="Executive Vote Finalization"),
            'executive_vote_review': Args(VoteReview, name="Executive Vote Review"),
            'internal_vote_review': Args(VoteReview, name="Internal Vote Review"),
            'office_vote_finalization': Args(VoteReview, name="Office Vote Finalization"),
            'office_vote_review': Args(VoteReview, name="Office Vote Review"),
            'final_office_vote_review': Args(VoteReview, name="Office Vote Review"),
            'vote_signing': Args(VoteSigning),
            'vote_publication': Args(VotePublication, end=True),
        }, 
        edges={
            ('start', 'review'): Args(guard=is_b2upgrade, negated=True),
            ('start', 'b2upgrade'): Args(guard=is_b2upgrade),
            ('review', 'executive_vote_finalization'): Args(guard=is_executive_vote_review_required),
            ('review', 'office_vote_finalization'): Args(guard=is_executive_vote_review_required, negated=True),
            ('executive_vote_finalization', 'office_vote_review'): None,
            ('office_vote_finalization', 'internal_vote_review'): None,

            ('office_vote_review', 'executive_vote_review'): Args(guard=is_final, negated=True),
            ('office_vote_review', 'vote_signing'): Args(guard=is_final),

            ('internal_vote_review', 'office_vote_finalization'): Args(guard=is_final, negated=True),
            ('internal_vote_review', 'executive_vote_review'): Args(guard=is_final),

            ('executive_vote_review', 'final_office_vote_review'): Args(guard=is_final, negated=True),
            ('executive_vote_review', 'vote_signing'): Args(guard=is_final),
            
            ('final_office_vote_review', 'executive_vote_review'): None,
            ('vote_signing', 'vote_publication'): None
        }
    )
Beispiel #5
0
def notification_workflow():
    EXECUTIVE_GROUP = 'EC-Executive'
    OFFICE_GROUP = 'EC-Office'
    SIGNING_GROUP = 'EC-Signing'

    setup_workflow_graph(
        Notification,
        auto_start=True,
        nodes={
            'start':
            Args(Generic, start=True, name='Start'),
            'safety_review':
            Args(SimpleNotificationReview,
                 group=OFFICE_GROUP,
                 name=_('Safety Review')),
            'distribute_notification_answer':
            Args(AutoDistributeNotificationAnswer,
                 name=_('Distribute Notification Answer')),

            # reports
            'office_report_review':
            Args(SimpleNotificationReview,
                 group=OFFICE_GROUP,
                 name=_('Office Notification Review')),
            'executive_report_review':
            Args(EditNotificationAnswer,
                 group=EXECUTIVE_GROUP,
                 name=_('Executive Notification Review')),

            # amendments
            'initial_amendment_review':
            Args(InitialAmendmentReview,
                 group=OFFICE_GROUP,
                 name=_('Initial Amendment Review')),
            'executive_amendment_review':
            Args(EditNotificationAnswer,
                 group=EXECUTIVE_GROUP,
                 name=_('Amendment Review')),
            'wait_for_meeting':
            Args(WaitForMeeting, name='Wait For Meeting'),
            'amendment_split':
            Args(Generic, name='Amendment Split'),
            'notification_answer_signing':
            Args(SignNotificationAnswer,
                 group=SIGNING_GROUP,
                 name=_('Amendment Answer Signing')),
        },
        edges=(
            (('start', 'safety_review'), Args(guard=is_susar)),
            (('start', 'office_report_review'), Args(guard=is_report)),
            (('start', 'office_report_review'), Args(guard=is_center_close)),
            (('start', 'initial_amendment_review'), Args(guard=is_amendment)),

            # safety reports
            (('safety_review', 'executive_report_review'),
             Args(guard=is_rejected_and_final, negated=True)),
            (('safety_review', 'distribute_notification_answer'),
             Args(guard=is_rejected_and_final)),

            # reports
            (('office_report_review', 'executive_report_review'),
             Args(guard=is_rejected_and_final, negated=True)),
            (('office_report_review', 'distribute_notification_answer'),
             Args(guard=is_rejected_and_final)),
            (('executive_report_review', 'start'),
             Args(guard=needs_further_review)),
            (('executive_report_review', 'distribute_notification_answer'),
             Args(guard=needs_further_review, negated=True)),

            # amendments
            (('initial_amendment_review', 'executive_amendment_review'),
             Args(guard=is_rejected_and_final, negated=True)),
            (('initial_amendment_review', 'distribute_notification_answer'),
             Args(guard=is_rejected_and_final)),
            (('executive_amendment_review', 'initial_amendment_review'),
             Args(guard=needs_further_review)),
            (('executive_amendment_review', 'amendment_split'),
             Args(guard=needs_further_review, negated=True)),
            (('amendment_split', 'wait_for_meeting'),
             Args(guard=is_substantial)),
            (('amendment_split', 'notification_answer_signing'),
             Args(guard=needs_signature)),
            (('amendment_split', 'distribute_notification_answer'),
             Args(guard=needs_distribution)),
            (('wait_for_meeting', 'initial_amendment_review'),
             Args(guard=needs_further_review)),
            (('wait_for_meeting', 'notification_answer_signing'),
             Args(guard=needs_further_review, negated=True)),
        ))
Beispiel #6
0
def submission_workflow():
    thesis_review_checklist_blueprint = ChecklistBlueprint.objects.get(
        slug='thesis_review')
    expedited_review_checklist_blueprint = ChecklistBlueprint.objects.get(
        slug='expedited_review')
    localec_review_checklist_blueprint = ChecklistBlueprint.objects.get(
        slug='localec_review')
    statistical_review_checklist_blueprint = ChecklistBlueprint.objects.get(
        slug='statistic_review')
    insurance_review_checklist_blueprint = ChecklistBlueprint.objects.get(
        slug='insurance_review')
    legal_and_patient_review_checklist_blueprint = ChecklistBlueprint.objects.get(
        slug='legal_review')
    specialist_review_checklist_blueprint = ChecklistBlueprint.objects.get(
        slug='specialist_review')
    gcp_review_checklist_blueprint = ChecklistBlueprint.objects.get(
        slug='gcp_review')

    EXECUTIVE_GROUP = 'EC-Executive'
    OFFICE_GROUP = 'EC-Office'
    BOARD_MEMBER_GROUP = 'Board Member'
    INSURANCE_REVIEW_GROUP = 'Insurance Reviewer'
    STATISTIC_REVIEW_GROUP = 'Statistic Reviewer'
    GCP_REVIEW_GROUP = 'GCP Reviewer'
    SPECIALIST_GROUP = 'Specialist'

    setup_workflow_graph(
        Submission,
        auto_start=True,
        nodes={
            'start':
            Args(Generic, start=True, name="Start"),
            'resubmission':
            Args(Resubmission, name=_("Resubmission")),
            'b2_resubmission':
            Args(Resubmission, name=_("B2 Resubmission")),
            'b2_review':
            Args(InitialB2ResubmissionReview,
                 name=_("Office B2 Resubmission Review"),
                 group=OFFICE_GROUP),
            'executive_b2_review':
            Args(B2ResubmissionReview,
                 name=_("Executive B2 Resubmission Review"),
                 group=EXECUTIVE_GROUP),
            'initial_review':
            Args(InitialReview, group=OFFICE_GROUP, name=_("Initial Review")),
            'initial_review_barrier':
            Args(Generic, name="Initial Review Barrier"),
            'categorization':
            Args(Categorization,
                 group=EXECUTIVE_GROUP,
                 name=_("Categorization")),
            'categorization_review':
            Args(CategorizationReview,
                 group=OFFICE_GROUP,
                 name=_("Categorization Review")),
            'paper_submission_review':
            Args(PaperSubmissionReview,
                 group=OFFICE_GROUP,
                 name=_("Paper Submission Review")),
            'legal_and_patient_review':
            Args(ChecklistReview,
                 data=legal_and_patient_review_checklist_blueprint,
                 name=_("Legal and Patient Review"),
                 group=OFFICE_GROUP,
                 is_dynamic=True),
            'insurance_review':
            Args(ChecklistReview,
                 data=insurance_review_checklist_blueprint,
                 name=_("Insurance Review"),
                 group=INSURANCE_REVIEW_GROUP,
                 is_dynamic=True),
            'statistical_review':
            Args(ChecklistReview,
                 data=statistical_review_checklist_blueprint,
                 name=_("Statistical Review"),
                 group=STATISTIC_REVIEW_GROUP,
                 is_dynamic=True),
            'specialist_review':
            Args(ChecklistReview,
                 data=specialist_review_checklist_blueprint,
                 name=_("Specialist Review"),
                 group=SPECIALIST_GROUP,
                 is_delegatable=False,
                 is_dynamic=True),
            'gcp_review':
            Args(ChecklistReview,
                 data=gcp_review_checklist_blueprint,
                 name=_("GCP Review"),
                 group=GCP_REVIEW_GROUP,
                 is_dynamic=True),

            # retrospective thesis lane
            'initial_thesis_review':
            Args(InitialReview,
                 name=_("Initial Thesis Review"),
                 group=OFFICE_GROUP),
            'thesis_recommendation':
            Args(ChecklistReview,
                 data=thesis_review_checklist_blueprint,
                 name=_("Thesis Recommendation"),
                 group=OFFICE_GROUP),

            # expedited_lane
            'expedited_recommendation_split':
            Args(ExpeditedRecommendationSplit,
                 name=_("Expedited Recommendation Split")),
            'expedited_recommendation':
            Args(ChecklistReview,
                 data=expedited_review_checklist_blueprint,
                 name=_("Expedited Recommendation"),
                 group=BOARD_MEMBER_GROUP),

            # local ec lane
            'localec_recommendation':
            Args(ChecklistReview,
                 data=localec_review_checklist_blueprint,
                 name=_("Local EC Recommendation"),
                 group=EXECUTIVE_GROUP),

            # retrospective thesis, expedited and local ec lanes
            'vote_preparation':
            Args(VotePreparation,
                 name=_("Vote Preparation"),
                 group=OFFICE_GROUP),
        },
        edges={
            ('start', 'initial_review'):
            Args(guard=is_retrospective_thesis, negated=True),
            ('start', 'initial_thesis_review'):
            Args(guard=is_retrospective_thesis),
            ('initial_review', 'initial_review_barrier'):
            None,
            ('initial_thesis_review', 'initial_review_barrier'):
            None,
            ('initial_review_barrier', 'resubmission'):
            Args(guard=is_acknowledged, negated=True),
            ('initial_review_barrier', 'categorization'):
            Args(guard=is_acknowledged_and_initial_submission),
            ('categorization', 'categorization_review'):
            Args(guard=needs_categorization_review),
            ('initial_review_barrier', 'paper_submission_review'):
            Args(guard=is_acknowledged_and_initial_submission),
            ('b2_resubmission', 'b2_review'):
            None,
            ('b2_review', 'executive_b2_review'):
            Args(guard=needs_executive_b2_review),
            ('b2_review', 'b2_resubmission'):
            Args(guard=is_still_b2),
            ('executive_b2_review', 'b2_review'):
            None,

            # retrospective thesis lane
            ('categorization', 'thesis_recommendation'):
            Args(guard=is_retrospective_thesis),
            ('thesis_recommendation', 'categorization'):
            Args(guard=has_thesis_recommendation, negated=True),
            ('thesis_recommendation', 'vote_preparation'):
            Args(guard=needs_thesis_vote_preparation),

            # expedited lane
            ('categorization', 'expedited_recommendation_split'):
            None,
            ('expedited_recommendation_split', 'expedited_recommendation'):
            Args(guard=is_expedited),
            ('expedited_recommendation', 'vote_preparation'):
            Args(guard=needs_expedited_vote_preparation),
            ('expedited_recommendation', 'categorization'):
            Args(guard=needs_expedited_recategorization),

            # local ec lane
            ('categorization', 'localec_recommendation'):
            Args(guard=needs_localec_recommendation),
            ('localec_recommendation', 'vote_preparation'):
            Args(guard=needs_localec_vote_preparation),
            ('localec_recommendation', 'categorization'):
            Args(guard=has_localec_recommendation, negated=True),
        })

    # translations for legacy task types
    _('Executive Vote Finalization')
    _('Insurance Amendment Review')
    _('Insurance B2 Resubmission Review')
    _('Office Vote Review (legacy)')
    _('Thesis Recommendation Review')
Beispiel #7
0
def submission_workflow():
    from ecs.core.models import Submission
    from ecs.core.workflow import (InitialReview, Resubmission, CategorizationReview, PaperSubmissionReview, AdditionalReviewSplit, AdditionalChecklistReview,
        ChecklistReview, ExternalChecklistReview, ExternalReviewInvitation, VoteRecommendation, VoteRecommendationReview, B2VoteReview)
    from ecs.core.workflow import is_acknowledged, is_thesis, is_expedited, has_recommendation, has_accepted_recommendation, has_b2vote, needs_external_review
    
    statistical_review_checklist_blueprint = ChecklistBlueprint.objects.get(slug='statistic_review')
    insurance_review_checklist_blueprint = ChecklistBlueprint.objects.get(slug='insurance_review')
    legal_and_patient_review_checklist_blueprint = ChecklistBlueprint.objects.get(slug='legal_review')
    boardmember_review_checklist_blueprint = ChecklistBlueprint.objects.get(slug='boardmember_review')
    external_review_checklist_blueprint = ChecklistBlueprint.objects.get(slug='external_review')
    additional_review_checklist_blueprint = ChecklistBlueprint.objects.get(slug='additional_review')
    
    THESIS_REVIEW_GROUP = 'EC-Thesis Review Group'
    THESIS_EXECUTIVE_GROUP = 'EC-Thesis Executive Group'
    EXECUTIVE_GROUP = 'EC-Executive Board Group'
    PRESENTER_GROUP = 'Presenter'
    OFFICE_GROUP = 'EC-Office'
    BOARD_MEMBER_GROUP = 'EC-Board Member'
    EXTERNAL_REVIEW_GROUP = 'External Reviewer'
    INSURANCE_REVIEW_GROUP = 'EC-Insurance Reviewer'
    STATISTIC_REVIEW_GROUP = 'EC-Statistic Group'
    INTERNAL_REVIEW_GROUP = 'EC-Internal Review Group'
    
    setup_workflow_graph(Submission,
        auto_start=True,
        nodes={
            'start': Args(Generic, start=True, name="Start"),
            'generic_review': Args(Generic, name="Review Split"),
            'resubmission': Args(Resubmission, group=PRESENTER_GROUP),
            'initial_review': Args(InitialReview, group=OFFICE_GROUP),
            'b2_resubmission_review': Args(InitialReview, name="B2 Resubmission Review", group=INTERNAL_REVIEW_GROUP),
            'b2_vote_review': Args(B2VoteReview, group=OFFICE_GROUP),
            'categorization_review': Args(CategorizationReview, group=EXECUTIVE_GROUP),
            'additional_review_split': Args(AdditionalReviewSplit),
            'additional_review': Args(AdditionalChecklistReview, data=additional_review_checklist_blueprint, name=u"Additional Review"),
            'initial_thesis_review': Args(InitialReview, name="Initial Thesis Review", group=THESIS_REVIEW_GROUP),
            'thesis_categorization_review': Args(CategorizationReview, name="Thesis Categorization Review", group=THESIS_EXECUTIVE_GROUP),
            'paper_submission_review': Args(PaperSubmissionReview, group=OFFICE_GROUP),
            'legal_and_patient_review': Args(ChecklistReview, data=legal_and_patient_review_checklist_blueprint, name=u"Legal and Patient Review", group=INTERNAL_REVIEW_GROUP),
            'insurance_review': Args(ChecklistReview, data=insurance_review_checklist_blueprint, name=u"Insurance Review", group=INSURANCE_REVIEW_GROUP),
            'statistical_review': Args(ChecklistReview, data=statistical_review_checklist_blueprint, name=u"Statistical Review", group=STATISTIC_REVIEW_GROUP),
            'board_member_review': Args(ChecklistReview, data=boardmember_review_checklist_blueprint, name=u"Board Member Review", group=BOARD_MEMBER_GROUP),
            'external_review': Args(ExternalChecklistReview, data=external_review_checklist_blueprint, name=u"External Review", group=EXTERNAL_REVIEW_GROUP),
            'external_review_invitation': Args(ExternalReviewInvitation, group=OFFICE_GROUP),
            'thesis_vote_recommendation': Args(VoteRecommendation, group=THESIS_EXECUTIVE_GROUP),
            'vote_recommendation_review': Args(VoteRecommendationReview, group=EXECUTIVE_GROUP),
        },
        edges={
            ('start', 'initial_review'): Args(guard=is_thesis, negated=True),
            ('start', 'initial_thesis_review'): Args(guard=is_thesis),

            ('initial_review', 'resubmission'): Args(guard=is_acknowledged, negated=True),
            ('initial_review', 'categorization_review'): Args(guard=is_acknowledged),
            ('initial_review', 'paper_submission_review'): None,

            ('initial_thesis_review', 'resubmission'): Args(guard=is_acknowledged, negated=True),
            ('initial_thesis_review', 'thesis_categorization_review'): Args(guard=is_acknowledged),
            ('initial_thesis_review', 'paper_submission_review'): None,
            
            ('resubmission', 'start'): Args(guard=has_b2vote, negated=True),
            ('resubmission', 'b2_resubmission_review'): Args(guard=has_b2vote),
            ('b2_resubmission_review', 'b2_vote_review'): None,
            ('b2_vote_review', 'resubmission'): Args(guard=has_b2vote),

            ('thesis_categorization_review', 'thesis_vote_recommendation'): None,

            ('thesis_vote_recommendation', 'vote_recommendation_review'): Args(guard=has_recommendation),
            ('thesis_vote_recommendation', 'categorization_review'): Args(guard=has_recommendation, negated=True),

            #('vote_recommendation_review', 'END'): Args(guard=has_accepted_recommendation),
            ('vote_recommendation_review', 'categorization_review'): Args(guard=has_accepted_recommendation, negated=True),

            #('categorization_review', 'END'): Args(guard=is_expedited),
            ('categorization_review', 'generic_review'): Args(guard=is_expedited, negated=True),
            ('categorization_review', 'external_review_invitation'): Args(guard=needs_external_review),
            ('categorization_review', 'additional_review_split'): None,
            
            ('external_review_invitation', 'external_review'): None,
            ('external_review', 'external_review_invitation'): Args(deadline=True),
            ('additional_review_split', 'additional_review'): None,

            ('generic_review', 'board_member_review'): None,
            ('generic_review', 'insurance_review'): None,
            ('generic_review', 'statistical_review'): None,
            ('generic_review', 'legal_and_patient_review'): None,
        }
    )