Closed mhl closed 7 years ago
@tmtmtmtm Good idea about the README / Rubocop. I've fixed a few of the things you've highlighted, but I'm not finished yet (e.g. making the sparql_results
code more clear)
Just defining public methods of to_h
and to_a
is indeed an interim step - I wanted to get the fetching of data out of the way and return it in as simple a structure as possible, so it'll be easier to look at the main script and see what we're going to do with that data and if a different representation would make that easier.
This pull request hopefully separates out the code that (a) goes to remote services (such as a Morph scraper, the Wikidata SPARQL endpoint and EveryPolitician) to generate lists of memberships and ID mappings from (b) the code left in in the
prompt_prototype.rb
script, which takes those and produces a list of discrepancies between the sources.Hopefully this makes it easier to look at the
prompt_prototype.rb
script to work out what might be the next functionality that could be factored out.The
MembershipLists
classes return an array of one hash via theirto_a
method, where each hash has properties of a particular membership.n.b. I haven't added automated tests for this because before doing extra work to do that, I'd quite like feedback on whether this generally looks like a sensible refactoring.