Template talk:Usaf serial

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Aircraft by serial number[edit]

Joshbaumgartner, is there any way this template can be made to pass through the "regser" parameter from {{Acreg/layout}} so that categories like Category:SR-71 Blackbird by serial number will show up? Huntster (t @ c) 19:22, 7 October 2019 (UTC)[reply]

@Huntster: Okay did some updates. You can now add the 'rs' parameter for uses of {{Usaf serial}} to do this. Note that I revamped the parameters and added a proper documentation page to usaf serial. I added the template to a few SR-71s and it seems to work. On a side note, I raised Category:Lockheed SR-71 Blackbird for COM:CFD for standardizing the name throughout the sub cats. Thanks for adding the template to a bunch of aircraft. Josh (talk) 21:15, 7 October 2019 (UTC)[reply]
Joshbaumgartner, regarding SR-71 standardisation, I was thinking exactly that when I made a quick perusal of the cat structure, so that's good. Thanks for updating the template as well. Question, though: in which circumstances would you recommend *this* template be used compared to {{Aircraft registration}}? There's a lot of overlap. Huntster (t @ c) 03:07, 8 October 2019 (UTC)[reply]
@Huntster: {{Aircraft registration}} is something I came up years ago when far less experienced at template editing. It is pretty clunky (requires a lot of parameters from the user) and doesn't really do what I wanted to do with USAF serials. The idea was to use {{Usaf serial}} for all USA/AF serial numbered aircraft. It uses {{Acreg/layout}} for implementation which gives me some common code for similar templates, as I would plan on making a USN buno one, and ones for other established serial number systems. The idea is that {{Usaf serial}} is an entry template...that is it is an easy one for users to add without having to do too much parsing and doesn't have a lot of parameters required beyond those directly relevant to USAF aircraft. If there are ways to make it easier to use, or things that older templates do that you would like included in this template's abilities, let me know, it is all being developed. Josh (talk) 16:25, 8 October 2019 (UTC)[reply]
Joshbaumgartner: I certainly prefer {{Usaf serial}} for its simplicity. I was just looking at the very complex cases like the deeeeeeep categories of F-16, for example, and how {{Aircraft registration}} handles them. I find the F-16 tree an interesting test case, but I don't think we should *want* to copy that into other military aircraft categories. It's just too complex. Honestly, I'd love to find a way to develop a fully standardised set of subcategories for all aircraft, since what we have today is somewhat hit and miss.
All that said, perhaps a parameter for year of construction would be useful here? Admittedly, it can be pretty difficult to determine for some airframes, and I know some editors have confused the year in the serial numbers as year of construction. Huntster (t @ c) 17:06, 8 October 2019 (UTC)[reply]
@Huntster: Good suggestion, build year is easy to build in as an optional parameter (with a note to not just assume FY = BY). The F-16 is an aircraft in global service (>5000 built) that always attracts cameras and has a lot of good references available, so it lends to a very deep and detailed category tree since we have so much sheer material relating to it. Most aircraft do not have anywhere close to as much material so of course they should not have all of that structure. The idea, and I fully agree that a consistent structure is desirable, would be a scalable convention that can grow in line with the files available for an aircraft. We certainly do not want to force all of the structure of the F-16 on say the SEPECAT Jaguar, but the structure of the Jaguar ought to be consistent with the F-16 to whatever level of depth is appropriate for the aircraft. Probably is a discussion we can have going forward, not really relevant to the template. I do the template to try and work with the categories however they exist, not to drive category structure per se. Josh (talk) 21:38, 8 October 2019 (UTC)[reply]

Aircraft by service[edit]

Have you considered adding support for category trees like Category:Lockheed C-130J Hercules of the United States Air Force? This could seemingly fail down easily to Category:Lockheed C-130 Hercules of the United States Air Force and Category:Lockheed aircraft of the United States Air Force. Huntster (t @ c) 16:50, 11 November 2019 (UTC)[reply]

