scout/adapter/mongo/variant.py
def get_causatives(self, institute_id, case_id=None):
        """Return all causative variants for an institute

            Args:
                institute_id(str)
                case_id(str)

            Yields:
                str: variant document id
        """

        causatives = []

        if case_id:

            case_obj = self.case_collection.find_one(
                    {"_id": case_id}
                )
            causatives = [causative for causative in case_obj['causatives']]

        elif institute_id:

            query = self.case_collection.aggregate([
                {'$match': {'collaborators': institute_id, 'causatives': {'$exists': True}}},
                {'$unwind': '$causatives'},
                {'$group': {'_id': '$causatives'}}
            ])
            causatives = [item['_id'] for item in query]

        return causatives
def get_causatives(self, institute_id, case_id=None):
        """Return all causative variants for an institute

            Args:
                institute_id(str)
                case_id(str)

            Yields:
                str: variant document id
        """

        causatives = []

        if case_id:

            case_obj = self.case_collection.find_one(
                    {"_id": case_id}
                )
            causatives = [causative for causative in case_obj['causatives']]

        elif institute_id:

            query = self.case_collection.aggregate([
                {'$match': {'collaborators': institute_id, 'causatives': {'$exists': True}}},
                {'$unwind': '$causatives'},
                {'$group': {'_id': '$causatives'}}
            ])
            causatives = [item['_id'] for item in query]

        return causatives
Return all causative variants for an institute

            Args:
                institute_id(str)
                case_id(str)

            Yields:
                str: variant document id