Apart, an extremely detailed political map of North Carolina

When doing my senior thesis in Economics, I discovered a treasure trove of data. The North Carolina State Board of Elections maintains a record of public use, individual-level voter registration data for the past 15 years. Each individual is uniquely identified, characterized demographically, and located via home address. After geo-coding these home addresses, I was able to get the rooftop-level location of every single registered voter in North Carolina.

I then decided to develop a web app which would allow you to visualize where residents of different parties were staying, at different levels of detail. Enter… apart!

A residential neighborhood in Statesville, North Carolina

See the residential location of every single registered voter in North Carolina in 2020 - red for Republican, blue for Democrat, grey for unaffiliated.

At larger zoom levels, see aggregations of Democrats vs Republicans on a broad scale. The redder the area, the more densely populated the area is by Republicans as compared to Democrats. The same is true for the Democrats if the area is bluer. Purple areas are therefore areas with a more even balance between Democrat and Republican residents.

Architecture

I use ReactJS for the front-end, with react-leaflet as the map framework. Huge kudos to the team maintaining react-leaflet and the OpenStreetMap contributors behind the map tiles, it is truly a grand undertaking and it is amazing that it is open source and available for free. On broad zoom levels (<16), summary map tiles (pre-rendered using a Python script) are loaded. On the smaller zoom levels, the bounds of the map view are used to send an API request to a simple NodeJS backend server for the relevant individual locations of party affiliates. The server then queries a MySQL database instance, delivering the records back to the ReactJS frontend, which then parses the fields and serves them as dots in various colors. Each of these will have to be deployed on dedicated servers, with the front-end on Vercel and the back-end (NodeJS + MySQL) on a VPS. The NodeJS server is run locally, and is then exposed via nginx to the public as an API.

Try apart here!