openelections-core icon indicating copy to clipboard operation
openelections-core copied to clipboard

Washington transforms and validators

Open ghing opened this issue 9 years ago • 8 comments

Write the transforms and validators for Washington.

Fundamentally there should be a transform to create Candidate, Contest and Result records from the RawResult records created in the loader. Use best judgement if you want to delegate this to multiple transform classes or functions. If you encounter ambiguities or the need to standardize things in the data, these will require transforms as well.

Write validators to check values in results and whether aggregate queries match published racewide totals. I took a TDD approach and tried to write these before the transforms, but do whatever works for you.

Maryland is the only state that has transforms and validators so they're a reasonable reference.

Since these have only been implemented for one state so far, I'm open to feedback on the API.

ghing avatar Oct 14 '14 15:10 ghing

Well the first issue I ran into is the mongoengine query set can't find any data -- even Maryland's transform returns openelex.models.DoesNotExist: Office matching query does not exist.

ericlagergren avatar Oct 15 '14 03:10 ericlagergren

You probably need to run inv load_metadata.run --collection=office first.

ghing avatar Oct 15 '14 03:10 ghing

@ghing Oh, gotcha. So I need to add the canonical names first before I write the transform portion? Because I started on the transform two days ago, but I ran into this roadblock last night and not even #python or #mongodb or mongoengine's docs could help me.

ericlagergren avatar Oct 15 '14 04:10 ericlagergren

@EricLagerg Yeah, you'll need to prepopulate Office and Party records to be able to fill in the relation fields on the other models.

ghing avatar Oct 15 '14 04:10 ghing

Gotcha also add a call at the end of why 96 on the Washington's loader module you're missing it and it breaks the loader :)


Eric Lagergren ericlagergren.com

On Tue, Oct 14, 2014 at 9:08 PM, Geoffrey Hing [email protected] wrote:

@EricLagerg Yeah, you'll need to prepopulate Office and Party records to be able to fill in the relation fields on the other models.

Reply to this email directly or view it on GitHub: https://github.com/openelections/core/issues/219#issuecomment-59155296

ericlagergren avatar Oct 15 '14 04:10 ericlagergren

@EricLagerg done in 75a73dc9bcc3f583f295a9a37b21071ebbab7c51. Good catch.

ghing avatar Oct 15 '14 04:10 ghing

I'm really sorry I've been MIA since the end of last year. Long story short, life's been a bit hectic. I still intend to get this done for you guys as soon as I have a free couple days to sit down and dive back into it. Anyway, again, sorry. @ghing @dwillis

ericlagergren avatar Feb 21 '15 21:02 ericlagergren

We've all been busy, so don't feel too bad. Let us know when you're back in the swing of things!

dwillis avatar Feb 21 '15 22:02 dwillis