I just realised I wrote this but never actually pinged you, Josh, sorry. Huntster (t @ c) 16:39, 16 November 2019 (UTC)[reply]
@Huntster: No reason not to, I would think. I've added a bit that should at least handle the ac/3 parameter in "of the operator" categories. I may need to build it a bit more for corner cases when they come up. Josh (talk) 20:59, 16 November 2019 (UTC)[reply]
Joshbaumgartner, oh hey! Just noticed the effect, thanks for that. One other thing I've taken notice of today, that (for example) Aircraft numbered 1102 and Number 1102 on aircraft are in separate category trees, but the template only chooses one to throw in, even if an aircraft could go in both. Huntster (t @ c) 21:14, 16 November 2019 (UTC)[reply]
@Huntster: Yeah, I am also going to create a similar JASDF serial template for those numbers to support some implementations I have noticed. As for the numbers, the primary target is to place an aircraft in Aircraft numbered 1102 as the aircraft category does not necessarily depict the number actually on the aircraft. The fall back if Aircraft numbered 1102 does not exist is to place it in both Aircraft by number and Number 1102 on aircraft, but this is only until the preferred category is created. Josh (talk) 21:20, 16 November 2019 (UTC)[reply]
Joshbaumgartner, yeah, going through some of the JASDF has taken some...shoe-horning...to get things in place, since it needs both the USAF contract year for *that* set of categories and the JASDF tail number for *those* categories. Heh. No other good way to go about it, unless somehow this was converted simply into "Template:Serial" and the first field identifies the force... USAF, USN, JASDF, TAF, etc. Then again, trying to make one template do *everything* has not had a great track record on Wiki or Commons in the past! Huntster (t @ c) 21:26, 16 November 2019 (UTC)[reply]
@Huntster: Yeah, I think for JASDF/USAF aircraft they will need a proper cat for each number, otherwise you will find a JASDF serial listed under the 'ac by USAF serial' cat or vice-versa. I have made {{Jasdf serial}} and applied it to 05-1084 (aircraft) as well as creating 89-0118 (aircraft) to support it. See what you think. Josh (talk) 21:33, 16 November 2019 (UTC)[reply]
Joshbaumgartner, the Aircraft by Japan Self-Defense Forces FY05 serial number series is problematic, since they do not use the first two numbers of their own series to identify fiscal year. For example, 35-1071 (aircraft). The FY, I think, would still necessarily have to reflect the USAF FY, since that was all of their origins. Huntster (t @ c) 22:21, 16 November 2019 (UTC)[reply]

Built in dates[edit]

Joshbaumgartner, take a look at 40-2168 (aircraft), specifically that it is sorting into "Built in 1941" rather than "Aircraft built in 1941". I looked at the subtemplate here, but I could find no obvious reason why it would be malfunctioning in this manner. Huntster (t @ c) 16:38, 28 November 2019 (UTC)[reply]

Joshbaumgartner: another thought... considering these are serial numbers rather than registrations, properly, what about having the template check first if "by serial" and "by serial number" categories exist, and if not, then try to sort into "by registration". Right now it can be faked using |rs=, but this breaks other things slightly. Huntster (t @ c) 20:36, 29 November 2019 (UTC)[reply]
@Huntster: The sorting into "Built in 1941" is fixed. Seems that a simply 'ifexist' was not enough, but now it tests to see if the aircraft parameter is set first before checking if the category exists. Side benefit is that it might save a couple of pointless category lookups. As for the second thought, I think that situation is what I had in mind when I created the |rs= option, so interested to know what gets broken by using it like this. I may need to create |rs= for each level of aircraft identity or something like that to fix this. Josh (talk) 20:29, 2 December 2019 (UTC)[reply]
Joshbaumgartner, check out 42-97849 (aircraft) as an example. Remove |rs=serial number to see the difference. Specifically, using |rs= here kills off Aircraft by United States Army serial number. To be honest, I haven't extensively tested what else it might effect in other combinations, just because there are so many. I'll look into this more.
The B-17G cases I'm currently working on are interesting for the template, because I have both serial number and registration categories. This is why I think serial number should be the default, with registration as backup, since all these military aircraft categories *are* serial numbers rather than registrations-per-se. It would ultimately make it a lot easier going forward to default to serial number. Huntster (t @ c) 21:45, 2 December 2019 (UTC)[reply]
@Huntster: Okay, as I suspected, I may need to be more detailed in how |rs= is applied. Let me play with it a bit and come up with something. Josh (talk) 22:38, 2 December 2019 (UTC)[reply]

