archibalduk wrote: Tue Feb 22, 2022 8:54 pm
As you've identified per your screenshot C above, you need to complete the staff_history template and then import. The error shown in screenshot D shows "True" under the Staff Error column (column A). This means that the database you are importing into doesn't have a Craig Ludwig with the 15.3.1961 DOB. This is either because the player doesn't exist in the database or there is a typo in the name or DOB. You just need to either (i) add the player to the DB or (ii) correct this error in your spreadsheet in screenshot C and then it should import ok.
All's well that ends well! Double- and triple-checked that his name and birthday were correct and was stumped for a while. For a moment, I was legitimately asking myself "Is his name really Greg Ludwig, and I've mistakenly thought it was Craig for 25 years?" But I got it to work after I changed the filename to "staff_history", which I probably should've tried to begin with. Also noticed in the Import options that both date of birth boxes were unchecked (probably from me mindlessly clicking around through menus). I checked "full date of birth" so that might've been the issue too.
The only speedbump was that, at first, it imported all of the "playoff" fields as false, due to Excel's INFURIATING insistence on forcing boolean values where the importer is expecting strings. I have no idea why Excel's default setting is to assume you don't want to input the thing you're repeatedly trying to input, but whatever, it was a simple thing to fix. Loving the editor though, congratulations on writing a data editor for a niche hockey simulator that works better & more intuitively than a program actively developed over decades by a software company with a two-trillion-dollar market cap
edit: D'oh, spoke too soon. It's saying all 29 rows are successfully imported, but then his history only shows 16 rows, all with a Playoffs value of "false" — except it's showing his playoff stats in the years where he did make the playoffs. It only shows his regular-season stats in seasons he didn't actually make the playoffs. It's as if it's importing all 29 rows, (16 regular seasons + 13 postseasons), but only displaying 16 because it doesn't want duplicated values in the "Year" fields. And in those cases, i.e. years he made the playoffs, it's "combining" both regular season/playoffs instances of the year by overwriting his regular-season stats with his playoff stats that year. It doesn't seem to matter whether the data type in the spreadsheet is boolean or text. I'm going to just manually set the 13 playoff seasons to "True" and re-import the remaining 16 regular seasons, minus the three non-playoff seasons which are already represented accurately, and see if that works.
edit 2: That worked! All of his career history is now accurate. I tried a hunch and deleted all the "false" values in the Playoffs fields in the 13 remaining seasons of data, since they were confusing Excel so much, and imported it with blank cells, thinking the Importer might read those as false. Success! To my surprise, it even re-ordered the History IDs in correct sequential order (n for his rookie season, n+1 for the playoffs that year, n+2 for his second season, etc.) For the handful of DAL guys without histories, it sounds like I might need to just use blank Playoffs cells for "false" since I'm just now realizing the Editor might be reading the presence of data and returning a True value. If that doesn't work, I can just upload regular season + playoffs separately, like I ended up doing with Ludwig.
Hockey-Reference lets you modify and export its tables very easily, It seems like it would be reasonably simple to write a Python utility that uses the csv module to mold Hockey-Reference spreadsheets/CSVs into the staff_history template, to be fed immediately into the Editor. Tempted to give that a try, although since there are only a couple of other DAL players without histories, that *might* be overkill, ha.