Jump to content

Template:MedTemplate: Difference between revisions

From Pharmacopedia
No edit summary
some restructuring
Line 5: Line 5:
{{#if:{{{brand|}}}|<tr><th style="text-align:left; width:9em;">Brand name(s)</th><td>{{{brand}}}</td></tr>}}
{{#if:{{{brand|}}}|<tr><th style="text-align:left; width:9em;">Brand name(s)</th><td>{{{brand}}}</td></tr>}}
{{#if:{{{class|}}}|<tr><th style="text-align:left;">Class</th><td>{{{class}}}</td></tr>}}
{{#if:{{{class|}}}|<tr><th style="text-align:left;">Class</th><td>{{{class}}}</td></tr>}}
{{#if:{{{mechanism|}}}|<tr><th style="text-align:left;">Purported mechanism(s)</th><td>{{{mechanism}}}</td></tr>}}
{{#if:{{{mechanism|}}}|<tr><th style="text-align:left;">Mechanism</th><td>{{{mechanism}}}</td></tr>}}
{{#if:{{{uses|}}}|<tr><th style="text-align:left;">Common uses</th><td>{{{uses}}}</td></tr>}}
{{#if:{{{uses|}}}|<tr><th style="text-align:left;">Common uses</th><td>{{{uses}}}</td></tr>}}
<tr><th colspan="2" style="background:#16a34a; color:#fff; padding:0.4em; text-align:left;">Chemistry</th></tr>
<tr><th colspan="2" style="background:#16a34a; color:#fff; padding:0.4em; text-align:left;">Chemistry</th></tr>
{{#if:{{{formula|}}}|<tr><th style="text-align:left;">Formula</th><td>{{{formula}}}</td></tr>}}
{{#if:{{{formula|}}}|<tr><th style="text-align:left;">Formula</th><td>{{{formula}}}</td></tr>}}
{{#if:{{{mass|}}}|<tr><th style="text-align:left;">Molar mass</th><td>{{{mass}}}</td></tr>}}
{{#if:{{{cas|}}}|<tr><th style="text-align:left;">CAS number</th><td>{{{cas}}}</td></tr>}}
{{#if:{{{atc|}}}|<tr><th style="text-align:left;">ATC code</th><td>{{{atc}}}</td></tr>}}
<tr><th colspan="2" style="background:#7c3aed; color:#fff; padding:0.4em; text-align:left;">Pharmacology</th></tr>
<tr><th colspan="2" style="background:#7c3aed; color:#fff; padding:0.4em; text-align:left;">Pharmacology</th></tr>
{{#if:{{{routes|}}}|<tr><th style="text-align:left;">Routes</th><td>{{{routes}}}</td></tr>}}
{{#if:{{{routes|}}}|<tr><th style="text-align:left;">Routes</th><td>{{{routes}}}</td></tr>}}
Line 20: Line 17:
{{#if:{{{pregnancy|}}}|<tr><th style="text-align:left;">Pregnancy</th><td>{{{pregnancy}}}</td></tr>}}
{{#if:{{{pregnancy|}}}|<tr><th style="text-align:left;">Pregnancy</th><td>{{{pregnancy}}}</td></tr>}}
{{#if:{{{legal|}}}|<tr><th style="text-align:left;">Legal status</th><td>{{{legal}}}</td></tr>}}
{{#if:{{{legal|}}}|<tr><th style="text-align:left;">Legal status</th><td>{{{legal}}}</td></tr>}}
</table>{{#if:{{{intro|}}}|
</table>{{#set:
| Has generic name    = {{{generic|}}}
| Has brand name      = {{{brand|}}}
| Has class          = {{{class|}}}
| Has mechanism      = {{{mechanism|}}}
| Has formula        = {{{formula|}}}
| Has route          = {{{routes|}}}
| Has onset          = {{{onset|}}}
| Has duration        = {{{duration|}}}
| Has half-life      = {{{halflife|}}}
| Has bioavailability = {{{bioavailability|}}}
| Has pregnancy class = {{{pregnancy|}}}
| Has legal status    = {{{legal|}}}
}}{{#if:{{{intro|}}}|
{{{intro}}}
{{{intro}}}
}}{{#if:{{{pharmacology|}}}|<h2 id="Pharmacology">Pharmacology</h2>
}}{{#if:{{{pharmacokinetics|}}}|<h2 id="Pharmacokinetics">Pharmacokinetics</h2>
{{{pharmacology}}}}}{{#if:{{{pharmacokinetics|}}}|<h2 id="Pharmacokinetics">Pharmacokinetics</h2>
{{{pharmacokinetics}}}}}{{#if:{{{pharmacodynamics|}}}|<h2 id="Pharmacodynamics">Pharmacodynamics</h2>
{{{pharmacokinetics}}}}}{{#if:{{{indications|}}}|<h2 id="Indications">Indications</h2>
{{{pharmacodynamics}}}}}{{#if:{{{indications|}}}|<h2 id="Indications">Indications</h2>
{{{indications}}}}}{{#if:{{{dosing|}}}|<h2 id="Dosing">Dosing and titration</h2>
{{{indications}}}}}{{#if:{{{dosing|}}}|<h2 id="Dosing">Dosing and titration</h2>
{{{dosing}}}}}{{#if:{{{effects|}}}|<h2 id="Effects">Effects</h2>
{{{dosing}}}}}{{#if:{{{effects|}}}|<h2 id="Effects">Effects</h2>
Line 38: Line 48:
{{{anecdotes}}}}}{{#if:{{{seealso|}}}|<h2 id="SeeAlso">See also</h2>
{{{anecdotes}}}}}{{#if:{{{seealso|}}}|<h2 id="SeeAlso">See also</h2>
{{{seealso}}}}}{{#if:{{{references|}}}|<h2 id="References">References</h2>
{{{seealso}}}}}{{#if:{{{references|}}}|<h2 id="References">References</h2>
{{{references}}}}}[[Category:Medications]]</includeonly><noinclude>
{{{references}}}}}[[Category:Medicines]]</includeonly><noinclude>
Usage docs and TemplateData go here — keep what you already have, or copy the TemplateData block from the earlier message if you want VisualEditor integration.
 
[[Category:Templates]]
</noinclude>
<noinclude>
== Usage ==
== Usage ==
<pre>
<pre>
Line 54: Line 59:
| uses              =  
| uses              =  
| formula          =  
| formula          =  
| mass              =
| cas              =
| atc              =
| routes            =  
| routes            =  
| onset            =  
| onset            =  
Line 65: Line 67:
| legal            =  
| legal            =  
| intro            =  
| intro            =  
| pharmacology      =
| pharmacokinetics  =  
| pharmacokinetics  =  
| pharmacodynamics  =
| indications      =  
| indications      =  
| dosing            =  
| dosing            =  
Line 81: Line 83:
}}
}}
</pre>
</pre>
Three groups of fields:
* '''Infobox (right column)''': short, label-style values — name, brand, class, formula, half-life, etc.
* '''Body sections''': prose; renders as full-width <code>== Section ==</code> headings only when filled.
* '''Auto-omitted''' rows/sections: any empty parameter is skipped (no empty boxes or stray headings).


<templatedata>
<templatedata>
{
{
   "description": "Full page template for a medicine entry. Renders a tri-section infobox (Summary / Chemistry / Pharmacology) plus auto-suppressed body sections.",
   "description": "Full page template for a medicine entry. Tri-section infobox (Summary / Chemistry / Pharmacology) plus auto-suppressed body sections.",
   "params": {
   "params": {
     "generic":          { "label": "Generic name(s)",  "description": "Comma-separated. Defaults to page name.", "type": "string" },
     "generic":          { "label": "Generic name(s)",  "type": "string" },
     "brand":            { "label": "Brand name(s)",    "type": "string" },
     "brand":            { "label": "Brand name(s)",    "type": "string" },
     "structure":        { "label": "Structure image",  "description": "Filename only, no 'File:' prefix.", "type": "wiki-file-name" },
     "structure":        { "label": "Structure image",  "description": "Filename only, no 'File:' prefix.", "type": "wiki-file-name" },
     "structuresize":    { "label": "Structure size",    "description": "Defaults to 240px.", "type": "string", "default": "240px" },
     "structuresize":    { "label": "Structure size",    "type": "string", "default": "240px" },
     "class":            { "label": "Class",            "description": "Pharmacological class, e.g. SSRI.", "type": "string" },
     "class":            { "label": "Class",            "type": "string" },
     "mechanism":        { "label": "Purported Mechanism(s) (1 line)","description": "One-line summary for infobox; expand in 'Pharmacology' body section.", "type": "string" },
     "mechanism":        { "label": "Mechanism (1 line)","description": "Expand in 'Pharmacodynamics' body section.", "type": "string" },
     "uses":              { "label": "Common uses",      "type": "string" },
     "uses":              { "label": "Common uses",      "type": "string" },
     "formula":          { "label": "Chemical formula",  "type": "string" },
     "formula":          { "label": "Chemical formula",  "type": "string" },
    "mass":              { "label": "Molar mass",        "type": "string" },
     "routes":            { "label": "Routes",           "type": "string" },
    "cas":              { "label": "CAS number",        "type": "string" },
    "atc":              { "label": "ATC code",          "type": "string" },
     "routes":            { "label": "Routes of administration", "type": "string" },
     "onset":            { "label": "Onset",            "type": "string" },
     "onset":            { "label": "Onset",            "type": "string" },
     "duration":          { "label": "Duration",          "type": "string" },
     "duration":          { "label": "Duration",          "type": "string" },
     "halflife":          { "label": "Half-life",        "type": "string" },
     "halflife":          { "label": "Half-life",        "type": "string" },
     "bioavailability":  { "label": "Bioavailability",  "type": "string" },
     "bioavailability":  { "label": "Bioavailability",  "type": "string" },
     "pregnancy":        { "label": "Pregnancy (short)", "description": "Short tag for infobox, e.g. 'Category C'. Detailed prose goes in 'pregnancy_details'.", "type": "string" },
     "pregnancy":        { "label": "Pregnancy (short)", "type": "string" },
     "legal":            { "label": "Legal status",      "description": "e.g. 'Rx-only', 'Schedule IV'.", "type": "string" },
     "legal":            { "label": "Legal status",      "type": "string" },
     "intro":            { "label": "Intro paragraph",  "description": "Free wikitext above the first heading.", "type": "content" },
     "intro":            { "label": "Intro paragraph",  "type": "content" },
    "pharmacology":      { "label": "Pharmacology",      "type": "content" },
     "pharmacokinetics":  { "label": "Pharmacokinetics",  "description": "ADME — absorption, distribution, metabolism, excretion.", "type": "content" },
     "pharmacokinetics":  { "label": "Pharmacokinetics",  "description": "ADME — absorption, distribution, metabolism, excretion.", "type": "content" },
     "indications":      { "label": "Indications",     "type": "content" },
    "pharmacodynamics":  { "label": "Pharmacodynamics",  "description": "Mechanism of action, receptor binding, downstream effects.", "type": "content" },
     "dosing":            { "label": "Dosing and titration", "type": "content" },
     "indications":      { "label": "Indications",       "type": "content" },
     "effects":          { "label": "Effects",          "description": "Therapeutic + common adverse effects.", "type": "content" },
     "dosing":            { "label": "Dosing & titration","type": "content" },
     "adverse":          { "label": "Adverse effects",  "description": "Serious / less common adverse effects, warnings.", "type": "content" },
     "effects":          { "label": "Effects",          "type": "content" },
     "adverse":          { "label": "Adverse effects",  "type": "content" },
     "contraindications": { "label": "Contraindications", "type": "content" },
     "contraindications": { "label": "Contraindications", "type": "content" },
     "interactions":      { "label": "Interactions",      "description": "Medicine-medicine, medicine-food, etc.", "type": "content" },
     "interactions":      { "label": "Interactions",      "type": "content" },
     "pregnancy_details": { "label": "Pregnancy & lactation (body section)", "type": "content" },
     "pregnancy_details": { "label": "Pregnancy & lactation (body)", "type": "content" },
     "monitoring":        { "label": "Monitoring",        "description": "Labs, vitals, or signs to watch.", "type": "content" },
     "monitoring":        { "label": "Monitoring",        "type": "content" },
     "counseling":        { "label": "Patient counseling","type": "content" },
     "counseling":        { "label": "Patient counseling","type": "content" },
     "anecdotes":        { "label": "Personal experience", "type": "content" },
     "anecdotes":        { "label": "Personal experience", "type": "content" },
Line 126: Line 119:
     "references":        { "label": "References",        "type": "content" }
     "references":        { "label": "References",        "type": "content" }
   },
   },
  "paramOrder": [
    "generic", "brand", "structure", "structuresize",
    "class", "mechanism", "uses",
    "formula", "mass", "cas", "atc",
    "routes", "onset", "duration", "halflife", "bioavailability", "pregnancy", "legal",
    "intro", "pharmacology", "pharmacokinetics", "indications", "dosing",
    "effects", "adverse", "contraindications", "interactions",
    "pregnancy_details", "monitoring", "counseling", "anecdotes",
    "seealso", "references"
  ],
   "format": "block"
   "format": "block"
}
}

Revision as of 05:05, 11 May 2026

Usage

{{MedTemplate
| generic           = 
| brand             = 
| structure         = 
| class             = 
| mechanism         = 
| uses              = 
| formula           = 
| routes            = 
| onset             = 
| duration          = 
| halflife          = 
| bioavailability   = 
| pregnancy         = 
| legal             = 
| intro             = 
| pharmacokinetics  = 
| pharmacodynamics  = 
| indications       = 
| dosing            = 
| effects           = 
| adverse           = 
| contraindications = 
| interactions      = 
| pregnancy_details = 
| monitoring        = 
| counseling        = 
| anecdotes         = 
| seealso           = 
| references        = 
}}

Full page template for a medicine entry. Tri-section infobox (Summary / Chemistry / Pharmacology) plus auto-suppressed body sections.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Generic name(s)generic

no description

Stringoptional
Brand name(s)brand

no description

Stringoptional
Structure imagestructure

Filename only, no 'File:' prefix.

Fileoptional
Structure sizestructuresize

no description

Default
240px
Stringoptional
Classclass

no description

Stringoptional
Mechanism (1 line)mechanism

Expand in 'Pharmacodynamics' body section.

Stringoptional
Common usesuses

no description

Stringoptional
Chemical formulaformula

no description

Stringoptional
Routesroutes

no description

Stringoptional
Onsetonset

no description

Stringoptional
Durationduration

no description

Stringoptional
Half-lifehalflife

no description

Stringoptional
Bioavailabilitybioavailability

no description

Stringoptional
Pregnancy (short)pregnancy

no description

Stringoptional
Legal statuslegal

no description

Stringoptional
Intro paragraphintro

no description

Contentoptional
Pharmacokineticspharmacokinetics

ADME — absorption, distribution, metabolism, excretion.

Contentoptional
Pharmacodynamicspharmacodynamics

Mechanism of action, receptor binding, downstream effects.

Contentoptional
Indicationsindications

no description

Contentoptional
Dosing & titrationdosing

no description

Contentoptional
Effectseffects

no description

Contentoptional
Adverse effectsadverse

no description

Contentoptional
Contraindicationscontraindications

no description

Contentoptional
Interactionsinteractions

no description

Contentoptional
Pregnancy & lactation (body)pregnancy_details

no description

Contentoptional
Monitoringmonitoring

no description

Contentoptional
Patient counselingcounseling

no description

Contentoptional
Personal experienceanecdotes

no description

Contentoptional
See alsoseealso

no description

Contentoptional
Referencesreferences

no description

Contentoptional