@cached_property
    def mendeley_discipline(self):
        top_discipline = None
        discipline_snaps = [snap for snap in self.snaps if snap.provider=="mendeley" and snap.interaction=="discipline"]
        if discipline_snaps:
            most_recent_discipline_snap = sorted(
                        discipline_snaps,
                        key=lambda x: x.last_collected_date,
                        reverse=True
                    )[0]            
            all_disciplines = most_recent_discipline_snap.raw_value
            try:
                by_value = sorted(all_disciplines, key=all_disciplines.get, reverse=True)
                top_discipline = by_value[0]
            except __HOLE__:
                pass
        return top_discipline
dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpactwebapp/product.py/Product.mendeley_discipline