Module talk:Conservation status
Add topicModule Created
[edit]This module is designed place the conservation status in taxoboxes and to eventually replace {{taxobox/species}}. The basic code handles all the existing conservation systems handled by the template and so far I haven't seen any errors when testing. However more is needed before replacing the template code.
As a first step I've added a couple of regional conservation systems. I've modified {{taxobox/species}} to invoke the module for these systems, leaving the template code to handle existing systems. This way only new conservation systems or thoroughly checked taxoboxes are handled by the module.
Below is a summary of conservation status systems and their use in taxoboxes (under construction)
Summary of conservation system usage
[edit]| Conservation status system | Taxobox | Speciesbox | Subspeciesbox | Total |
|---|---|---|---|---|
| IUCN 3.1 | 8204 | 36303 | 310 | 44826 |
| IUCN 2.3 | 3669 | 5211 | 40 | 8928 |
| IUCN unspecified | 2 | 1 | 0 | 3 |
| IUCN (all) | 11875 | 41515 | 350 | 53757 (5 automatic taxobox) |
| TNC (none use NatureServe parameter value) | 806 | 1271 | 2106 | |
| CITES | 4 | 138 | 2 | 162 (18 automatic taxobox) |
| ESA (USA) | 42 | 115 | 52 | 213 |
| DECF (Western Australia, Australia) | 27 | 669 | 0 | 629 |
| QLDNCA (Queensland, Australia) | 3 | 46 | 0 | 49 |
| NZTCS (New Zealand) | 35 | 96 | 2 | 134 (1 automatic taxobox) |
| COSEWIC (Canada) | 1 | 2 | 1 | 4 |
| EPBC (Australia) | 127 | 434 | 594 | |
| Newly handled regional systems (by module) | ||||
| CNCFlora (Brazil) | 1 | 1 | ||
| TPWCA (Northern Territory, Australia) | 2 | 7 | 9 | |
| Totals (including empty) | 18604 | 49379 | 550 | 68860 |
stripped div tags
[edit]@Jts1882: I have little knowledge of how to code modules, but I believe this module is causing stripped tag lint errors for </div>; most likely the final </div> should be removed in the two uses of
output = output .. "<small> (" .. systemText .. ")" .. refs .. "</small></div>"
Please see if you agree. —Anomalocaris (talk) 22:39, 18 August 2019 (UTC)
Kingdom detection is broken
[edit]@Jts1882: Your recent edit seems to have broken kingdom detection, resulting in (for instance) all articles previously in Category:Fauna listed on CITES Appendix II now being placed in Category:Taxa listed on CITES Appendix II. (Before I fixed it, they were actually winding up at Category:Taxon listed on CITES Appendix II.) jlwoodwa (talk) 01:56, 16 November 2025 (UTC)
- Thank-you for the heads up. I was trying to quickly fix something raised at the Village Pump and should have waited until I add time to check everything was working as intended. The Taxa categories should be empty and all placed in the Fauna or Flora categories, which I think they will when the changes are propagated. — Jts1882 | talk 11:01, 16 November 2025 (UTC)
CITES references missing
[edit]Hi @Jts1882, I think one of your recent edits to this module have caused CITES ref footnotes to disappear from speciesboxes - see for example at Aloe abyssicola, where the speciesbox still displays CITES Appendix II but without the ref included in the |status_ref= parameter. The reference still appears in the reflist, but the footnote in the speciesbox no longer appears. I assume that this is an unintended side effect of editing this module so that |status_system= doesn't add a redundant (CITES) system identifier? Ethmostigmus 🌿 (talk | contribs) 00:38, 21 November 2025 (UTC)
- Yes, it was removing the redundant (CITES) that introduced the error. I've fixed that.
- However, the CITES status is shown slightly differently to other statuses. It shows "CITES Appendix I" whereas others are of form "Endangered (IUCN 3.1)". Perhaps it should be changed to "Appendix I (CITES)". — Jts1882 | talk 08:23, 21 November 2025 (UTC)
- Cheers for the fix! I do like the look of the "Appendix I (CITES)" format slightly better than "CITES Appendix I". Ethmostigmus 🌿 (talk | contribs) 02:28, 22 November 2025 (UTC)
SANBI RA/Rare status
[edit]@Jts1882: Bulbine louwii uses the valid SANBI status of "RA" = "Rare", which could usefully be added to this module, I think. Peter coxhead (talk) 07:46, 11 March 2026 (UTC)
- Status has now been removed as it didn't work, but still valid. Peter coxhead (talk) 10:29, 11 March 2026 (UTC)
- @Peter coxhead: I've updated the module to allow the status. There is a simple graphic just showing rare, which I've included for now. I'm inclined to just show the text. What do you think? — Jts1882 | talk 11:39, 11 March 2026 (UTC)
- @Jts1882: thanks for the update. I think the simple graphic is fine; omitting altogether would also work for me.Peter coxhead (talk) 11:58, 11 March 2026 (UTC)
- @Peter coxhead: I've updated the module to allow the status. There is a simple graphic just showing rare, which I've included for now. I'm inclined to just show the text. What do you think? — Jts1882 | talk 11:39, 11 March 2026 (UTC)
Module update
[edit]- More generally, I strongly support moving all the support for conservation status in taxoboxes to this module. Given what it does,
{{Taxobox/species}}is a weird name, which I never seem to remember. I wonder if it would be simpler to maintain if instead of theelseifs in functions likep.IUCN23, a table was used like the approach in Module:Taxobox ranks. I vaguely remember starting the design of this module withelseifs before settling on the use of a table. One (minor?) advantage is that you can then include a function to display the table for documentation purposes and debugging. Peter coxhead (talk) 11:58, 11 March 2026 (UTC)- Yes, a table of entries like
{ status, image, linked_text, category }for each system might be easier to read and they could probably be eventually combined into a larger 2D table. - There is a lot of stuff in
{{Taxobox/species}}in the default option of the line 2 #switch{{{1}}} statememt for when there no system (from line 269 to line 378). I don't know how much that code is still needed and didn't understand some of it when I last looked. I suppose Category:Taxoboxes needing a status system parameter might answer that. - A starting point would be to move all the systems to single line calls of the module status function (e.g. like lines 263-267), which would remove about 250 lines unless comments are included.
- Is there a sandbox setup so a modified
{{Taxobox/species/sandbox}}could be easily tested? — Jts1882 | talk 14:11, 11 March 2026 (UTC)- Well, looking at the history of Template:Taxobox/species, not much happened between the original creators of the automated taxobox system around 2010 to 2011 and you starting work on it. I'd forgotten that I set up Template:Taxobox/species/sandbox, but it was only for minor changes and Template:Taxobox/species/testcases was only to test the use of
|extinct=(which behaves badly from a software engineering point of view, because it functions as true/false for ancient extinctions and to set a date for recent ones). So there doesn't seem to be anything useful available for testing different status systems and values. - As I understand it, the code in line 269 to line 378 tries to handle the status value when there's no status system value present. So when put in a table,
{{Taxobox/species| |VU}}generates
- Well, looking at the history of Template:Taxobox/species, not much happened between the original creators of the automated taxobox system around 2010 to 2011 and you starting work on it. I'd forgotten that I set up Template:Taxobox/species/sandbox, but it was only for minor changes and Template:Taxobox/species/testcases was only to test the use of
- Yes, a table of entries like
- More generally, I strongly support moving all the support for conservation status in taxoboxes to this module. Given what it does,
- without a system to which VU belongs. But sometimes the code in effect decides on a system based on the status value, e.g.
{{Taxobox/species| |G1}}gives
- without a system to which VU belongs. But sometimes the code in effect decides on a system based on the status value, e.g.
G1 |
- It's all very ad hoc and inconsistent. It would simplify things if the status was ignored completely when there's no status system value present, just putting the article into the error-tracking category. Peter coxhead (talk) 16:05, 11 March 2026 (UTC)
- So the G1 uses the NatureServe graphic, but without adding the parenthetic text after the status. It still adds it to the category, even though making assumptions about the graphic.
- I had a look at Category:Taxoboxes needing a status system parameter and there were only four entries. I fixed one which was an IUCN3.1. The three others were based on research papers determining the status, but were not official assessments.
- With so few examples, I suggest we remove all that code for when there is no status system and give an error message for status system required. For the three examples we could allow a pseudo-system (e.g. "unofficial") and check for a reference. — Jts1882 | talk 17:07, 11 March 2026 (UTC)
- I agree. Peter coxhead (talk) 09:51, 12 March 2026 (UTC)
- It's all very ad hoc and inconsistent. It would simplify things if the status was ignored completely when there's no status system value present, just putting the article into the error-tracking category. Peter coxhead (talk) 16:05, 11 March 2026 (UTC)
- I propose the following:
- Replace the code in
{{Taxobox/species}}for each system with a single line call to the module. I'll do this one by one so I can test it in editor mode. At the same time I'll update the documentation as that can be used for checking the output in editor mode. - Once this is done we can remove all the systemless code and make sure this has no unexpected consequences.
- Eventually the code can be replaced by a single module call to a new main function.
- Replace the code in
- I'll also look at a table alternative for the if ... else statements. — Jts1882 | talk 13:08, 12 March 2026 (UTC)
- @Peter coxhead: I've made a start on converting to the module. I've changed IUCN2.3. I'll do this slowly to give a chance for any issues to show up. — Jts1882 | talk 14:23, 13 March 2026 (UTC)
- @Jts1882: all sounds good to me. Peter coxhead (talk) 14:26, 13 March 2026 (UTC)
- I've now updated all systems except IUCN3.1.
- One minor issue did come up regarding the extinction date (now fixed), which led me to the North Island takahē article. Both the IUCN and NZTCS show "Extinct (1894)", when the date only applies to the IUCN. This is because there is a single
|extinct=parameter that is used by both status systems. Ideally there would be|status_extinction_date=and|status2_extinction_date=but changing this would be problematic due to the number of uses of|extinct=. For NZTCS I could remove the extinction date code as it doesn't give them in the examples I've looked at, but the issue will exist for other status systems. — Jts1882 | talk 17:11, 15 March 2026 (UTC)
- @Jts1882: all sounds good to me. Peter coxhead (talk) 14:26, 13 March 2026 (UTC)
- @Peter coxhead: I've made a start on converting to the module. I've changed IUCN2.3. I'll do this slowly to give a chance for any issues to show up. — Jts1882 | talk 14:23, 13 March 2026 (UTC)
- @Peter coxhead: I've now update IUCN3.1 to use the module, so all recognised status systems are handled by the module.
- What we have left in {{taxobox/species}} is:
- (lines 51-60) This section, erroneously headed "no status system" actually handles unrecognised status systems and adds Category:Taxoboxes with an unrecognised status system. This outputs linked text for statuses EX, CR and EN or plain text for anything else.
- (lines 61 onward) This handles cases where there is no status system
- (lines 62-63) handles extinct species with no system and has no taxobox category. This is used by Viti Levu snipe, Caspian tiger, etc. I suggest adding Category:Taxoboxes for extinct species without status system parameter.
- (lines 64-82) handles some statuses without a system (the IUCN statuses and Secure). Category:Taxoboxes needing a status system parameter is added and there are three cases of this category all handled in this code block. All three have references proposing status using IUCN criteria. I suggest we add a category, something along the lines "informal" or "proposed".
- (lines 85-87) handles domesticate animals. This is used for articles such as cat and dog. I suggest adding Category:Taxoboxes for domesticated animals without status system parameter
- (lines 88-94) handles PE, PEW and CITES and adds Category:Taxoboxes needing a status system parameter. This isn't code block isn't used.
- (lines 95-100) handles statuses FOSSIL and PRE and adds Category:Invalid conservation status, which is empty.
- (lines 101-103 handles status TEXT and displays See text. No category added, but I can't find any examples using the search facility.
- (lines 104 onward) handles statuses used by non-IUCN systems and adds Category:Taxoboxes needing a status system parameter and includes a hidden comment "This case is subject to deletion once status systems are added". I assume this was added for testing and the code was never deleted. There are no taxoboxes using these statuses in this category.
- I suggest the next steps are to:
- Delete #6-#9 and add Category:Invalid conservation status as the default to the switch statement on line 61 to confirm this isn't used.
- Add categories for extinct and domesticates without a system, as well as the three informally proposes statuses.
- This should reduce this block of code to a more manageable number of lines, which I can then move to the module. Any thoughts? — Jts1882 | talk 16:07, 18 March 2026 (UTC)
- @Jts1882: just a couple of issues that occurred to me:
|extinct=is problematic, as I noted above, because for long extinct/fossil species it's used with the value "yes" to mark the species extinct when the parent taxon (usually genus) is not. In this use it has nothing to do with conservation status. For recently extinct species with a status system and a status like "EX" it's used to add a date to the "EX", or if|status=EXis absent, to behave as "yes". Caspian tiger should be shown as "Extinct (1970)" solely based on|extinct=1970, which is supported in the text. A recently extinct species doesn't need|status=EXif there's no system but there are sources to support the date of extinction. Category:Taxoboxes for extinct species without status system parameter would thus collect articles that don't need a status system.- For domesticated animals,
|status=domesticatedagain doesn't need a status system – do any of them have this value? So Category:Taxoboxes for domesticated animals without status system parameter would collect articles with no possible status system. Giving the "conservation status" as "domesticated" is equivalent to saying "domesticated, so conservation not needed".
- Peter coxhead (talk) 07:41, 19 March 2026 (UTC)
- Thanks for the background on
|extinct=. Looking at some examples,|extinct=yesno longer works.|status=EXis required, e.g. Viti Levu snipe (speciesbox), Mesopropithecus (automatic taxobox), Caspian tiger (population taxobox). - I was thinking of the extinct and domesticated categories as a means of getting the number rather than fixing missing status systems. So this was more for interest (counting how the parameters are used) than fixing a problem. I hadn't intended my choice of category name to imply it was about fixing the paremeter (maybe omit parameter from name).
- I can find no examples of
|status=DOMwith a status system (there are three with an empty parameter). — Jts1882 | talk 10:19, 19 March 2026 (UTC)- @Jts1882:
|extinct=yesdoes work in a Speciesbox and is needed, but not for conservation status. Go to Homo erectus for example. Note that the species has † although the genus does not. Now edit to remove|extinct=yesand preview. The † disappears before the species. Peter coxhead (talk) 12:24, 22 March 2026 (UTC)
- @Jts1882:
- Thanks for the background on
- @Jts1882: just a couple of issues that occurred to me:
- @Peter coxhead: I've being going through the code in {{taxobox/species}} that handles statuses without
|status_system=, deleting code that is now unnecesary and unused. I notice that the fourth from last line (currently line 92), the default of the status switch statement, outputted the content of|status=without modification or adding a category. I added Category:Invalid conservation status, which collected around 50 cases that I've being going through. - A surprising number had an image caption in
|status=. A few had|status=>or other trivial content. - Many were raw statuses, but had a reference for the conservation system in the text. Some were IUCN, Natureserve or other handled systems, which now specify the system and reference. The rest were either proposed statues in a research article or unhandled systems. I added
|status_ref=to these, but they remain in the category. - Many (at least half the remaining category) of the the raw statuses were spiders using South African National Survey of Arachnida (SANSA) publications. I could add handling of this system, but there isn't a wikipedia page to link to. There is one for the South African National Biodiversity Institute (SANBI), which produces the Red List of South African Plants and seems to have an affiliation with SANSA. The information on SANSA is out-of-date, although several new publications are recent. Any suggestions? — Jts1882 | talk
- @Jts1882: tricky. I think that so long as there is a ref, displaying what the ref claims to be the system in the taxobox is ok, otherwise not. Could just use "Informal"? Peter coxhead (talk) 12:28, 22 March 2026 (UTC)
- I was thinking something like "informal" or "none" could be used in
|status_system=to indicate that no status system was a deliberate choice by the editor, rather than just oversight, but I wouldn't display it. I plan to add a check for|status_ref=, so an alternative would be to only use a tracking category when there is no system and no reference. This approach would empty the category (apart from few SANSA spiders I haven't changed yet). — Jts1882 | talk 12:42, 22 March 2026 (UTC)only use a tracking category when there is no system and no reference
seems the right approach to me. Peter coxhead (talk) 16:52, 22 March 2026 (UTC)
- I was thinking something like "informal" or "none" could be used in
- @Jts1882: tricky. I think that so long as there is a ref, displaying what the ref claims to be the system in the taxobox is ok, otherwise not. Could just use "Informal"? Peter coxhead (talk) 12:28, 22 March 2026 (UTC)