Template talk:Infobox United States legislative district

Latest comment: 1 year ago by Penndyl in topic Map inclusion
WikiProject iconInfoboxes
WikiProject iconThis template is within the scope of WikiProject Infoboxes, a collaborative effort to improve the coverage of Infoboxes on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
WikiProject iconUnited States: Government Template‑class
WikiProject iconThis template is within the scope of WikiProject United States, a collaborative effort to improve the coverage of topics relating to the United States of America on Wikipedia. If you would like to participate, please visit the project page, where you can join the ongoing discussions.
TemplateThis template does not require a rating on Wikipedia's content assessment scale.
Taskforce icon
This template is supported by WikiProject U.S. Government.

Data sorting edit

  Moved from User talk:Pppery
 – * Pppery * it has begun... 18:16, 10 June 2020 (UTC)Reply

Hi Pppery! I saw your note on Template:Infobox_United_States_legislative_district when you reverted my change earlier. I'm really sorry for breaking your page(s). I tested it on several pages before deploying, and it seemed to be working correctly. Do you mind pointing me to which page(s) broke so I can test it out more and see what the issue was?

Thanks!

Brooklynpedestrian (talk) 01:02, 10 June 2020 (UTC)Reply

Texas Senate, District 3 is one example. * Pppery * it has begun... 01:43, 10 June 2020 (UTC)Reply
Thanks! Looks like a simple fix where I was accidentally using percent_asian instead of percent_hispanic. You can take a look at the fix in the template's sandbox, and I've also added a suite of test cases to make it easier to spot if things go wrong next time someone makes changes. Do you have any other concerns, Pppery? Brooklynpedestrian (talk) 05:44, 10 June 2020 (UTC)Reply
While your code does now appear to work, I still don't see what the point of it is; it feels like unnecessary feature creep to me. * Pppery * it has begun... 14:07, 10 June 2020 (UTC)Reply
Thank you for the feedback. There are three improvements that this makes:
1. It organizes the demographic and political party information from greatest to least so that it’s not in an arbitrary order. I feel that this is a readability improvement when scanning this info.
2. It actually simplifies the logic of the template. You pass all of the data points into a sorting algorithm and let that handle the order rather than saying “ok if ‘Democratic’ isn’t defined, we’re not going to display this section at all or if percent_white isn’t defined, we’re not going to display the section at all, and then we’re going to display the data in this specific order.”
3. Maintainability is improved, as instead of figuring out where a new demographic or political party needs to go in the order, you simply plug it in to the sorter.
Thanks, and please let me know what you think. Brooklynpedestrian (talk) 17:39, 10 June 2020 (UTC)Reply
First of all, your code is objectively more complicated, in that it invokes a 1,273-byte Lua module, whereas the previous code had a simple #if statement doing the same thing.
Many of your changes are addressing a non-existent problem: this template had only been edited 8 times in the 7 years between its creation and your first edit to it, and none of them added support for additional demographics or political parties. Nor do I see any reason to expect the primary demographic or political groupings to change in the future. There's no point in making something that has never happened easier.
Are there actually any Legislative districts (the example in the documentation doesn't count) in which neither the Democrats nor the Republicans have a plurality? If not (and I think it is unlikely), then there's no point in adding complexity to support a non-existent use case?
The thing that is least obviously bloat is sorting the demographics, which may be a minor improvement, but isn't worth invoking even more custom Lua code for in my opinion. * Pppery * it has begun... 18:32, 10 June 2020 (UTC)Reply
For the purposes of this discussion, I'm fine dropping points 2 and 3 that I made above. However, I do still think point 1 stands. There are already districts across the country where white is not the primary demographic (e.g. New York's 57th State Assembly district). A sorted list is easier to process for the reader than an out-of-order one, and I believe our goal with these templates should be to help the reader process information as best we can. Brooklynpedestrian (talk) 20:00, 10 June 2020 (UTC)Reply
An addendum, there are a handful of districts throughout the US where nonaffiliated/independent voters outnumber either the Republicans or the Democrats. New York's 57th State Assembly district that I mentioned earlier is one of several in New York, and I know there are several in Nebraska as well, among I'm sure other states. Brooklynpedestrian (talk) 21:51, 10 June 2020 (UTC)Reply
"No party preference" is kind of like "other", so it makes sense that it always goes at the bottom. I don't have strong objections to sorting the demographics, but just don't consider it worth the code complexity. * Pppery * it has begun... 21:32, 11 June 2020 (UTC)Reply
I would suggest that for changes like this, if we think it would be better for readers (which it sounds like we either think yes it would or we're neutral), then the code complexity is less important. I would argue that readers aren't worried about code complexity; they just want the best reading experience.
Also to refute your earlier comment, the Lua module it's invoking is only roughly half of the page size. Only one 13-line function is being invoked.
If we're still in disagreement here, I'm happy to seek some third opinions. Brooklynpedestrian (talk) 21:39, 11 June 2020 (UTC)Reply
  Response to third opinion request:
Hello. After reading through this talk page, it seems like it makes more sense to sort logically, even if it adds a little code complexity. Especially if it is, as Brooklyn Pedestrian stated, 13 lines.Wildjerry (talk) 16:08, 18 June 2020 (UTC) Wildjerry (talk) 16:08, 18 June 2020 (UTC)Reply

VA House of Delegates edit

would it be possible to update this template to allow for the distinction of house of delegates (lower house) in addition to state assembly and house of representatives. would allow for it to be used in state legislative pages for the state of Virginia House of Delegates Epluribusunumyall (talk) 20:51, 17 August 2020 (UTC)Reply

Map inclusion edit

Hi! Would it be possible to add an Image_map parameter to include a maplink to OpenStreetMap areas of district boundaries? Penndyl (talk) 17:27, 27 December 2022 (UTC)Reply