opencivicdata/pupa — pull request #38 by paultag (2013-09-25 20:28:50+00:00)
Title: Topsort

Use a trick from @jpmckinney 's book and implement topological sorting of the entries which are in the same dependency step using `parent_id`.

There's a way to do this with `networkx`, but I wasn't keen on adding such a big dep to the codebase, moreso when the code is so easy to quickly write.

I've documented the less-than clear parts. I'd love a review. I was able to cook a test-case in a [test repo](https://github.com/paultag/fake-legislature/tree/master/cooked_data/ocd-jurisdiction/country:xx/state:xx/place:the-void/council) (just move `cooked_data` to `scraped_data` and try to import `fakeleg`) which passes with the current code.