Created
April 1, 2015 09:40
-
-
Save imsickofmaps/c631355d0ca42293fce7 to your computer and use it in GitHub Desktop.
This file contains 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 io, json, pprint, csv | |
import dateutil.parser | |
with open('output_something_interesting.csv', 'w') as csvfile: | |
fieldnames = ['encdate'] | |
writer = csv.DictWriter(csvfile, fieldnames=fieldnames) | |
writer.writeheader() | |
with io.open('vumi_account_contacts.json', 'r', encoding='utf-8') as f: | |
for line in f: | |
parsed = json.loads(line) | |
if "is_registered_by" in parsed["extra"] and parsed["extra"]["is_registered_by"] == "clinic": | |
output = { | |
'encdate': dateutil.parser.parse(parsed["created_at"]).strftime("%Y%m%d%H%M%S"), | |
} | |
writer.writerow(output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment