text: body = <<-EOF
  <meta name="citation_title" content="comorbidity: An R package for computing comorbidity scores">
  <meta name="citation_author" content="Gasparini, Alessandro">
  <meta name="citation_publication_date" content="2018//">
  <meta name="citation_journal_title" content="The Journal of Open Source Software">
  <meta name="citation_pdf_url" content="http://www.theoj.org/joss-papers/joss.00648/10.21105.joss.00648.pdf">
  <meta name="citation_doi" content="10.21105/joss.00648">
  <meta name="citation_issn" content="2475-9066">
  <div class="accepted-paper">
    <h1>comorbidity: An R package for computing comorbidity scores</h1>
    <div class="columns links">
      <div class="column four-fifths" style="padding-bottom: 10px;">
        <strong>Authors</strong>
        <ul class="author-list">
              <li><a href="http://orcid.org/0000-0002-8319-7624" target="_blank">Alessandro Gasparini</a></li>
              </ul>
      </div>
      <div class="one-third column">
        <span class="repo">Repository:<br /><a href="https://github.com/ellessenne/comorbidity">Repository link &raquo;</a></span>
      </div>
      <div class="one-third column">
        <span class="paper">Paper:<br /><a href="http://www.theoj.org/joss-papers/joss.00648/10.21105.joss.00648.pdf">PDF link &raquo;</a></span>
      </div>
      <div class="one-third column">
        <span class="paper">Review:<br /><a href="https://github.com/openjournals/joss-reviews/issues/648">View review issue &raquo;</a></span>
      </div>
  
      <div class="one-third column" style="padding-top: 20px;">
        <span class="repo">DOI:<br /><a href="https://doi.org/10.21105/joss.00648">https://doi.org/10.21105/joss.00648</a></span>
      </div>
      <div class="one-third column" style="padding-top: 20px;">
        <span class="paper">Status badge:<br /><img src="http://joss.theoj.org/papers/10.21105/joss.00648/status.svg"></span>
      </div>
      <div class="one-third column" style="padding-top: 20px;">
        <span class="paper">
          Submitted: 12 March 2018 <br />
          Published: 29 March 2018
        </span>
  
      </div>
      <div class="two-thirds column" style="padding-top: 20px;">
        <span class="paper">Citation:<br />
        <small>Gasparini, (2018). comorbidity: An R package for computing comorbidity scores. <em>Journal of Open Source Software</em>, 3(23), 648. https://doi.org/10.21105/joss.00648</small>
      </div>
    </div>
    <div class="paper-body">
    <h1 id="summary">Summary</h1>
    <p>Comorbidity scores are extensively used in observational medical research studies to avoid potential bias when the burden of disease could be confounding the association of interest. This is of primary importance, given the increasing availability and use of administrative data (such as medical records and insurance claims) for research purposes. Several comorbidity scores have been proposed throughout the years; however, two of them are used most frequently in practice: the Charlson comorbidity index <span class="citation" data-cites="Charlson_1987">(Charlson et al. 1987)</span> and the Elixhauser comorbidity index <span class="citation" data-cites="Elixhauser_1998">(Elixhauser et al. 1998)</span>. The Charlson comorbidity index defines a set of comorbid conditions using International Classification of Disease (ICD) diagnostic codes. Each comorbid condition has an associated weight, and the sum of all weights results in a single comorbidity score per patient. The current version of the Charlson score includes 17 comorbidities. Similarly, the Elixhauser comorbidity index is based on ICD diagnostic codes and includes 31 comorbidities. In origin, the Elixhauser index score was based on the cumulative number of conditions present; since then, several weighting systems accounting for the increase or decrease in mortality risk associated with each condition have been proposed and used in practice <span class="citation" data-cites="vanWalraven_2009 Moore_2017">(van Walraven et al. 2009; Moore et al. 2017)</span>.</p>
    <p><code>comorbidity</code> is an R package that allows computing comorbidity scores in an easy and straightforward way. <code>comorbidity</code> is available from the Comprehensive R Archive Network (CRAN) and from GitHub at https://github.com/ellessenne/comorbidity. The main function of the package is named <code>comorbidity</code> as the package. It allows estimating any of the supported scores, which can be selected via the <code>score</code> argument. Currently, the Charlson comorbidity score and the Elixhauser comorbidity score are supported, using either the ICD-9-CM or the ICD-10 coding system. The implementation is based on the coding algorithms published by Quan <em>et al</em>. in 2005 <span class="citation" data-cites="Quan_2005">(Quan et al. 2005)</span>. The weighting system implemented for the Charlson score is based on the original paper by Charlson <em>et al</em>. <span class="citation" data-cites="Charlson_1987">(Charlson et al. 1987)</span>; conversely, we implemented the weighting system proposed by Moore <em>et al</em>. for the Elixhauser score <span class="citation" data-cites="Moore_2017">(Moore et al. 2017)</span>. Given that the version of the Elixhauser score studied by Moore <em>et al</em>. only included 29 comorbid conditions, we applied weights from van Walraven <em>et al</em>. for the remaining domains <span class="citation" data-cites="vanWalraven_2009">(van Walraven et al. 2009)</span>. We also categorise each comorbidity score following work by Menendez <em>et al</em>. <span class="citation" data-cites="Menendez_2014">(Menendez et al. 2014)</span>.</p>
    <p>Internally, each comorbidity score is coded separately and called by the <code>comorbidity</code> function. This provides two benefits: it makes it easy to maintain the package, and it makes it trivial to implement new scores in the future. Finally, computing comorbidity scores can be time-consuming with large datasets (both in terms of number of patients and diagnostic codes). Parallel computing is supported out of the box to mitigate this potential problem, with no additional programming required by the user: it is sufficient to set the argument <code>parallel = TRUE</code> when calling <code>comorbidity</code>. All processing cores available on a machine are used by default, but it is possible to manually set how many cores to use via the <code>mc.cores</code> argument. The advantage in terms of computational speed can be significant, especially with large dataset: the parallel implementation is approximately twice as fast for datasets with 100,000 individuals and 1,000,000 diagnostic codes (Figure 1, timed using a laptop with a dual-core i5-6300U processor and 8 GB of RAM).</p>
    <p><img src="plot.png" alt="Comparison of sequential vs parallel implementation of comorbidity" /> <strong>Figure 1:</strong> comparison of sequential vs parallel implementation of <code>comorbidity</code> on a laptop with a dual-core i5-6300U processor and 8 GB of RAM. Each data point represents the average ratio over a set of 10 replications; the vertical bars represent the minimum and the maximum ratio.</p>
    <h1 id="references" class="unnumbered">References</h1>
    <div id="refs" class="references">
    <div id="ref-Charlson_1987">
    <p>Charlson, Mary E, Peter Pompei, Kathy L Ales, and C Ronald MacKenzie. 1987. &#8220;A New Method of Classifying Prognostic Comorbidity in Longitudinal Studies: Development and Validation.&#8221; <em>Journal of Chronic Diseases</em> 40 (5):373&#8211;83. <a href="https://doi.org/10.1016/0021-9681(87)90171-8" class="uri">https://doi.org/10.1016/0021-9681(87)90171-8</a>.</p>
    </div>
    <div id="ref-Elixhauser_1998">
    <p>Elixhauser, Anne, Claudia Steiner, D Robert Harris, and Rosanna M Coffey. 1998. &#8220;Comorbidity Measures for Use with Administrative Data.&#8221; <em>Medical Care</em> 36 (1):8&#8211;27. <a href="https://doi.org/10.1097/00005650-199801000-00004" class="uri">https://doi.org/10.1097/00005650-199801000-00004</a>.</p>
    </div>
    <div id="ref-Menendez_2014">
    <p>Menendez, Mariano E, Valentin Neuhaus, C Niek van Dijk, and David Ring. 2014. &#8220;The Elixhauser Comorbidity Method Outperforms the Charlson Index in Predicting Inpatient Death After Orthopaedic Surgery.&#8221; <em>Clinical Orthopaedics and Related Research</em> 472 (9):2878&#8211;86. <a href="https://doi.org/10.1007/s11999-014-3686-7" class="uri">https://doi.org/10.1007/s11999-014-3686-7</a>.</p>
    </div>
    <div id="ref-Moore_2017">
    <p>Moore, Brian J, Susan White, Raynard Washington, Natalia Coenen, and Anne Elixhauser. 2017. &#8220;Identifying Increased Risk of Readmission and in-Hospital Mortality Using Hospital Administrative Data: The AHRQ Elixhauser Comorbidity Index.&#8221; <em>Medical Care</em> 55 (7):698&#8211;705. <a href="https://doi.org/10.1097/mlr.0000000000000735" class="uri">https://doi.org/10.1097/mlr.0000000000000735</a>.</p>
    </div>
    <div id="ref-Quan_2005">
    <p>Quan, Hude, Vijaya Sundararajan, Patricia Halfon, Andrew Fong, Bernard Burnand, Jean-Christophe Luthi, L Duncan Saunders, Cynthia A Beck, Thomas E Feasby, and William A Ghali. 2005. &#8220;Coding Algorithms for Defining Comorbidities in ICD-9-CM and ICD-10 Administrative Data.&#8221; <em>Medical Care</em> 43 (11):1130&#8211;9. <a href="https://doi.org/10.1097/01.mlr.0000182534.19832.83" class="uri">https://doi.org/10.1097/01.mlr.0000182534.19832.83</a>.</p>
    </div>
    <div id="ref-vanWalraven_2009">
    <p>van Walraven, Carl, Peter C Austin, Alison Jennings, Hude Quan, and Alan J Forster. 2009. &#8220;A Modification of the Elixhauser Comorbidity Measures into a Point System for Hospital Death Using Administrative Data.&#8221; <em>Medical Care</em> 47 (6):626&#8211;33. <a href="https://doi.org/10.1097/mlr.0b013e31819432e5" class="uri">https://doi.org/10.1097/mlr.0b013e31819432e5</a>.</p>
    </div>
    </div>
    </div>
  </div>
  EOF
  