Serial number/registration error[edit]

Joshbaumgartner, take a look at 42-3352 (aircraft) if you don't mind. The template is trying to sort it into both the serial number and registration categories. Huntster (t @ c) 16:05, 11 December 2019 (UTC)[reply]

@Huntster: okay that is what I feared would happen earlier. So now instead of a simple early if for the serial number for aircraft1, it actually promulgates the rs parameter down to the aircraft2 (family) and aircraft3 (mfr) levels. Also, I've added parameters rs1, rs2, and rs3 that will allow some customization for each level as needed to get the desired results. There is an added complication however with this individual aircraft. You have Douglas as the manufacturer, so ideally it should show up somewhere under Category:Douglas aircraft by registration, but because of the nature of it being a Boeing aircraft generally, if a user goes to Category:Douglas aircraft by registration, they will never find it no matter how deep they go, as it instead is in Category:Boeing B-17 by serial number which is a sub of Category:Boeing aircraft by registration. I'm not sure if it is a big enough issue to warrant a lot of effort to cover cases where one company builds another company's design, but open to ideas! Thanks! Josh (talk) 23:35, 11 December 2019 (UTC)[reply]

Joshbaumgartner, note that it still sorts into both registration and serial number categories if |rs= is set. See the A-10 category 77-0259 (aircraft), where it tries to put it into "Fairchild aircraft by registration". Remove the subtype A-10A parameter and see how it changes the categorization to "Fairchild aircraft by serial number", which is still not appropriate since it's already in a serial number category. I still think that defaulting to serial number rather than registration would solve much of this, though the problem may simply be reversed and still exist. I dunno. Huntster (t @ c) 21:45, 5 January 2020 (UTC)[reply]

