Welcome, Guest. Please login or register.
Did you miss your activation email?
September 19, 2019, 10:38:27 pm
News: 2020 Presidential Predictions (General) are now active.

  Atlas Forum
  About this Site
  The Atlas
  RBH's Maps (Now, Atlas Election Entry Script & County Map Generation) (search mode)
Pages: [1] 2 3 Print
Author Topic: RBH's Maps (Now, Atlas Election Entry Script & County Map Generation)  (Read 124864 times)
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« on: January 01, 2007, 07:50:23 pm »
« edited: January 01, 2007, 07:59:46 pm by Dave Leip »

Hi all and Happy New Year:

I've got something that you may like here:  I've created a new datatable for other offices/elections that users can contribute through an upload script and generate county maps.  The upload script is still in development and is located here.  Here are the SC 2002 Races for:

Lt. Governor here

Sec of State here

State Treasurer here

Changes to link the pages from the wiki here

The form looks intimidating at first, but really not bad once you get used to it.  It requires the entry of the year, candidate names and party, the election type (general, rep primary, dem primary), the state, the office, the source info, possible notes for fusion, etc., and a tab-delimited county data file (there is an excel template linked on the input form page to assist you). 

Important: Data file:
only include lines in the tab-delimited file that contain data (no blank lines or title lines)
the tab-deliminted file must have UNIX return characters (there should be an option in the text editor or possibly excel to set this).
one state at a time and must include the fips and name info as shown in the template.

For Referenda, questions, initiatives, etc., the names would be shown like
"Question 5: Yes" with shortname "Yes"
"Question 5: No" with shortname "No"

There is a bunch more work to do to get the linked pages from the election summary to work properly for these elections (will be forthcoming).  Also, credit will be shown on the state summary page for the contributor.  Other offices can be added.

Please submit feedback (feature requests, bugs, etc.)

Enjoy,
Dave
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #1 on: January 02, 2007, 11:01:23 am »

Ok, either I did something wrong on this entry, or there's something wrong with the script

https://uselectionatlas.org/RESULTS/state.php?year=1984&off=3&elect=0&fips=21&f=0

The map shows up, the results table doesn't

Thanks - this was a code error in the State script.  Corrected.
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #2 on: January 02, 2007, 11:03:21 am »

It only allows you to upload a race once, even if you need to upload it again due to an error.

I've added the ability to over-write the data (if you were the person who entered it).  If you find an error in data that someone else submitted, please post it here, or email me.  This script change deletes all the old data before re-writing it - so be sure that you enter all the info again.
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #3 on: January 02, 2007, 11:08:28 am »

Very cool...although I'm a little confused.

I may be doing something entirely wrong, or my software is corrupting the CSV files somehow...but I did them in what I think is the correct format, and I'm still getting failure on everything.  No commas or anything.  I cannot seem to find the place in Excel where the UNIX line character is customised.  RBH, can you help me out here?

I am also getting the inability to upload issue.

Hi Alcon,
none of the county data were uploaded - the candidates, sources info show up in the database.  Note, do not use a CSV file, but rather a tab-delimited file.  Try this and let me know if it works.
Thanks,
Dave
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #4 on: January 02, 2007, 01:18:08 pm »
« Edited: January 02, 2007, 01:20:35 pm by Dave Leip »

It only allows you to upload a race once, even if you need to upload it again due to an error.

I've added the ability to over-write the data (if you were the person who entered it).  If you find an error in data that someone else submitted, please post it here, or email me.  This script change deletes all the old data before re-writing it - so be sure that you enter all the info again.

I get this messege when I try re-entering info for one race:

"Error: Geographic type Type for Name is not in database. Please check spelling or email Dave

Errors Encountered. Data not entered. Please correct and resubmit."

Hi,
This means that one of the geographic county types is not in my database.  The third column in the data file is the type of geographic unit (State, County, Parish, City are examples).  If any of these does not match an entry in my database (or is misspelled), it will generate this error.  Do you have other names in the list of data? 

It looks like in this case, the top row (label row) is in your data file. Be sure that you have deleted the label row and include only data lines in the file.
Thanks,
Dave
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #5 on: January 02, 2007, 02:29:59 pm »

