Template talk:Infobox drug

Latest comment: 1 day ago by YuniToumei in topic Automatic short description

Infobox drug: Changes log
  • 2016-12-08: add ECHA InfoCard from Wikidata P2566 (// with Chembox)
  • 2017-02-14: add licence_CA, improve showing+link of DailyMedID. licence_US link broken at FDA site.
  • 2017-02-16: PubChem (CID) add option 'none'. Shows & categorised (also: CASnr, Chemspider, ATCcode), simplyfy ATC/vet, fix ATC issues, always show PubChem SID, added licenSe_EU, licenSe_CA, general code cleanup
  • 2017-02-16, indexes (2nd identifiers): use unbulleted list not <br />, use /formatX subtemplates, use standard formatting, rename some index params (hard removal)
  • 2017-02-16, tracking categories: track 2nd identifiers & indexes to help maintenance checking (incl. Wikidata), rename and deprecate some, redo the track subtemplate, add default tracking option (when no need for new category)
  • 2017-05-10: add physiological data set (endogenous drugs); parameter metabolites possible in two sections.
  • 2017-05-19: reorder to position of pronunciation in rare situation; metabolism maybe repeated in contexts; add option component #5.
  • 2017-07-20: add new parameter legal_BR, legal_BR_comment with options (Brazil)
  • 2017-08-18: add INN_EMA to allow EMA-licence showing for differently written INN.
  • 2017-08-25: add local INN variants AAN, BAN, JAN, USAN as synonyms; move synonyms into clinical data section.
  • 2017-10-15: add cat 'Drug has EMA link', rm cat 'Drug has EU (EMA) licence'. See EMA talks.
  • 2017-10-21: licence_EU and EMA: improve external link (see also subtemplate)
  • 2018-03-08: adjust TemplatePar error message
  • 2018-03-31: add tracking physiologica data
  • 2018-03-31: add section gene therapy; with 4 parameters; tracking
  • 2018-03-31: add parameter gt_target_gene
  • 2018-04-14: adjust labels in gene therapy (gt_*)
  • 2018-04-18: add links 'edit at WD' to E-number and ECHA chart ID
  • 2018-08-20: vaccine_type: allow free text
  • 2019-04-22: add DTXSID, DTXSID2 for CompTox database el (uses P3117)
  • 2020-07-05: Category:Infobox-drug molecular-weight unexpected-character: +main other

Units for molar mass

edit

Please see discussion at Template talk:Chem molar mass#Non-standard molar mass notation that is about the display of part of the Drugbox. DMacks (talk) 04:07, 3 July 2024 (UTC)Reply

Add a Tmax field

edit

Diff:

<None>
+
Tmax

Hplotter (talk) 13:52, 24 July 2024 (UTC)Reply

  Not done: it's not clear what changes you want to be made. Please mention the specific changes in a "change X to Y" format and provide a reliable source if appropriate. – Jonesey95 (talk) 23:25, 24 July 2024 (UTC)Reply
It is very clear if you know what Tmax stands for Hplotter (talk) 13:14, 25 July 2024 (UTC)Reply
@Hplotter: I agree with Jonesey95—you need to be more explicit (please). —DocWatson42 (talk) 13:03, 27 July 2024 (UTC)Reply
I want to add a field for Tmax values. Hplotter (talk) 13:24, 27 July 2024 (UTC)Reply
In support of adding a field for Tmax values.
@Jonesey95: I believe @Hplotter wants to add a new field under "Pharmacokinetic data," which currently has eight fields/parameters in use.
Under pharmacology (specifically pharmacokinetics), Tmax i.e., peak plasma concentration would be useful as that would provide greater insights into drug efficacy and toxicity. ElectronCompound (talk) 13:16, 24 September 2024 (UTC)Reply
Can something be done about it, please? Hplotter (talk) 13:40, 13 August 2024 (UTC)Reply
Yes: edit {{Infobox drug/sandbox}} to show the changes that you wish to see. – Jonesey95 (talk) 13:32, 24 September 2024 (UTC)Reply
I've made the change but the field does not render, can you fix it please? Hplotter (talk) 16:42, 26 September 2024 (UTC)Reply

Error in US "Rx-only"

edit

Greetings and felicitations. In the article "Chlorpromazine"'s "Legal status" section, the warning and its reference, and the "Rx-only" run together like so: "US: WARNING[2]℞-only". I don't know enough template markup to specify what the fix it, but there should be space after the superscripted reference. —DocWatson42 (talk) 13:13, 27 July 2024 (UTC)Reply

Change image and image2 default background to white.

edit

Dark layout makes the SVG-images look ugly and non-readable. -- 0dorkmann (talk) 10:40, 29 July 2024 (UTC)Reply

Template-protected edit request on 12 August 2024

edit

Hello, I have moved two pages about the German "Betäubungsmittelgesetz" to use the law's English title "Narcotic Drugs Act" (per WP:UE). Template:Infobox drug/legal status points to Drugs controlled by the German Betäubungsmittelgesetz which is now a redirect to Drugs controlled by the German Narcotic Drugs Act. Can you please update the link to skip the redirect? Thank you! Ich (talk) 12:12, 12 August 2024 (UTC)Reply

  Done   ~ Tom.Reding (talkdgaf)  12:53, 12 August 2024 (UTC)Reply

Chemical structure images are poorly visible in dark mode

edit

Hello,

As Aminabzz pointed out at the Teahouse and 0dorkmann mentioned above, pages that use this infobox to show a chemical structure do not work well in dark mode. The SVG files used to represent the structures use dark lines, which become almost invisible on the black background of dark mode. Using ranitidine as an example, this is what its infobox looks like in dark mode.

As it turns out, there are MediaWiki recommendations for handling this issue: specifically, to apply the skin-invert or skin-invert-image classes to elements wrapping the image. This applies a CSS invert filter to the image, making it readable in dark mode.

Using my browser's dev tools, I tested applying the skin-invert-image class to a span element wrapping the image for ranitidine. The result looks like this, which I think is pretty good - the lines turn white and the structure is readable.

However, I don't think the solution is as easy as indiscriminately adding a skin-invert-image wrapper to all the image fields in this infobox. For example, this is what happens if I do the same thing for the image of the 3D structure of ranitidine; much of the color contrast in the picture is lost.

So, I figured I'd post this here to see what thoughts people have. I suppose indiscriminately forcing a white background for any images within this infobox would technically solve the problem, but may not be the most aesthetically pleasing approach. Another option might be to add a parameter to the template specifying that the image should be wrapped in an element with the skin-invert-image class, but that would require modifying all the pages displaying chemical structures with this infobox to use that parameter. nmaeltalk 18:49, 13 August 2024 (UTC)Reply

Is there a <span>...</span> or <div>...</div> trick for forcing a white background? DMacks (talk) 04:25, 14 August 2024 (UTC)Reply
There is. If I modify the span wrapping ranitidine's chemical structure to <span style="display:block; background-color:#FFFFFF;" ...> in dev tools it creates this result, which looks legible.
However, we'd probably have to force the white background on all images in this template if we want to avoid adding a new template parameter specifying when to add the white background (and therefore having to change all the pages using this infobox with a chemical structure) - same problem as if we were to use the skin-invert-image tag. When I apply the span above forcing a white background on both images in the ranitidine infobox, this is the result. It's more tolerable than what happens when indiscriminately applying the skin-invert-image tag, but it does add a lot of white to a page that's supposed to be in dark mode.
Also worth noting: applying the above change with the span tag would also make the infobox look like this in light mode; it's subtle, but since the infobox background isn't #FFFFFF you can see white boxes surrounding the images which looks off. This could theoretically be avoided by using Mediawiki's night mode selectors/media queries so that the white background is only added in night mode. I believe this would require us to use the TemplateStyles feature to create a stylesheet for this infobox. nmaeltalk 15:07, 14 August 2024 (UTC)Reply
Forcing "night" readers to see the infobox in "day" appearance, which makes the images legible, seems like a good quick solution. The images were clearly designed for viewing against a white or light background, so the only a down-side to making the box display them that way is that it isn't the "night mode" way. But that's better than "not really visible at all". Insead of #FFFFFF, we could use whatever slight-gray background is used in day-mode. DMacks (talk) 21:27, 14 August 2024 (UTC)Reply
Forcing a white background technically works, but it defeats the purpose of dark mode. The goal would be to apply the skin-invert-image class if the image is a line drawing. I, at least, can't think of any methods that would do this gracefully. It may be sufficient to sort by file type (invert SVG files), but that might be limiting and wouldn't catch somewhat common exceptions like when PNGs are used for line drawings. Maybe it is okay to apply the tag to the image parameter and not the image2 parameter, as it seems that the preferred style for these infoboxes is to put the line drawing in the image parameter and a ball-and-stick model in the image2 parameter. ― Synpath 21:25, 19 August 2024 (UTC)Reply
Although usually the image parameter is used for chemical structures, there are several pages where a photo of something is used instead; e.g.: Polio vaccine, Laudanum, & BCG vaccine. These look very odd when skin-invert-image is applied to them. I suppose we could add a new parameter (like dark_mode_invert_image=yes) that allows editors to apply skin-invert-image on a case-by-case basis; this would then require painfully updating all the pages showing chemical structures with the template (maybe could be automated to some extent), but at least would keep things the way they are on pages that haven't been fixed yet. nmaeltalk 21:23, 20 August 2024 (UTC)Reply
Edit: I'm a JWB novice, but it looks like if I set it up to do a regex replacement with (\|\s*image\s*=.*\.svg) as the regex and $1 | dark_mode_invert_image = yes as the replacement string it will add the new parameter to the template only on pages where the image parameter references an SVG file. nmaeltalk 22:13, 20 August 2024 (UTC)Reply
I like the idea and tried figuring out a regex expression that could do this without hitting off-target templates (like the image parameter of {{Annotated image 4}} at MDMA), but couldn't come up with anything. I'm not too familiar with regex techniques mind you. I was hoping to find a way to be able to match something like \{\{[^\n]*drugbox(.*?)\}\} (or any variant that finds the template) and then search within that match for something like: \|\s*image\s*=.*\.svg. The issue is the nested curly braces within the infobox (citations for example) interfere with non-greedy matching (greedy matching hits outside the intended template). I wonder if there is a solution.
I'm also souring on applying the dark-mode compatibility onto the image parameter as switching examples like those you brought up to image2 (the simplest edit) might end up being a ton of work anyways (I couldn't figure out a search to quantify this properly). It also introduces non-intuitive behaviour to a non-descriptive parameter making the template harder to use. ― Synpath 05:22, 22 August 2024 (UTC)Reply

Automatic short description

edit

Hi there! Would it be possible to implement automatically generated short descriptions for this template, similarly to Template:Chembox? I would suggest something along the lines of {{main other|{{short description|Pharmaceutical compound|noreplace}}}}. Cheers! YuniToumei (talk) 21:42, 23 November 2024 (UTC)Reply