scout/adapter/mongo/event.py
def create_event(self, institute, case, user, link, category, verb,
                     subject, level='specific', variant=None, content=None,
                     panel=None):
        """Create a Event with the parameters given.

        Arguments:
            institute (dict): A institute
            case (dict): A case
            user (dict): A User
            link (str): The url to be used in the event
            category (str): case or variant
            verb (str): What type of event
            subject (str): What is operated on
            level (str): 'specific' or 'global'. Default is 'specific'
            variant (dict): A variant
            content (str): The content of the comment

        Returns:
            event(dict): The inserted event
        """
        variant = variant or {}
        event = dict(
            institute=institute['_id'],
            case=case['_id'],
            user_id=user['_id'],
            user_name=user['name'],
            link=link,
            category=category,
            verb=verb,
            subject=subject,
            level=level,
            variant_id=variant.get('variant_id'),
            content=content,
            panel=panel,
            created_at=datetime.now(),
            updated_at=datetime.now(),
        )

        LOG.debug("Saving Event")
        self.event_collection.insert_one(event)
        LOG.debug("Event Saved")
        return event
def create_event(self, institute, case, user, link, category, verb,
                     subject, level='specific', variant=None, content=None,
                     panel=None):
        """Create a Event with the parameters given.

        Arguments:
            institute (dict): A institute
            case (dict): A case
            user (dict): A User
            link (str): The url to be used in the event
            category (str): case or variant
            verb (str): What type of event
            subject (str): What is operated on
            level (str): 'specific' or 'global'. Default is 'specific'
            variant (dict): A variant
            content (str): The content of the comment

        Returns:
            event(dict): The inserted event
        """
        variant = variant or {}
        event = dict(
            institute=institute['_id'],
            case=case['_id'],
            user_id=user['_id'],
            user_name=user['name'],
            link=link,
            category=category,
            verb=verb,
            subject=subject,
            level=level,
            variant_id=variant.get('variant_id'),
            content=content,
            panel=panel,
            created_at=datetime.now(),
            updated_at=datetime.now(),
        )

        LOG.debug("Saving Event")
        self.event_collection.insert_one(event)
        LOG.debug("Event Saved")
        return event
Create a Event with the parameters given.

        Arguments:
            institute (dict): A institute
            case (dict): A case
            user (dict): A User
            link (str): The url to be used in the event
            category (str): case or variant
            verb (str): What type of event
            subject (str): What is operated on
            level (str): 'specific' or 'global'. Default is 'specific'
            variant (dict): A variant
            content (str): The content of the comment

        Returns:
            event(dict): The inserted event