Also note: avoid posting Gubernatorial and Senatorial contests in the 1990s as they will be added in bulk soon.
Dave
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #6 on: January 02, 2007, 02:47:49 pm »

  I cannot seem to find the place in Excel where the UNIX line character is customised. 

For new line translation, I use BBEdit (there is also a free version called TextWrangler) from Barebones on the Mac.  For PC/Linux land and MacOS X there is a small utility called flip to convert windows/mac newline characters to UNIX:

http://ccrma-www.stanford.edu/~craig/utility/flip/

Other options from the PC users?
Thanks,
Dave
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #7 on: January 02, 2007, 02:59:04 pm »

Also note: avoid posting Gubernatorial and Senatorial contests in the 1990s as they will be added in bulk soon.
Dave
Texas Tresurer Races are fair game though: https://uselectionatlas.org/RESULTS/state.php?year=1994&off=8&elect=0&fips=48&f=0

Texas data is pretty easy to gather. Nothing like the Mississippi data (the ones that are still on photocopied handwritten precinct returns)


Yeah, Texas, Florida, Kentucky, South Carolina, Georgia, among others have easily-accessible data for state-wide races in the 1990s/00s and are fast to add using the new script.  And think of all the time saved by not needing to color the counties with Paint ! Smiley
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #8 on: January 02, 2007, 06:44:06 pm »
« Edited: January 02, 2007, 06:53:56 pm by Dave Leip »

Another tip.  In the data file, be sure to replace any commas in vote numbers (such as 7,900 votes) with "nothing" and not space (needs to be 7900 and not 7 900).  Another way to do this is to format the data in excel as "General" prior to saving as tab-delimited .txt file.

I've also reposted the template xls file to change the formatting of the vote columns to "General"
Thanks,
Dave
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #9 on: January 02, 2007, 07:09:35 pm »


Error: Geographic type Type for Name is not in database. Please check spelling or email Dave

Check to be sure that the header row has been removed from the data file (data file should only include county, city, and state-level data rows and no column titles)
Errors Encountered. Data not entered. Please correct and resubmit.



I get that error now. I was using OpenOffice before and there was no .txt option, so now I am using Excel and saving it as tab-delimited .txt file and still having trouble.

This error means you have extra "stuff" in your data file.  In the case of WA 1972, you have two issues: the column headers are still in the file (first row) and second, all U.S. Counties are in the file when all you want to enter is Washington.  The data file needs to be just the data you are entering, no more, no less.  In your case, the first piece of data in the file needs to be 53001.

What I do is highlight the data from the state I want and copy it to a new blank spreadsheet then simply choose save as tab-delimited text.

I'll think a bit so see if we can make this more versatile.  I'm also now going to try open office and get back to you on its potential.

Thanks.  and thanks for the patience and help here to make this better.
Dave
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #10 on: January 02, 2007, 07:17:44 pm »

