Conversation
Update people.json from official 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a new bridging script that will update people.json from the official Scottish Parliament API as new people are loaded there.
It works by first creating a membership table from the various SP datasets - and then comparing this against our data.
I've updated people.json in two ways:
This should work for the election, but also should detect new MSPs/party changes if we add it to the daily update at some point.
I've done an experiment deleting a load of current MSPs and then letting it recreate them and this seemed to work ok.
Runs with
poetry run python -m pyscraper.rep_syncer sp run [--people PATH] [--dry-run] [--quiet]It currently also picks up some historical mismatches in membership dates - have decided these don't need to be fixed for the moment, but could pick up later.
This doesn't have the email exporter - but the email API bit is described there so that's not a big job.
As noted in the readme, we actually already have a process for the Senedd that should work if someone is updating wikidata.