if is_spor:
            return "SPOR"

        is_manual_ref = kwargs.get("is_manual_ref", False)
        is_manual = kwargs.get("is_manual", False)

        if is_manual_ref:
            return "MANREF"

        if is_manual:
            return "MANALC"

        return "REFSP"


event_registry.register(AssignToProviderEvent)


class DeferAssignmentEvent(BaseEvent):
    key = "defer_assignment"
    codes = {
        "CBSP": {
            "type": LOG_TYPES.OUTCOME,
            "level": LOG_LEVELS.HIGH,
            "selectable_by": [LOG_ROLES.OPERATOR],
            "description": "Will call back later for Specialist",
            "stops_timer": True,
        }
    }

        if is_spor:
            return "SPOR"

        is_manual_ref = kwargs.get("is_manual_ref", False)
        is_manual = kwargs.get("is_manual", False)

        if is_manual_ref:
            return "MANREF"

        if is_manual:
            return "MANALC"

        return "REFSP"


event_registry.register(AssignToProviderEvent)


class DeferAssignmentEvent(BaseEvent):
    key = "defer_assignment"
    codes = {
        "CBSP": {
            "type": LOG_TYPES.OUTCOME,
            "level": LOG_LEVELS.HIGH,
            "selectable_by": [LOG_ROLES.OPERATOR],
            "description": "Will call back later for Specialist",
            "stops_timer": True,
        }
    }

            'description': 'Conflict of Interest',
            'stops_timer': False,
            'set_requires_action_by': REQUIRES_ACTION_BY.OPERATOR
        },
    }

    def get_log_code(self, **kwargs):
        is_conflict = kwargs.get('is_conflict')

        if is_conflict:
            return 'COI'

        return super(RejectCaseEvent, self).get_log_code(**kwargs)


event_registry.register(RejectCaseEvent)


class AcceptCaseEvent(BaseEvent):
    key = 'accept_case'
    codes = {
        'SPOP': {
            'type': LOG_TYPES.OUTCOME,
            'level': LOG_LEVELS.HIGH,
            'selectable_by': [],
            'description': 'Case taken',
            'stops_timer': False,
            'set_requires_action_by': REQUIRES_ACTION_BY.PROVIDER
        },
    }
                "type": LOG_TYPES.SYSTEM,
                "level": LOG_LEVELS.HIGH,
                "selectable_by": [LOG_ROLES.OPERATOR],
                "description": u"Complaint voided",
                "stops_timer": False,
            },
        ),
    ])

    def __init__(self):
        super(ComplaintEvent, self).__init__()
        self.complaint = None

    def create_log(self, *args, **kwargs):
        content_type = ContentType.objects.get_for_model(
            self.complaint.__class__)
        return ComplaintLog(object_id=self.complaint.pk,
                            content_type=content_type,
                            *args,
                            **kwargs)

    def process(self, *args, **kwargs):
        self.complaint = kwargs.pop("complaint", None)
        return super(ComplaintEvent, self).process(*args, **kwargs)

    def get_log_code(self, case=None, **kwargs):
        return kwargs.get("code")


event_registry.register(ComplaintEvent)
Exemple #5
0
            "set_requires_action_by": None_if_owned_by_op_or_op_manager,
        },
        "COSPF": {
            "type": LOG_TYPES.OUTCOME,
            "level": LOG_LEVELS.HIGH,
            "selectable_by": [LOG_ROLES.OPERATOR, LOG_ROLES.SPECIALIST],
            "description": "Assigned to F2F provider",
            "stops_timer": True,
            "set_requires_action_by": None_if_owned_by_op_or_op_manager,
        },
        "SPFN": {
            "type": LOG_TYPES.OUTCOME,
            "level": LOG_LEVELS.HIGH,
            "selectable_by": [LOG_ROLES.OPERATOR, LOG_ROLES.SPECIALIST],
            "description": "Assigned to F2F provider (Housing and Family)",
            "stops_timer": True,
            "set_requires_action_by": None_if_owned_by_op_or_op_manager,
        },
        "SPFM": {
            "type": LOG_TYPES.OUTCOME,
            "level": LOG_LEVELS.HIGH,
            "selectable_by": [LOG_ROLES.OPERATOR, LOG_ROLES.SPECIALIST],
            "description": "Assigned to F2F provider (Debt, Education and Discrimination)",
            "stops_timer": True,
            "set_requires_action_by": None_if_owned_by_op_or_op_manager,
        },
    }


