Template talk:Legislationuk

Goal
Discussion moved from Wikipedia talk:Lua/Archive 10.
 * @Uzume The overall goal is to create a systematised way to list acts (or other legislation), in a way that is easy to use and intuitive to understand. For comparison, just look at this list, in the old style.
 * One useful thing that the template does is automatically produce citations using the data saved at Module:Legislationuk/data. Pre-1963 legislation uses an entirely different system that is based on which regnal years of the monarch that a given parliamentary session spanned. This can get very confusing. That lookup table is designed so that you can input any date (going back to 16-whenever), and it'll tell you what the session citation is. It will also produce automatic URLs to legislation.gov.uk and the Parliamentary Archives (both of which are determined by the citation). What's more, you can also generate the list article introductions automatically in a templatised form, with the relevant bits filled in (e.g. numer of acts passed, type of acts, dates).
 * However, I agree that the current format is problematic, but I haven't really looked at this in any detail in about 18 months. At the very least, it's a necessary step to translate what we already have into a form that's actually possible to understand. I have no intention to start using it on any further pages until we've worked out what the final format should be, though.
 * By the way: the leading "act" is indeed redundant. I put it there in case this system gets used for other types of legislation like statutory instruments, as they would inherently need a modified layout. Essentially, a small form of future-proofing. Theknightwho (talk) 19:05, 11 February 2023 (UTC)
 * @Theknightwho: That does seem like an ambitious but perhaps useful endeavor. I cannot say I know much about legislation or more specifically UK legislation, however, I did recently run into s:Index:UKSI1964 (Part 3- Section 1).pdf. I realize that is part of the "statutory instruments" you mentioned which in turn are part of delegated legislation in the United Kingdom making them "secondary legislation".
 * Anyway, it sounds like you need about two or three key parts.
 * The first and perhaps easiest part is moving those from their current lists (as per the example you quoted) to a styled tabular format.
 * The next part is the "citations". We have a fairly extensive system for such things (albeit there are perhaps too many ways). That said, I did not see many if any citations in the old example you provided. I decided to I pick on 1964 in line with my recent SI experience and looked at List of Acts of the Parliament of the United Kingdom from 1964 which was listed as a transclusion at Special:WhatLinksHere/Template:Legislationuk. It has a "Citation" column so I think you are referring to citation of United Kingdom legislation. That seems like a fairly complex system in and of itself.
 * This is making me think you need a database which is probably what Module:Legislationuk/data is about. I am starting to wonder if there is a better long term goal though like trying to find a way to structure this data to fit into Wikidata or the like. Also I am wondering if the list articles are more of a secondary target than a primary one—meaning have a citation of United Kingdom legislation database (perhaps updated by a bot that polls the legislative websites or some such and posts data to Module:Legislationuk/data, Wikidata or something) and a means to pull data from it into articles like those lists but perhaps also other things like the articles on individual pieces of legislature like acts, instruments, etc.
 * As I am sure you can envision, a concept like citation of United Kingdom legislation is relevant to more than just English Wikipedia. This is why I do not like Module:Legislationuk/data. It would be far better to share this data across all of the Wikimedia Foundation websites. Perhaps a better solution is Tabular Data at Wikimedia Commons (see also Extension:JsonConfig/Tabular with code examples at Module:Tabular data) or Wikidata (see also Extension:Wikibase Client/Lua with code examples at Module:Wd and Module:WikidataIB, etc.).
 * I really do not want you to start a local database that then gets copied about from site to site. Many others already have this issue, including: Inline templates linking country articles or Automated taxobox system. They both have large complex data that have historic compatibility problems that people have been trying to improve upon for many years (trust me you could read about and research them for days). —Uzume (talk) 05:26, 12 February 2023 (UTC)
 * Thanks for the response. Yes indeed - you are correct that I was referring to the (parliamentary) citation of each Act. The module does also produce Wikipedia citations for the dates of parliamentary sessions, as these are generally not well-publicised. I suspect that that database of session dates is probably the most complete list of that type in existence: I had to manually compile it using the Journals of the House of Commons. Took about 2 weeks.
 * I agree with what you say about Wikidata in theory, and actually had the same idea back in 2021. I uploaded much (possibly all) of the info that we have here there, and I did have the idea of drawing it down automatically. However, my main concern about Wikidata is that it is much, much more vulnerable to undetected vandalism than Wikipedia. Here, all I need to do is make sure that the lists are all on my watchlist: even if I uploaded every Act ever passed going back to the 1200s, that would be under 2,000 list articles at most. On Wikidata, I managed to overload my watchlist through item creation so badly that even the raw watchlist tool crashed: I actually had to use the API to clear it! I have over 2 million edits there, and some people many more. As a result, a very large number of items are not watched by anyone. This leads to problems like racial slurs going undetected for months - and those only tend to get spotted because they’re visible on some Wikipedias. I just don’t trust Wikidata to retain the data accurately, as it’s stored in a way that makes it extraordinarily difficult to maintain.
 * I will have a look at tabular data on Commons, as that seems a bit more centralised. Theknightwho (talk) 18:44, 12 February 2023 (UTC)
 * @Theknightwho: That sounds like a good plan.
 * I did not know you managed to get most of the data into Wikidata already. I realize Wikidata has significant issues with undetected vandalism but there are other ways to ensure accuracy. You could write some constraints as a SPARQL query that could be run on a period basis to ensure validity and accuracy (and thus flag most simple vandalism and even mistakes).
 * Another issue with the Wikidata approach is the necessity to access many entities which quickly increase the expensive counter for a page rendering.
 * I too like the tabular data on Commons approach. If you are leaning towards that, I recommend taking an approach like Module:NUMBEROF and its submodules where the main module use  to load the submodules which in turn fetch data from Commons via  . They then massage the data obtained from Commons before returning it to the main module as a   for consumption by the main module ultimately for page rending (e.g., in your case wikitext HTML tables).
 * Perhaps the largest downside to tabular data on Commons is having to maintain your data in JSON format (but perhaps that isn't too much of an imposition for you). —Uzume (talk) 22:05, 12 February 2023 (UTC)
 * @Theknightwho: That sounds like a good plan.
 * I did not know you managed to get most of the data into Wikidata already. I realize Wikidata has significant issues with undetected vandalism but there are other ways to ensure accuracy. You could write some constraints as a SPARQL query that could be run on a period basis to ensure validity and accuracy (and thus flag most simple vandalism and even mistakes).
 * Another issue with the Wikidata approach is the necessity to access many entities which quickly increase the expensive counter for a page rendering.
 * I too like the tabular data on Commons approach. If you are leaning towards that, I recommend taking an approach like Module:NUMBEROF and its submodules where the main module use  to load the submodules which in turn fetch data from Commons via  . They then massage the data obtained from Commons before returning it to the main module as a   for consumption by the main module ultimately for page rending (e.g., in your case wikitext HTML tables).
 * Perhaps the largest downside to tabular data on Commons is having to maintain your data in JSON format (but perhaps that isn't too much of an imposition for you). —Uzume (talk) 22:05, 12 February 2023 (UTC)