Skip to content

Instantly share code, notes, and snippets.

@sampottinger
Created August 21, 2013 07:27
Show Gist options
  • Save sampottinger/6291309 to your computer and use it in GitHub Desktop.
Save sampottinger/6291309 to your computer and use it in GitHub Desktop.
Pycotracer mongo aggregation example
import pycotracer
import pymongo
client = pymongo.MongoClient()
db = client['tracer-records-db']
all_data = pycotracer.get_report(2013)
contribution_data = all_data['ContributionData'][:100]
expenditure_data = all_data['ExpenditureData'][:100]
loan_data = all_data['LoanData'][:100]
for record in contribution_data:
pycotracer.mongo_aggregator.update_contribution_entry(db, record)
for record in expenditure_data:
pycotracer.mongo_aggregator.update_expenditure_entry(db, record)
for record in loan_data:
pycotracer.mongo_aggregator.update_loan_entry(db, record)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment