This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| default_errors = { | |
| 'required': _('CANNOT_BE_BLANK'), | |
| 'invalid': _('Enter a valid value'), | |
| } | |
| class YourProblemForm(CheckerWizardMixin, forms.Form): | |
| """ | |
| Gets the problem choices from the backend API. | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IntegrityError: (IntegrityError) duplicate key value violates unique constraint "panelists_pkey" | |
| DETAIL: Key (id)=(23845) already exists. | |
| 'INSERT INTO panelists (panelist_id, pmxid, medium, facebook_id, twitter_id, twitter_screen_name, twitter_updated_at, twitter_leaders) | |
| VALUES (%(panelist_id)s, %(pmxid)s, %(medium)s, %(facebook_id)s, %(twitter_id)s, %(twitter_screen_name)s, %(twitter_updated_at)s, %(twitter_leaders)s) | |
| RETURNING panelists.id' | |
| {'medium': 'twitter', 'twitter_screen_name': u'ruthlovell', 'twitter_id': 90618500, 'pmxid': 431447, 'twitter_leaders': None, 'facebook_id': None, 'twitter_updated_at': None, 'panelist_id': None} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Gets list of panel members referenced in interaction json documents in | |
| specified date range, parse and add to redis. | |
| Usage: | |
| get_panel_members.py START_DATE END_DATE | |
| Arguments: | |
| START_DATE ISO format: YYYY-MM-DD | |
| END_DATE ISO format: YYYY-MM-DD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {547831: [{'demographics': {'bixdemo_television': '6', | |
| 'profile_gender': '1', | |
| 'profile_gross_household': '12'}, | |
| 'end_date': datetime.date(2011, 4, 24), | |
| 'start_date': datetime.date(2009, 9, 3)}, | |
| {'demographics': {'bixdemo_television': '6', | |
| 'profile_gender': '1', | |
| 'profile_gross_household': '13'}, | |
| 'end_date': datetime.date(2012, 1, 3), | |
| 'start_date': datetime.date(2011, 4, 24)}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [datetime.date(2013, 6, 27), datetime.date(2013, 6, 28)] | |
| [datetime.date(2013, 7, 1), datetime.date(2013, 7, 2)] | |
| [datetime.date(2013, 7, 4), datetime.date(2013, 7, 5)] | |
| [datetime.date(2013, 7, 10), datetime.date(2013, 7, 11), datetime.date(2013, 7, 12), datetime.date(2013, 7, 13)] | |
| [datetime.date(2013, 7, 16)] | |
| [datetime.date(2013, 7, 19)] | |
| [datetime.date(2013, 7, 26)] | |
| [datetime.date(2013, 7, 30)] | |
| [datetime.date(2013, 8, 1)] | |
| [datetime.date(2013, 8, 6)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [datetime.date(2013, 9, 13)] | |
| [datetime.date(2013, 7, 12)] | |
| [datetime.date(2013, 8, 20)] | |
| [datetime.date(2013, 8, 15)] | |
| [datetime.date(2013, 8, 22)] | |
| [datetime.date(2013, 9, 9)] | |
| [datetime.date(2013, 7, 16)] | |
| [datetime.date(2013, 9, 7)] | |
| [datetime.date(2013, 9, 16)] | |
| [datetime.date(2013, 7, 1)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cPickle | |
| import gzip | |
| import redis | |
| from datetime import datetime | |
| rds = redis.StrictRedis(host='localhost', port=6379, db=0) | |
| panelist_dates = {int(p): {datetime.strptime(d, '%Y-%m-%d').date() | |
| for d in rds.smembers('panelists:%s:dates' % p) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try: | |
| for i, row in enumerate(islice(reader, start, end)): | |
| writer.writerow(row) | |
| except csv.Error: | |
| print 'ERROR' | |
| for c in row: | |
| print len(c), c | |
| raise | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| In [26]: f = gzip.open('2013-10-04-pdl_answers.csv.gz', 'rb') | |
| In [27]: csvreader = csv.reader(f) | |
| In [28]: print csvreader.next() | |
| ['23842', 'marginal_eligible', '1', '2009-09-11 22:59:45.942899'] | |
| In [29]: f = gzip.open('2013-10-04-pdl_answers.csv.gz', 'rb') | |
| In [30]: csvreader = csv.reader(f) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ head 2013-10-04-pdl_answers.csv | |
| 23842,marginal_eligible,1,2009-09-11 22:59:45.942899 | |
| 750183,marginal_eligible,1,2009-09-11 22:59:46.099065 | |
| 756008,marginal_eligible,1,2009-09-11 22:59:46.230585 | |
| 714305,marginal_eligible,1,2009-09-11 22:59:46.356764 | |
| 697148,marginal_eligible,1,2009-09-11 22:59:46.437692 |