Template talk:Infobox drug/Archive 2

Automated filling of drugboxes
Hi there! I've just created a tool for automating the process of filling out the drugbox template. Given a DataBank accession number (eg, APRD00109 for indomethacin), it pulls a DataBank card and produces a filled-out drugbox template. Try it out at http://diberri.dyndns.org/wikipedia/templates/?type=dbid. Cheers, David Iberri (talk) 17:06, 15 June 2006 (UTC)

Gosh - Brilliant stuff - well done ! Some quick thoughts:
 * Your tool is also automatically pulling out melting points & smiles, are they really necessary for the majority of drugs (useful where physical properties or synthesis details interesting in their own right eg aspirin, or chloroform) as I initially imaged these optional fields would only rarely be useful to the majority of readers - but thats just my own penny's worth view :-)
 * You used the chemical formula option, but a recent alternative was element definition added by user BorisTM. Is this either easer or better ? (I like the look, but am undecided whether this is necessarily easier in all cases)
 * Your tool produces a result on a single line, obvious advantage is more compact, would display on separate lines be easier for others to follow ? (I weakly prefer compactness to more expansive display). David Ruben Talk 18:32, 15 June 2006 (UTC)
 * Thanks! Let me see if I can reply to each of your points:
 * You're right -- not all fields are relevant to all drugs. I just assumed folks would remove the unnecessary ones manually. I suppose I could add a "minimal fields" option that would remove them automatically, but I don't like the arbitrary definition of "minimal".
 * How about "Standard" (vs "Extended"), given these other ones only existed in the last week since I added them ? David Ruben Talk 22:56, 15 June 2006 (UTC)
 * Element definition wouldn't be difficult to implement, but I can't think of a good reason to prefer it over specifying the formula longhand. The only advantage I can think of is that element definition avoids the &lt;sub&gt;s.
 * There's an option to "fill template vertically" that puts each parameter on its own line. Does that do the trick?
 * Cheers, David Iberri (talk) 22:41, 15 June 2006 (UTC)
 * Oh what an idiot I am - of course - yes, thanks. For drugbox only, could vertical be the default option ? :-) David Ruben Talk 22:56, 15 June 2006 (UTC)


 * This is wonderful - thank you so much for building this. One bit of feedback: I just tried it with Streptomycin and noticed that the ATC code(s) aren't populated (found at the bottom of the "Drug Category" field on the Drugbank page for Streptomycin). --Arcadian 11:54, 16 June 2006 (UTC)
 * I made the dumb assumption that because none of my test cases (eg indomethacin's) had complete ATC codes then no DrugBank card would have a complete ATC code. Thanks for telling me otherwise. What I've done is when ATC codes are complete (ie, 7 characters long), I've included them in the template; otherwise, I've left them out. Sound about right? --David Iberri (talk) 15:53, 16 June 2006 (UTC)
 * I just tried it at Aminosalicylic acid, and it worked great! --Arcadian 16:16, 16 June 2006 (UTC)
 * Also, for fields like "pregnancy_category", which appear by default even when unpopulated but aren't populated from DrugBank, I'd recommend including the field in the output, so that it is easier to fill in the field manually later. --Arcadian 12:02, 16 June 2006 (UTC)
 * Presently you can display all fields by checking the "display all template fields" box. As a more long-term solution, I'll be implementing the standard/extended fields idea that David mentioned above. --David Iberri (talk) 15:53, 16 June 2006 (UTC)
 * These standard/extended fields are now implemented with the addition of the "show extended fields" checkbox. --David Iberri (talk) 01:41, 17 June 2006 (UTC)
 * Thanks - can smiles and melting_point also be switched to extended only. Also "APRD00248" for amoxicillin seems to cause it to error: David Ruben Talk 01:54, 17 June 2006 (UTC)
 * (Error message snipped) Thanks for the error report -- seems DrugBank's strict XHTML wasn't so strict after all. Should be fixed now that I've added some extra filtering. Also, "smiles" and "melting_point" are now shown only if you tick the "show extended fields" checkbox. Cheers, David Iberri (talk) 05:05, 17 June 2006 (UTC)

The names
Guys don't forget to check how the names look in Firefox or Netscape - they don't cut the long words the way Opera and Explorer do. -- Boris 01:21, 17 June 2006 (UTC)


 * Can you give general method of splitting to assist for those browsers (I've just got Internet Explorer which my machine just about copes with - any other software will completely seize me) - I can't compare appearances - next computer will I'm sure with suitable attached go-faster stripes :-) David Ruben Talk 01:40, 17 June 2006 (UTC)

(line break) tags pretty empirically. I try to keep related chemical terms together and end lines at hyphens where possible (cf. irbesartan). Hope that helps. -Techelf 08:29, 20 June 2006 (UTC)
 * I've had to manually add

SVG preferred
I suggest you make SVG the preferred image type. SVG is the preferred image type on wikipedia for diagrams Nil Einne 21:51, 19 June 2006 (UTC)
 * Preferred, but the implementation still seems to be quite buggy – last time I tried uploading an SVG image that I'd made in Illustrator, I had to juggle the settings repeatedly until I gave up and just used PNG. Also, most people don't have access to software that can export in SVG format. But if you have any advice on easily getting SVG structures drawn with ChemDraw (and exported via Illustrator), it'd be much appreciated. -Techelf 07:50, 20 June 2006 (UTC)

Image
Just a little reminder to all users, it's image NOT Image. Since image defaults to .png, I spent ages trying to work out why my update wasn't working. Trouble is it was Image (I didn't actually insert it, I just modified an existing tag) therefore my tag had no effect! Nil Einne 21:51, 19 June 2006 (UTC)

Changes to the template
People, if you want to test for how any new change is going to affect this template, or any template in general, use Add code to do so (i don't use that template for anything but for test grounds or "template sand-box" if you want to call it) - just replace its current code with the code for Drugbox and check the changes in the "Add code" talk page by calling the template there. It would be a good idea that after saving a change to write "Testing" in the "Edit summary" and after you done with using the template to write "Done", so by checking the edit history those who want to use the template will know if they can use it or they have to wait. Don't make numerous little changes here because this template is being used by many and its going to be used by even more articles, and any change however little it is puts presure on the serveres (recashing, etc) - the bigger the number of the articles that use the template the higher the presure. -- Boris 02:06, 21 June 2006 (UTC)
 * I'm probably one of the culprits, so thanks for pointing out the Add_code template. Cheers. -Techelf 10:18, 21 June 2006 (UTC)

Table and image widths
Table's 280px, image's used to be 250px but Arcadian dropped it down to 220px. Why? What's the good of having smaller images and all that white space around them? -- Boris 23:37, 22 June 2006 (UTC)
 * To get closer to Wikipedia standards. For example, Template:Album infobox, Template:Infobox Book both default to 200px. I wouldn't object to making the table smaller, though. --Arcadian 02:21, 23 June 2006 (UTC)

I would definately object making the table of drugbox smaller. -- Boris 05:21, 24 June 2006 (UTC)
 * A standart!?! Template:Album infobox sets 200px as default, Template:Infobox Book sets none, Template:Drugbox - 220px. What kind of wiki standart is that? And i don't think there is a "standart width" of the infobox image at all. Arcadian, if there is any "cross-infobox" standart that is the principles by which the templates work. The use of parser functions or standart wiki styles - is not mandatory, they just set a flexible frame for the different infobox templates, as soon as we try to make that frame rigid, say - standart image widht, the same style rules or whatever, then we got a problem because not everything will fit in that frame - the different infoboxes provide different information, and if one setup looks well for one infobox it won't look that well for a different one. I bet you know all that.

New fields
I think I've now got most of the articles converted to the new template, at least for the drugs that have an ATC code. I've noticed that a lot of pages had ad-hoc rows added to the old manual template for indications, contraindications, and side-effects. Does anybody have an objection if I add optional fields to accomodate this information? (Currently, I've just sequestered this data into its own dedicated box, but in many cases that looks sloppy and inconsistent.) Other fields that might be useful could be "brand_name", "year_of_first_synthesis", "year_of_introduction", "medlineplus", "diseasesdb". Any thoughts? --Arcadian 14:39, 25 June 2006 (UTC)
 * I think that the drugbox should only contain concise data, and that content requiring further discussion (e.g. indications, contraindications, adverse effects) should go in the main text only. If we add too many things to the drugbox, it just becomes too long and unwieldy – it's already getting quite lengthy as it is. -Techelf 11:12, 27 June 2006 (UTC)


 * I generally concur with Techelf and feel side-effects. contraindications, years and disease links have no place in this infobox. I raise 3 points - please do add indented comments to each of these :-)
 * An abbreviated 'Indications' field after the 'Routes' would not be unreasonable
 * Similar for the purposes of classifing the drug, how about a 'Drug Class' field which would be used to specify the drug as a gluticorticoid, chemotherapy, antibiotic etc ?
 * As for length of the cuirrent template, can we save one line with the drug's name? The 'Systematic name' section only currently contains the 'IUPAC name' which occupies its own separate line. Would it not be simpler to merge this into the section title as 'Systematic IUPAC name' ? David Ruben Talk 22:47, 30 June 2006 (UTC)


 * I agree with merging "systematic name" and "IUPAC name" into a single line, but I propose that we use the label "IUPAC name" or "systematic name" (either of which would link to IUPAC name) instead of "systematic IUPAC name". All IUPAC names are systematic, thus "systematic IUPAC name" is redundant. --David Iberri (talk) 03:40, 1 July 2006 (UTC)

How about systematic (IUPAC) name? Copperman 14:01, 2 July 2006 (UTC)
 * Ooh, I think I like that. --David Iberri (talk) 22:34, 3 July 2006 (UTC)
 * Concur - and so changed :-) David Ruben Talk 23:23, 3 July 2006 (UTC)

Testing for image existance
I tried in last couple days to test whether image exists, as currently a red link is shown if it does not. I've reverted back and copied the code across to the template sandbox Template:Add code and displayed, as examples, the chloramphenicol & cyclophosphamide in the sandbox's talk page Template talk:Add code which shows that for some pages only image2 is shown. Nor does it seem to be exclusively whether the 1st image is derived from an explicit definition (image=X.png) or as a default (PAGENAME.png). I also seem to have a variable response on trying to locate images within wikipedia (typing Image:xxx into the search box) with some images being jumped to directly, and for others a search result page is shown indicating a single entry that I must then select as a two-part process - is this a related issue ?

I copy from my talk page a thread about this:


 * Hi David, you made some changes today to the drugbox template - getting rid of the red link if no image exists. This is great, but it has had the effect that some pages employing the use of the drugbox (e.g. aspirin) only show image2 and not image. Can you fix it? Cheers Ben 15:43, 12 July 2006 (UTC).


 * So it does - however I had used amoxycillin as my test page for 2 images and that works - will look into this further.David Ruben Talk 16:04, 12 July 2006 (UTC)


 * Ah Image.Aspirin-skeletal.svg does not exist, which explains why only the image2 is shown ! So not problem of the template but of image name chosen, phew :-) Now whatever happened to aspirin's line drawing ? I'll trawl back through the aspirin article's history... David Ruben Talk 16:07, 12 July 2006 (UTC)


 * Image:Aspirin-skeletal.svg exists! The same problem occurs at many drug pages (although not all - see cyclophosphamide for one not affected  - I just checked chloramphenicol and there's a problem there.
 * Sorry if I've wrongly accused you! I just noticed this problem this afternoon.  I thought you'd like to know either way. Ben 16:16, 12 July 2006 (UTC).


 * So it does (drats) - funny using the search box on each page acts differently for different images. For Image:Aspirin-skeletal.svg it fails to launch into the page, but offers a link to jump to it. Whereas searching for Image:Amoxicillin.png jumps directly there. Could you have a look at pages you tested to see if this is a problem with .svg files rather than .png ? David Ruben Talk 16:23, 12 July 2006 (UTC)


 * I've just had a look at chloramphenicol. Its first image is a PNG, so it doesn't seem that the SVG format is the root of the problem.  Ben 16:44, 12 July 2006 (UTC).

So can anyone advise on my coding error at Template:Add code ? David Ruben Talk 17:01, 12 July 2006 (UTC)


 * The image that doesn't show up is on commons - of what i was able to grasp so far (i might be wrong thou) you can't use "ifexist" to check for that because the page actually does not exist on en.wiki, instead you have to use exists, according to the parser functions guide. I tried to find a solution in the small time span that i had before going to bed but i'm tired and i need to get flat. -- Boris 02:30, 13 July 2006 (UTC)

Colorized element symbols in formula
Is this really a good idea? Having colorized letters in a line of text is kind of distracting. It's especially bad that N is the same color as a hyperlink or wikilink and O is the same color as a dead wikilink. The only use I can see is to provide a color legend for the structural images, but from what I've seen, not many images used in the drugbox are colorized at all. DMacks 16:11, 28 July 2006 (UTC)

It is almost impossible to see a trailing S(ulphur) because its color is so similar to the default background. I strongly object to this discrimination against the visually impaired and the colorblind. Please replace the colors with tints, instead. James S. 21:58, 7 April 2007 (UTC)

To this end, I have divided all the RGB values by two. James S. 22:46, 7 April 2007 (UTC)

Abbreviations
Would it be OK to expand Mol. to Molecular and cat to category? Seems like they will both fit without wrapping. Rich Farmbrough 15:12 7 August 2006 (GMT).

"Formula" field
There seems to be a problem with the "Formula" field, the output is breaking awkwardly (see pancuronium, glibenclamide and paracetamol for examples). I have accessed several pages which use the extended form (ie, | C = | H = | N = etc.) on both Firefox and IE and they look the same. Fvasconcellos 21:26, 8 August 2006 (UTC)
 * Yeah I've also noticed a problem in Firefox and Safari, seemingly with the display of the oxygen character. -Techelf 09:59, 9 August 2006 (UTC)
 * Might be a stretch, but could it have something to do with this recent change to Template:OrganicBox atom? This could simply be ignorance on my part, as I know less than nothing about template syntax, but the time frame fits. Fvasconcellos 00:36, 10 August 2006 (UTC)
 * Could not see why interwiki link within noinclude tags should - and on quick test made no difference. Clearly something has changed - also seems not to do with oxygen, but new lines after nitrogen.David Ruben Talk 02:17, 10 August 2006 (UTC)
 * Seems fixed now. Maybe this did the trick? Fvasconcellos 23:00, 10 August 2006 (UTC)

Image optional
Could someone make the image optional, so there is no ugly red link at every newly created drug article?? I am not sure how to do this... --WS 15:30, 2 September 2006 (UTC)


 * Yes 1 tried misserably to do this previously, and User:BorisTM had a valient go too (see User talk:BorisTM and this attempt). The problem lies with the parse parameters, for which there are two, to look for existance of an article (in this case we presume an image). However images may both be in english wikipedia image space and commons wiki and each parse parameter behaves differently for the two spaces. This might not be a problem if only a specified image name were being searched for, however the template allows for the imagename not to have been specified at all, in which case a default of PAGENAME.png is to be used.
 * So that's 2 possible sets of names (specified by parameter or else default name) to be tested across engish and commons wikis - we ended up being able to test for existance in any single part of this 4-way test, but not all simultaneously. Canone care to have a further go, see Template:Add code sandbox area. David Ruben Talk 16:21, 2 September 2006 (UTC)


 * And what if the standard PAGENAME.png would be removed? So that people will be required to explicitly specify an image name? --WS 16:48, 2 September 2006 (UTC)


 * A good idea if we were introducing this template afresh. However how many articles already rely upon this default for images which do exist - i.e. if we remove the default option, how many drug articles suddenly stop displaying a valid image ? I suspect the testing coding just needs to be done less elegantly, i.e. nested tests with #if and #ifexists, with english and commons, with specified or default names (ie no attempt at image|.png ) - ie 8-levels of testing - ughhh - perhaps when the migraine has settled I'll have another go, but meanwhile anyone care to offer a simpler approach to attempt ? David Ruben Talk 17:07, 2 September 2006 (UTC)


 * A bot could probably be used for the transition, to modify the drug articles which depend on the default image being there ?? --WS 18:26, 2 September 2006 (UTC)


 * Don't personally know much about bots, but if could be done then yes probably simpler. NB caveat: need someone with advanced knowledge of the parseparameters and English/Commons subtleties to guide us here (ie if this really is going to work).
 * It needs identify firstly articles using template:drugbox, select those that have no image parameter defined (either no "image =" with undefined value or no undefined parameter included at all), and then either:
 * Define the image (as { {PAGENAME} }.png) - but kind of messy as implies that such asn image has been uploaded
 * or search to see if a suitable image file can be located and if not then leave in place "image = " ready for the modified drugbox template to then ignore the blank parameter.
 * I would though seek advice of the likes of BorisTM (or anyone else we might know of) as to whether this is really going to work, i.e. confirm that coding really can be made to work for English/Commons testing, if default parameter value issue is eliminated - no point in lots of work if it ain't going to work :-) David Ruben Talk 01:08, 3 September 2006 (UTC)

New Licence field
I propose a new row in the drugbox table for the drug Licence. There are two major licensing authorities that I've found that make drug information easily accessible: The US Food and Drug Administration (FDA) and the European Medicines Agency (EMEA). Some examples:

Levetiracetam (Keppra): FDA EMEA

Trastuzumab (Herceptin): FDA EMEA

Pregabalin (Lyrica): FDA EMEA

Both sites contain a wide variety of information, some of which is very comprehensive. The FDA "Label Information" and the EMEA "Product Information", where available, are very detailed. There is material aimed at the professional and also plain-English consumer information. This is a excellent reliable source for article information but also contains much that makes it a worthwhile "External link" since there is no way you could include all the info. Both sites are kept up-to-date with the latest changes to prescribing/licensing practice.

I have found the EMEA site difficult to navigate using Firefox, though this may be due to my version of Java. It is OK on IE, and the individual drug page works fine on both browsers. Both sites work using of the brand name of the drug but the FDA site also allows searches with the generic name (active ingredient), which lists generic variants where they are licensed.

So I recommend that the parameter for the EMEA site be the brand name and the parameter for the FDA site be the generic name. The template code needs to allow the option for either or both to be missing.

Disadvantages: The EMEA is relatively new but is handling much of the new drug applications in the EU since it is cheaper/quicker than going to each country. The FDA have been around a while but old drugs aren't online. Only relatively new drugs have complete information. Both sites will, of course, improve with time.

BTW: The word "Licence" is the noun in British English, "License" is the verb.

Feedback on this proposal would be very welcome. Colin°Talk 13:38, 7 September 2006 (UTC)


 * I'd support it. Navigation in the FDA website is pretty convoluted, though – I personally found it easier to navigate around the EMEA pages. Fvasconcellos 16:25, 7 September 2006 (UTC)
 * Support. --Arcadian 23:21, 7 September 2006 (UTC)


 * Support - better a link to regulatory authorities than drug campany websites. David Ruben Talk 02:08, 8 September 2006 (UTC)

Ok- I've added licence_EU and licence_US parameters which each take just the search word to be sought - can people just check that this works with items that are not just a single word - i.e. will we need request that editors use underscore in place of any spaces ? David Ruben Talk 02:08, 8 September 2006 (UTC)


 * Before anyone gets too excited and starts applying the new parameters to loads of pages, have a look at how the coding currently formats for Levetiracetam following this edit. If people agree to styling and don't find fault on some testing ("Show Preview") in other articles, then ..... :-) David Ruben Talk 02:35, 8 September 2006 (UTC)


 * Many thanks, David, for implementing this. I realise now that my text was contradicted by my examples: I recommend using the generic name for the FDA search; the brand name is essential for the EMEA link. The only disadvantage to using the generic name is that the FDA info for the original-brand is likely to be much greater than for the generics - and the reader may be confused as to which link in the search results to pick. What do you think?


 * Regarding appearance: I think the word "data" is redundant and should be dropped - all the info in this table is data. I wonder if the RHS might be better with just EU US as the links. The reader can find out who the agencies are either by following the links or your wikilink for Licence. I would imagine that most folk don't recognise what the "EMEA" is. The advantage of country codes is that, should other authorities be found that are relevant, they can be added. It also makes it unnessary to include the codes in parenthesis.


 * Here's a two word link on the FDA site: Acyclovir Sodium. The underscore is needed for the template parameter and works fine. The EMEA site uses brand names so two words are rare. When they do occur, their url is composed of the adjoined words. For example: Infanrix Penta.


 * The easiest way to navigate the EMEA site, and the list of drugs, is from their SiteMap. For ease of reference:


 * EMEA A-F
 * EMEA G-L
 * EMEA M-R
 * EMEA S-Z


 * Colin°Talk 08:46, 8 September 2006 (UTC)

Controlled drug status in legal fields
I've noticed editors adding specific controlled drug categorisations to some drugs eg Phenobarbital, rather than just leaving a 'Px_only' or 'CD'. Given then the need to link these classifications to the relevant article in Wikipedia explaining them, I've added the categorisations to the list of terms recognised by the drugbox template. See new description of recognised terms and the simplification this allows to Phenobartical (compare here) and Heroin (compare here).

Let me know if this needs any adjustment to the formating, or indeed to teh very principle enacted here :-) David Ruben Talk 19:10, 17 September 2006 (UTC)


 * re Canada:I've added legal_CA with link to Controlled Drugs and Substances Act for Schedule I-VIII. If anyone knows of their non-scheduled scheme of classification (i.e. OTC, Pharmacy or normal prescription-only) then let me know and I can add it to the template coding. David Ruben Talk 04:00, 18 September 2006 (UTC)

Superscript formatting
I see the 3 way of superscripting that we've always used just got changed to the unicode "superscripted 3" character. Is unicode the way we want to be doing scientific/mathematical exponent notation now? DMacks 13:02, 21 September 2006 (UTC)
 * Don't assume that bot edits (a) make sense (b) reflect consensus or (c) indicate anything other than the personal tastes of the bot user/author. Call me cynical. Colin°Talk 13:49, 21 September 2006 (UTC)
 * To be fair, you are being very cynical, unicode is by far the most common way of formatting units and is easier to understand for people who are not familiar with html syntax (i.e. most people). I'm sure we all agree having a mixture of different syntaxes is not optimal. Martin 15:26, 21 September 2006 (UTC)
 * If mixing is bad, then given that there are only unicode for superscript-1/2/3, chemistry articles should use the HTMLish form of sup/sub numbering exclusively.


 * Chemical formula || C6H12O4
 * Density || 1.18 g/cm³
 * }
 * looks pretty poor. DMacks 20:44, 21 September 2006 (UTC)
 * The unicode is almost always used for things like cm³, I am just cleaning up the relatively few articles that don't, I should make it clear that I am not converting all possible instances of superscipt to unicode, just things similar to cm³. Martin 08:03, 22 September 2006 (UTC)
 * Also, scanning the database shows that, of the occurances I was changing, the unicode is almost 10 times as as common as the equivalent sup markup (the copy of the database used pre-dates any changes I made). Martin 08:24, 22 September 2006 (UTC)
 * I have no problems with unicode in general, just with the blanket conversion of things like cm3 in articles that are full of and other sup/sub formatting of numbers. Perhaps you're confusing me with the other commenter on the bot's talk page? DMacks 02:17, 25 September 2006 (UTC)
 * OK. To answer the original question: I'm not aware of unicode symbols for superscripts other than 123 (see the symbol list the bottom of the page when you edit an article). The Manual of Style (mathematics) uses the HTML formatting for its symbols and I'm not aware of a change to the MOS in this regard. I'd be happier if bots could quote MOS guidelines in their edit summaries. Colin°Talk 18:56, 21 September 2006 (UTC)¹²³123
 * Also, scanning the database shows that, of the occurances I was changing, the unicode is almost 10 times as as common as the equivalent sup markup (the copy of the database used pre-dates any changes I made). Martin 08:24, 22 September 2006 (UTC)
 * I have no problems with unicode in general, just with the blanket conversion of things like cm3 in articles that are full of and other sup/sub formatting of numbers. Perhaps you're confusing me with the other commenter on the bot's talk page? DMacks 02:17, 25 September 2006 (UTC)
 * OK. To answer the original question: I'm not aware of unicode symbols for superscripts other than 123 (see the symbol list the bottom of the page when you edit an article). The Manual of Style (mathematics) uses the HTML formatting for its symbols and I'm not aware of a change to the MOS in this regard. I'd be happier if bots could quote MOS guidelines in their edit summaries. Colin°Talk 18:56, 21 September 2006 (UTC)¹²³123