def _run(self): """Implements the logic of Not Constitutional.""" constitution = PymongoDB.get_db().find_one(db_constants.ISSUES, queries.issue_query(self._CONSTITUTION)) if not constitution: logger.LOGGER.warning("Constitution issue not found in DB.") return result = self._consensus() filter_fun = lambda stance : queries.is_issue_identified(stance.issue, constitution) self._non_constitutional_stances = filter(filter_fun, self._decision.agn_stances) if result == outcomes.AGN and self._non_constitutional_stances: return self._set_decision(outcomes.AGN)
def normative_stance(stance): """Checks if a given stance is the normative stance on the issue (i.e. the way most people in the country feel about the issue). Argument: stance: the stance to check Returns: True if the stance is normative, False otherwise. """ stance_issue = PymongoDB.get_db().find_one(db_constants.ISSUES, queries.issue_query(stance.issue)) if not stance_issue: logger.LOGGER.error("Issue not found: " + str(stance.issue)) if stance_issue and stance_issue.norm: return stance.match(stance_issue.norm) return False