Open Office can save as tab-delimited - you  have to choose csv (.txt) and then in the next step, it gives you a choice for delimit character (choose {tab}).  However, it also requires you to choose a text character (" or ').  These would need to be stripped out of the file (I think).
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #11 on: January 02, 2007, 08:48:17 pm »
« Edited: January 02, 2007, 08:50:33 pm by Dave Leip »

Most of the linked pages are still a work in progress to get them to look for the data in the new upload table.  I've also disabled the "Primary" election choice for now until I can get a better handle on presenting the data.  It'll be back.

Another suggestion:
Please limit the "Independent" row for true "independent" candidates (typically a strong showing).  Libertarian, Green, US Taxpayers/Constitution, etc. are better in slots 4, 5, etc.

You can also see the most recent list of contributed election content here  These contests will also show up in the state election page, such as: here
Thanks,
Dave  
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #12 on: January 02, 2007, 10:44:35 pm »

Another minor bug:

Third-party maps are broken (Libertarian broke 10% in Skamania County)

This has been fixed.  If a minor party receives > 5%, they get their own map.
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #13 on: January 02, 2007, 10:45:05 pm »

Dave, the green on this initiative map doesn't appear. I don't know if it was my error or a site glitch.

This glitch happend while I was fixing Alcon's bug.  Corrected.
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #14 on: January 02, 2007, 11:03:26 pm »

Here's my first shot at it: https://uselectionatlas.org/RESULTS/state.php?fips=27&year=2006&f=0&off=9&elect=0

That's the Minnesota AG race this year.

Map works pretty good, so does the tables, but not graphs or individual county data, although appears to be the case with other maps.

Hi,
One error here - the "Write-ins" are listed as being column 10, but the datafile includes them under column 5 - so they don't show up.  I'm going to add a check to the script to catch this.  Also, what is the source of the 633 vote switch?  any idea? a single county data transposed?
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #15 on: January 02, 2007, 11:04:27 pm »

Don't forget to take your time with the data.  Quality counts!
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #16 on: January 02, 2007, 11:25:27 pm »

As practice, I decided to do an easy race in a state with not many counties. So here's AZ Attorney General this year:

https://uselectionatlas.org/RESULTS/state.php?year=2006&off=9&elect=0&fips=4&f=0

Great!
Feedback:
Arizona is very good with regard to source information: in this case, the title should be "State of Arizona Official Canvass 2006 General Election - November 7, 2006".  I've made this change.
Dave
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #17 on: January 02, 2007, 11:43:36 pm »

OK, I found the error, the totals in Becker county are transposed.

Great.  You should be able to over-write the data with the corrected data.  Thanks for checking!  Quality is important in elections Smiley
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #18 on: January 03, 2007, 08:43:03 am »

I've finished all of the do-able Washington election offices back to 1972 (click here).

Also, I notice that as it stands, red is being used for "yes" and green for "no" on initiative maps.  Isn't it generally the other way around, with "green" signifying success/go, etc.?

(Also added more to the initiative part above.)

This was an error on my part that I made late last night.  Thanks.  Yes is green and No is red.
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #19 on: January 03, 2007, 08:54:40 am »

I've finished all of the do-able Washington election offices back to 1972 (click here).

(Also added more to the initiative part above.)

Way to go Alcon!  Great enthusiasm!  Keep it up!
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #20 on: January 03, 2007, 09:31:22 am »

The state election page is linked at the bottom of each election page, such as South Carolina Governor 2002.  Its called "<state name> Election Results Home".  You also can select them from the pull-down menu at the bottom: Choose another Office.

They link doesn't exist in the frame version at the moment - I'll add that to the list of things to do.
Dave
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #21 on: January 03, 2007, 09:43:12 am »

Dave, if you can, would you mind changing this to 1976?  I'm not sure there is an easy way of doing it.

And this to 2002, if it isn't too much trouble.

Corrections completed.
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #22 on: January 03, 2007, 09:46:25 am »

And this to 2002, if it isn't too much trouble.

This map should also be changed to 2002- for some reason, I entered it in the wrong year. I also slightly misspelled the Democrat's first name as "Byran" instead of Bryan. 

Also note that this map was an attempt to correct the original map, which has the correct year and candidate spellings... but also reversed numbers in Athens County.

One of these maps should be deleted; the other should be fixed. My attempts to override the existing data have only resulted in error messages, so... can you help? Wink

The best way to correct for these is to over-write the data with the correct data.  Can you describe for me the errors?  You should only need to check the two boxes on the bottom of the entry form to over-write file and over-write data.

Thanks,
Dave
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #23 on: January 03, 2007, 10:49:20 am »
« Edited: January 03, 2007, 10:53:55 am by Dave Leip »

Jesus - there was a very obscure bug in the script that was causing the data not to be loaded if there was no Democratic candidate.  This caused your Idaho election submissions to fail.  They should now work.  As for the data.php errors, this looks to be on my end (related to the office).  I'll work on the script to show this correctly.
Thanks!!
Dave
Logged
Dave Leip
leip
Administrator
YaBB God
*****
Posts: 3,333
United States


P P P
WWW
« Reply #24 on: January 03, 2007, 10:51:24 am »

Now that's fixed, is there any way to remove this map completely? It was a dumb mistake on my part to put in the wrong year, and there's no reason for this to stay on the Atlas.

Upload the correct data Smiley
http://www.sos.state.oh.us:80/SOS/ElectionsVoter/results2006.aspx?Section=1844
Logged
Pages: [1] 2 3 Print 
Jump to:  


Login with username, password and session length
Logout

Terms of Service - DMCA Agent and Policy - Privacy Policy and Cookies

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

© Dave Leip's Atlas of U.S. Elections, LLC