Looks like it's a county-by-county lookup function, crossed with state voting laws. We're building something county-by-county too - difficult locality matching issues.
Note that in some places, county isn't very useful for anything voting-related, and completely useless for down-ballot. Here in NYC, each county contains dozens upon dozens of polling places. And then each of the US House, state senate, state representatives, and city council have oodles of their own non-matching districts that don't match 1-1 with polling places either.
Getting any useful information about down-ballot races when there are thousands of separate races in a single media market is essentially impossible. And that goes doubly for the primaries, which are really the only races that make a difference here.