Template:AntibioticDose: Difference between revisions

(Created AntibioticDose helper template - single source of truth for drug dosing display + SMW annotation)
 
(Added namespace check - subobjects only created on main namespace pages, not on Template: pages)
Line 2: Line 2:
==AntibioticDose Template==
==AntibioticDose Template==
This template creates a single source of truth for antibiotic dosing on disease pages. It displays the drug name and dose as visible text, and simultaneously creates an SMW subobject linking the antibiotic to the disease.
This template creates a single source of truth for antibiotic dosing on disease pages. It displays the drug name and dose as visible text, and simultaneously creates an SMW subobject linking the antibiotic to the disease.
The SMW subobject is '''only''' created when the template is used on a main namespace page (not on Template: pages), preventing duplicate data.


===Usage===
===Usage===
Line 17: Line 19:
===Output===
===Output===
Renders: [[drug|display]] dose (or just dose if link=no)
Renders: [[drug|display]] dose (or just dose if link=no)
Creates SMW subobject with: Has DrugName, Has Dose, Has Context, Treats disease (auto-set to page name)
Creates SMW subobject (on main namespace pages only) with: Has DrugName, Has Dose, Has Context, Treats disease (auto-set to page name)


[[Category:Miscellaneous]]
[[Category:Miscellaneous]]
</noinclude><includeonly>{{#ifeq:{{{link|yes}}}|no|{{{dose|}}}|[[{{{drug|}}}{{#if:{{{display|}}}|{{!}}{{{display|}}}}}]] {{{dose|}}}}}{{#subobject:{{{drug|}}} {{{context|}}}
</noinclude><includeonly>{{#ifeq:{{{link|yes}}}|no|{{{dose|}}}|[[{{{drug|}}}{{#if:{{{display|}}}|{{!}}{{{display|}}}}}]] {{{dose|}}}}}{{#ifeq:{{NAMESPACENUMBER}}|0|{{#subobject:{{{drug|}}} {{{context|}}}
|Has DrugName={{{drug|}}}
|Has DrugName={{{drug|}}}
|Treats disease={{PAGENAME}}
|Treats disease={{PAGENAME}}
|Has Dose={{{dose|}}}
|Has Dose={{{dose|}}}
|Has Context={{{context|}}}
|Has Context={{{context|}}}
}}</includeonly>
}}|}}</includeonly>

Revision as of 19:49, 19 March 2026

AntibioticDose Template

This template creates a single source of truth for antibiotic dosing on disease pages. It displays the drug name and dose as visible text, and simultaneously creates an SMW subobject linking the antibiotic to the disease.

The SMW subobject is only created when the template is used on a main namespace page (not on Template: pages), preventing duplicate data.

Usage

{{AntibioticDose|drug=Ceftriaxone|dose=1-2g IV daily|context=Inpatient, CAP Non-ICU}}

Parameters

  • drug (required): The antibiotic page name (e.g., Ceftriaxone, Azithromycin)
  • dose (required): The dosing text (e.g., 1-2g IV daily, 500mg PO BID)
  • context (required): Clinical context (e.g., Outpatient Healthy, Inpatient CAP Non-ICU, ICU Low Risk)
  • display (optional): Custom display text for the drug link. If omitted, uses the drug name
  • link (optional): Set to "no" to show only the dose text without the drug link

Output

Renders: display dose (or just dose if link=no) Creates SMW subobject (on main namespace pages only) with: Has DrugName, Has Dose, Has Context, Treats disease (auto-set to page name)