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.
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.