Esempio n. 1
0
    def get_crime_item(self):
        """ Return a Parse report.
            >>> report = Report(**{'date_type': 'test', 'location': 'capitol-hill', 'report_type': 'specific'})
            >>> output = report.get_crime_item()
            >>> print output['count'], output['crime']
            29 None
            """
        fn = self.build_filename()
        parse = Parse('_input/%s' % fn)
        parse.crime = self.crime
        parse.grep = self.grep
        try:
            parse.location = self.location
        except:
            pass
        try:
            parse.set_timespan(self.timespan)
        except:
            pass

        # *** eventually we might want to allow for other types of reports
        if self.report_type == 'rankings':
            result = parse.get_rankings()
        elif self.report_type == 'specific':
            result = parse.get_specific_crime()
        return result