I'm looking for help in structuring the following project.
I am creating a Voter database that will be used in political campaigns for outreach and canvassing. I have a list of voters with associated data including voting history for the last 8 elections.
I've started with creating a Voters custom post type with associated custom fields (CF) and taxonomies (Tax):
Voters: Each voter has a set of information attached to them like voter ID#(CF), Name(CF), Date of Birth(CF), sex(Tax), contact information like address and phone number (CF), congressional district(Tax), voting precinct (Tax) registered political party (Tax) etc.
I have managed to import about 10,000 voters into this CPT using WP All Import Pro.
My next task is where I am looking for guidance.
I want to Import the Voters History. This list has their Voter ID number as the common key, and also which of the last 8 elections the voter participated in, this includes the date, the election title and the method of voting (mail ballot or in person.)
This data needs to be filterable so we can filter voters based on their history, which is important in identifying likely voters.
My question should "elections" be a child custom post type or a Taxonomy? I'm leaning towards taxonomy but then not sure how to implement the method of voting variation? Or maybe there is a more logical way to do this that I have not considered?
Dear Mike,
I assume we are talking about this:
one "Voters" can connect to multiple "Elections"
one "Elections" can connect to multiple "Voters"
In your case, I suggest you try to setup "Elections" as a post type, and setup many-to-many relationships between post type "Voters" and "Elections", see our document:
Implementing many-to-many relationships
https://toolset.com/documentation/beyond-the-basics/post-relationship-concepts/implementing-many-to-many-relationships/
Yes it appears it would be a many to many relationship so I will give that tutorial a try.
While I am setting this up I have two questions:
Will I be able to import my Elections and associate them with the "Voter" CPT? I do have the Voter ID in the history file and also have this in the Voter CPT already.
Will I be able to filter my list based on the Election?
Q1) Will I be able to import my Elections and associate them with the "Voter" CPT?
Types plugin is using a custom field "_wpcf_belongs_[parent-slug]_id" to store the parent post ID, for example:
Parent post type "Voter", post type slug "voter" + parent post type "Elections"
- Child post type "voting"
When you import the "voting" posts, in each "voting" post, you will need to setup a custom field "_wpcf_belongs_voting_id", field value is the "Voter" post ID.
Q2) Will I be able to filter my list based on the Election?
Yes, it is possible to setup a view to query the child post "voting", and filter by parent posts, see our document:
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/#displaying-child-posts-using-views
section "Displaying child posts using Views"