@Huntster: The most mundane of causes on that one... one of the variables was misspelled, so instead of looking for 'regserac2' which it should find, it was looking for 'reserac2' which didn't exist. This typo was copied in a few of the if statements so hopefully cleared up now. I see you closed the A-10 discussion, which is great, I am doing the same for the SR-71 right now. I think it is safe to say that the same process can be done to most aircraft where there is one clear manufacturer to list without need for a million CfDs. Josh (talk) 19:43, 6 January 2020 (UTC)[reply]
Joshbaumgartner: Oh, that's excellent. I was just too dumb to see it in the code. Now check out 42-31892 (aircraft), it's populating both aircraft types. See 80-0217 (aircraft) (which I've left mis-parametered) which sorts into both the aircraft and manufacturer serial number categories. And see 64-0553 (aircraft): it's not auto-categorizing into the existing registration categories, but if I apply |rs=registration it does. I'll create or convert the existing U-2 registration categories into serial number categories once you've looked at this, but it does show an underlying issue.
Sorry I keep throwing these things at you, but I am a bug tester at heart.
I must admit, I'm honestly not hugely keen on spelling out full aircraft designations for every subcategory...seems like "Fairchild A-10" or "Lockheed SR-71" would be sufficient and keep category names from becoming silly long (while keeping the top level category as "Fairchild A-10 Thunderbolt II", etc)...but didn't want to cause even more wasted time by keeping the CfD open. *shrug* Huntster (t @ c) 23:54, 6 January 2020 (UTC)[reply]
@Huntster: No worries, one person alone would never find these things. Please keep letting me know of any bugs or just any old improvement to make it easier or better you come across, I'm happy to dig into them. As for the names, I agree that a bunch of typing isn't ideal. It's why I would just as soon see the mfr deleted, as 'SR-71 Bl' is probably enough to get the search honed to what you are going for vs. 'Lockheed SR' before getting to the same point with mfr included. But like you I had no desire to belabor the issue, as far more important to me was getting vertical consistency (really helps with templates and such) by getting the same name up and down the tree. But anyway, on the latest item, I'll jump on that one tomorrow when I have a chance. I'm trying to manage two fall-back paths (first for the aircraft and second for the reg series), which don't necessarily draw down in parallel, but I will try some ideas tomorrow. Josh (talk) 00:56, 7 January 2020 (UTC)[reply]

P.S., nothing is auto-sorting into either serial number or registration categories, only sorting when |rs= is applied. Huntster (t @ c) 04:41, 8 January 2020 (UTC)[reply]

Build year question[edit]

Joshbaumgartner, I was wondering if you could add something to accommodate categories like Military aircraft built in 1944. Perhaps a |mby= for "military build year", so it would categorise there rather than the base build year category? Should accommodate both the military build year subcategories and the specific manufacturer build year subcategories. Thoughts? Huntster (t @ c) 05:39, 11 July 2020 (UTC)[reply]

Now that I think about it, a separate parameter is probably unnecessary. Just make "Military" the default (since this is the USAF Serial template), with the basic "Aircraft" build year secondary if military doesn't exist. Huntster (t @ c) 05:42, 11 July 2020 (UTC)[reply]
@Huntster: I'm not sure what military build year would be at any rate. The FY portion of the USAF serial is just the fiscal year during which the aircraft was officially purchased, it is not necessarily relevant to the year the aircraft was built. I would not want to use the FY as the default for how to categorize in 'Aircraft built in XXXX' categories, but I'm not sure if that is what you are suggesting or not. I am not crazy about sorting into 'Aircraft built in XXXX' categories by any default method at any rate, we should only place an aircraft in a particular year if we positively know that it was indeed built during that year. Josh (talk) 14:20, 21 July 2020 (UTC)[reply]
Joshbaumgartner, oh no no no. I'm talking about when a user specifies the |by= parameter, that the template should first check to see if a category like Military aircraft built in 1944 already exists and to sort there, and if it does not, then sort into Aircraft built in 1944. "If military aircraft, else aircraft". I would absolutely not want to assume any kind of build year, just when it is user defined. Huntster (t @ c) 14:27, 21 July 2020 (UTC)[reply]
@Huntster: Oh okay, that makes a lot more sense. In this case yes, I completely agree, since military aircraft is a sub of aircraft, that would make perfect sense. You are right that no second parameter is needed, since an aircraft should be under 'Aircraft built in 1944' or 'Military aircraft built in 1944' but never both (overcat). I think placing aircraft identified by USAF serial under military aircraft automatically is okay...I guess there could be a corner case for a few aircraft which were civil aircraft impressed into service later with a given serial, but we can worry about that as a specific issue when it arises. Josh (talk) 14:42, 21 July 2020 (UTC)[reply]
Joshbaumgartner, exactly. If this template is being used, it should imply that it is or was in military service, in either case the category would make sense. So thank you for working on this. I used to be good with templates, and I know the logic, but I've become almost completely incapable of actually writing the code. Deterioration sucks. Huntster (t @ c) 14:50, 21 July 2020 (UTC)[reply]
@Huntster: Sometimes I feel the same way... this one might be a tad more complicated than it first appeared. The first example I went to was Category:42-31892 (aircraft) which it sorts into Category:Boeing aircraft built in 1943. I don't want to remove it from that category since there is not a sub Category:Boeing military aircraft built in 1943, but instead just add it to Category:Military aircraft built in 1943. However, if it was being just placed in Category:Aircraft built in 1943, then I would want to remove that category and add it to the military one. The trick is how to test what category it is already being added to and then based on that determine whether to A) Keep original category and add military aircraft one; B) Keep original category and not add military aircraft one; or C) Replace original category with the military aircraft one, and to do this without overdoing the expensive parser functions like 'ifexist'. I think I'm going to have to give this more than 5 minutes of thought, as my coding is limited to template wikicode and not js or such. Josh (talk) 15:36, 21 July 2020 (UTC)[reply]
Joshbaumgartner, perhaps split it into two discreet trees? First being the "Military/aircraft" which will always be in effect in some fashion if |by= is used, and a second purely conditional one that just checks for manufacturer build years. Huntster (t @ c) 15:40, 21 July 2020 (UTC)[reply]
@Huntster: , so now it adds the military aircraft category by default without requiring any change to the individual pages it is used on, but also there is a |buildyearcat= available that will override the process so that corner cases can at least be manually defined to avoid overcat and such. If you come across any odd behavior, let me know. For the moment, there will be some overcat between 'aircraft' and 'military aircraft' trees on pages still using the default process, but I may have a more elegant solution in the future to fix this. Josh (talk) 21:10, 21 July 2020 (UTC)[reply]
Joshbaumgartner: Some cases I've noticed after testing. If {{usaf serial|42|32076|Boeing B-17G|Boeing B-17|mfr=|rs=serial number|by=1944}} is used (no manufacturer), it tries to categorize into both "Aircraft" and "Military aircraft" subcats. If {{usaf serial|42|32076|Boeing B-17G|Boeing B-17|mfr=|rs=serial number|by=}} is used (no build year), it tries to categorize into Category:Military aircraft built in. Honestly, I think the simplest solution is to just have the template dump all instances into "Military aircraft built in x" (if |by= is specified, of course), regardless of whether the category exists or not. Like with the Fiscal Year categories which weren't entirely complete, they can be created if they are currently a redlink. I've looked at the logic, and trying to account for both product and military build year trees with appropriate fall-backs if one or the other or neither exists...it just isn't worth the complication and bloat. Keep it simple...the number of missing "Military aircraft built in" categories is minimal.
@Huntster: It should add 'military aircraft built in XXXX' as a redlink if it doesn't exist now. Josh (talk) 19:09, 22 July 2020 (UTC)[reply]
As a side note, testing that particular use of template made me realize it categorized into both Category:Boeing B-17G by serial number and Category:Boeing B-17 by serial number, which probably isn't ideal.
Similarly, testing {{usaf serial|42|32076|Boeing B-17G|mfr=Boeing|rs=serial number|by=1976}} has it categorizing into both Category:Boeing B-17G by serial number and Category:Boeing aircraft by serial number.Huntster (t @ c) 07:17, 22 July 2020 (UTC)[reply]
These are index categories so overcat isn't such a big issue (in fact aircraft by registration is not covered by overcat rules). I suppose some more elegant fallback logic would be good, but there isn't much of a consensus on which levels of index make the most sense to maintain, so far as I have yet seen. Josh (talk) 19:09, 22 July 2020 (UTC)[reply]
Joshbaumgartner, sorry for not getting back to you before now, been overly occupied with work. While I agree that Category:Aircraft by registration is a valid exemption to the overcat rules and serves as a great example of a catch-all category, I would vehemently disagree that all sub-categories in that tree should serve the same purpose. Having a master catch-all category at the top of a given tree makes total sense, but no diffusion elsewhere in the tree makes even meta categories useless for locating items. I would still recommend limiting placement to only the most specific subcat, be it for registration, serial numbers, build years, etc. Huntster (t @ c) 05:50, 26 July 2020 (UTC)[reply]