Calculators guide
Calculators on WikiAnesthesia are interactive tools which perform clinical calculations across a wide range of topics of interest in anesthesia.
About the calculators
Calculators on WikiAnesthesia differ from many other existing calculator apps by leveraging several unique characteristics of the practice of anesthesia:
- Each patient may require many independent calculations to be performed
- E.g. lean body weight, weight-based drug dosing, equipment sizing, fluid management, cardiac output
- Many calculations in anesthesia are computed using a relatively limited set of patient variables
- E.g. weight, height, age, sex
This allows optimizations for real-time clinical use in the following ways:
- The results of many calculations can be displayed in a single, organized, compact, searchable interface
- User-provided values for patient variables are cached for 8 hours
- Patient data only needs to be entered once throughout the intraoperative period and will automatically be applied to all calculators on the site
Using the calculators
The most commonly used calculators can be found in the calculators menu in the upper right of the header. A complete list of available calculators includes:
List of calculators
- Body composition calculations
- Cardiovascular calculations
- Drug dosage calculations
- Equipment size calculations
- Fluid management calculations
- Neuro calculations
- Respiratory calculations
Contributing to calculators
Because calculators are interactive tools which run JavaScript code locally on users' computers, modification of calculator code is restricted to developers of WikiAnesthesia. Users can contribute to calculators by either suggesting changes using the discussion page or apply for developer access to modify existing or create new calculators.
Suggesting changes
Any user may use the calculator's discussion page to make suggestions about how to improve that calculator. To be most helpful, please include any specific details and relevant references which would facilitate evidenced-based implementation by one of our developers. Some good examples of feedback include:
- A drug or dose for a specific population/indication/route is missing from the drug dosage calculator
- Additional calculation(s) which could be added to the anatomy and physiology calculator
Applying for developer access
If you would like to more substantially contribute to calculator development, please send a message to the editor-in-chief and include:
- A brief description of your technical background
- Experience with JavaScript and jQuery would be particularly helpful
- What ideas you have for improving and/or adding to the calculators provided by WikiAnesthesia
If approved, you will be given developer access on a sandbox server to develop and test your modifications. When ready, your code will be reviewed and considered for implementation on the live site.
Calculator development
- Calculators are implemented as MediaWiki gadgets, which consist of javascript and/or css files stored as wiki pages in the MediaWiki namespace
- This allows the code to have similar collaboration, history tracking, and version control as normal wiki pages
- See the gadgets extension page for background information about how gadgets work
- The core functionality of the calculators platform is provided by the "calculator-core" gadget
- Contained in Gadget-calculator-core.js and Gadget-calculator-core.css
- Calculator functions and data are stored in the
mw.calculators
property of the globalmw
MediaWiki javascript object
Creating a new calculator
Calculators must be declared as gadgets in the Gadgets-definition page. The gadget definition should specify any additional dependencies on existing gadgets (calculator-core is automatically included). Some examples of common dependencies include:
- calculator-patients-patientInput: Adds a sticky input panel for patient weight, height, age, and sex below the header
- calculator-patients-bodyComposition: Makes calculations for lean and ideal body weight available
- calculator-drugs-data: Loads the database of drug data
Calculators may be added to the calculator menu by editing the calculators-definition page
Eventually this guide may expand to include more specific details about calculator development, but for now, the best way to learn would be to examine the code of existing calculators to see how they work.
Adding calculators to an article
Calculators are added to articles using a set of custom tags. It is generally easiest to implement calculators with the editor in source mode.
List of calculator tags
<calculatormodule>
The <calculatormodule>
tag loads calculator module(s) specifed by the id
argument (comma-separated). While modules may also be loaded by <calculation>
tags, <calculatormodule>
offers convenience if an article contains many calculations from the same module.
Arguments
id
- Required. Loads specified module(s) using comma-separated values.- The module id must exactly match a module declared in Gadgets-definition (after "calculator-").
- E.g. To load the calculator-drugDosages module, use
<calculatormodule id="drugDosages" />
<calculatordescription>
The <calculatordescription>
tag adds user documentation for the calculator.
- Any content contained within the tag will be added as a collapsed section inline wherever placed in the article
- Articles can contain one or more
<calculatordescription>
tags- The first tag will add an "About this calculator" item to the page menu which will show the content
- Subsequent tags will add a button inline to show the content
<calculatorsearch>
The <calculatorsearch>
tag adds calculation search functionality to the article as a panel below the article title.
Arguments
title
- Optional. Sets the title of the search panel.- Default: "Search"
- E.g. To use the title "Search drugs", use
<calculatorsearch title="Search drugs" />
search-placeholder
- Optional. Sets the placeholder text of the search field- Default: "Search calculations"
- E.g. To use the placeholder text "Search "Atropine" or "Precedex" or "Hypotension" or "PONV"", use
<calculatorsearch search-placeholder="Search "Atropine" or "Precedex" or "Hypotension" or "PONV"" />
category-placeholder
- Optional. Sets the placeholder text of the category select field- Default: "(Show all categories)"
- E.g. To use the placeholder text "(Show all drug categories)", use
<calculatorsearch category-placeholder="(Show all drug categories)" />
<calculationcategory>
The <calculationcategory>
tag allows multiple calculations to be grouped, and defines the categories used by the search functionality. Calculations within a category should be contained with the open and close tags.
Arguments
id
- Required. Sets the id of the categorytitle
- Required. Sets the title text of the category
<calculation>
The <calculation>
tag adds a calculation to the article.
- Any content may be contained between the open and close tags which will be stored within a
<div>
in the article as a placeholder and replaced by the interactive calculation when the article is loaded- This will allow search engines to index and find content relevant to the calculation
Arguments
id
- Required. Specifies the calculation id to be displayed.module
- Optional. Specifies the calculator module to be loaded (which contains the definition of this calculation).- This argument is unnecessary if the module has already been loaded using a
<calculatormodule>
tag
- This argument is unnecessary if the module has already been loaded using a