event_registry.register(AlternativeHelpEvent)
            "stops_timer": False,
        },
        "DIAGNOSIS_DELETED": {
            "type": LOG_TYPES.SYSTEM,
            "level": LOG_LEVELS.HIGH,
            "selectable_by": [],
            "description": "Diagnosis deleted",
            "stops_timer": False,
        },
        "INCOMPLETE_DIAGNOSIS_DELETED": {
            "type": LOG_TYPES.SYSTEM,
            "level": LOG_LEVELS.HIGH,
            "selectable_by": [],
            "description": "Incomplete Diagnosis deleted",
            "stops_timer": False,
        },
    }

    def get_log_code(self, **kwargs):
        status = kwargs["status"]
        lookup = {
            "created": "DIAGNOSIS_CREATED",
            "incomplete_deleted": "INCOMPLETE_DIAGNOSIS_DELETED",
            "deleted": "DIAGNOSIS_DELETED",
        }

        return lookup[status]


event_registry.register(DiagnosisEvent)
Exemple #7
0
        },
    }

    def get_log_code(self, **kwargs):
        status = kwargs["status"]
        lookup = {
            "created": "MT_CREATED",
            "changed": "MT_CHANGED",
            "passed": "MT_PASSED",
            "failed": "MT_FAILED"
        }

        return lookup[status]


event_registry.register(MeansTestEvent)


class CaseEvent(BaseEvent):
    key = "case"
    codes = {
        "CASE_CREATED": {
            "type": LOG_TYPES.SYSTEM,
            "level": LOG_LEVELS.HIGH,
            "selectable_by": [],
            "description": "Case created",
            "stops_timer": False,
        },
        "CASE_VIEWED": {
            "type": LOG_TYPES.SYSTEM,
            "level": LOG_LEVELS.MINOR,
            'level': LOG_LEVELS.HIGH,
            'selectable_by': [LOG_ROLES.SPECIALIST],
            'description': 'Conflict of Interest',
            'stops_timer': False,
            'set_requires_action_by': REQUIRES_ACTION_BY.OPERATOR
        },
    }

    def get_log_code(self, **kwargs):
        is_conflict = kwargs.get('is_conflict')

        if is_conflict:
            return 'COI'

        return super(RejectCaseEvent, self).get_log_code(**kwargs)
event_registry.register(RejectCaseEvent)


class AcceptCaseEvent(BaseEvent):
    key = 'accept_case'
    codes = {
        'SPOP': {
            'type': LOG_TYPES.OUTCOME,
            'level': LOG_LEVELS.HIGH,
            'selectable_by': [],
            'description': 'Case taken',
            'stops_timer': False,
            'set_requires_action_by': REQUIRES_ACTION_BY.PROVIDER
        },
    }
event_registry.register(AcceptCaseEvent)
            "type": LOG_TYPES.SYSTEM,
            "level": LOG_LEVELS.HIGH,
            "selectable_by": [],
            "description": "Means test failed",
            "stops_timer": False,
        },
    }

    def get_log_code(self, **kwargs):
        status = kwargs["status"]
        lookup = {"created": "MT_CREATED", "changed": "MT_CHANGED", "passed": "MT_PASSED", "failed": "MT_FAILED"}

        return lookup[status]


event_registry.register(MeansTestEvent)


class CaseEvent(BaseEvent):
    key = "case"
    codes = {
        "CASE_CREATED": {
            "type": LOG_TYPES.SYSTEM,
            "level": LOG_LEVELS.HIGH,
            "selectable_by": [],
            "description": "Case created",
            "stops_timer": False,
        },
        "CASE_VIEWED": {
            "type": LOG_TYPES.SYSTEM,
            "level": LOG_LEVELS.MINOR,
            (
                "COMPLAINT_VOID",
                {
                    "type": LOG_TYPES.SYSTEM,
                    "level": LOG_LEVELS.HIGH,
                    "selectable_by": [LOG_ROLES.OPERATOR],
                    "description": u"Complaint voided",
                    "stops_timer": False,
                },
            ),
        ]
    )

    def __init__(self):
        super(ComplaintEvent, self).__init__()
        self.complaint = None

    def create_log(self, *args, **kwargs):
        content_type = ContentType.objects.get_for_model(self.complaint.__class__)
        return ComplaintLog(object_id=self.complaint.pk, content_type=content_type, *args, **kwargs)

    def process(self, *args, **kwargs):
        self.complaint = kwargs.pop("complaint", None)
        return super(ComplaintEvent, self).process(*args, **kwargs)

    def get_log_code(self, case=None, **kwargs):
        return kwargs.get("code")


event_registry.register(ComplaintEvent)