candidate by state endpoint and infrastructure

Added infrastructure to standardize the placement of sql for building
the working tables and for building the endpoints/materialized views.
As well I added endpoints to get candidate transaction totals by state.