<metaproperty="og:title"content="Retrieve antimicrobial drug names and doses from clinical text — ab_from_text"/>
<metaproperty="og:description"content="Use this function on e.g. clinical texts from health care records. It returns a list with all antimicrobial drugs, doses and forms of administration found in the texts."/>
<p>Use this function on e.g. clinical texts from health care records. It returns a <ahref='https://rdrr.io/r/base/list.html'>list</a> with all antimicrobial drugs, doses and forms of administration found in the texts.</p>
type <spanclass='op'>=</span><spanclass='fu'><ahref='https://rdrr.io/r/base/c.html'>c</a></span><spanclass='op'>(</span><spanclass='st'>"drug"</span>, <spanclass='st'>"dose"</span>, <spanclass='st'>"administration"</span><spanclass='op'>)</span>,
<td><p>type of property to search for, either <code>"drug"</code>, <code>"dose"</code> or <code>"administration"</code>, see <em>Examples</em></p></td>
<td><p>character to pass on to <code><ahref='https://rdrr.io/r/base/paste.html'>paste(..., collapse = ...)</a></code> to only return one character per element of <code>text</code>, see <em>Examples</em></p></td>
<td><p>if <code>type = "drug"</code>: a column name of the <ahref='antibiotics.html'>antibiotics</a> data set to translate the antibiotic abbreviations to, using <code><ahref='ab_property.html'>ab_property()</a></code>. Defaults to <code>FALSE</code>. Using <code>TRUE</code> is equal to using "name".</p></td>
<td><p>logical to indicate whether the input must be extensively searched for misspelling and other faulty input values. Setting this to <code>TRUE</code> will take considerably more time than when using <code>FALSE</code>. At default, it will turn <code>TRUE</code> when all input elements contain a maximum of three words.</p></td>
<p>A <ahref='https://rdrr.io/r/base/list.html'>list</a>, or a <ahref='https://rdrr.io/r/base/character.html'>character</a> if <code>collapse</code> is not <code>NULL</code></p>
<p>This function is also internally used by <code><ahref='as.ab.html'>as.ab()</a></code>, although it then only searches for the first drug name and will throw a note if more drug names could have been returned.</p><h3class='hasAnchor'id='arguments'><aclass='anchor'href='#arguments'></a>Argument <code>type</code></h3>
<p>At default, the function will search for antimicrobial drug names. All text elements will be searched for official names, ATC codes and brand names. As it uses <code><ahref='as.ab.html'>as.ab()</a></code> internally, it will correct for misspelling.</p>
<p>With <code>type = "dose"</code> (or similar, like "dosing", "doses"), all text elements will be searched for numeric values that are higher than 100 and do not resemble years. The output will be numeric. It supports any unit (g, mg, IE, etc.) and multiple values in one clinical text, see <em>Examples</em>.</p>
<p>With <code>type = "administration"</code> (or abbreviations, like "admin", "adm"), all text elements will be searched for a form of drug administration. It supports the following forms (including common abbreviations): buccal, implant, inhalation, instillation, intravenous, nasal, oral, parenteral, rectal, sublingual, transdermal and vaginal. Abbreviations for oral (such as 'po', 'per os') will become "oral", all values for intravenous (such as 'iv', 'intraven') will become "iv". It supports multiple values in one clinical text, see <em>Examples</em>.</p>
<p>Without using <code>collapse</code>, this function will return a <ahref='https://rdrr.io/r/base/list.html'>list</a>. This can be convenient to use e.g. inside a <code><ahref='https://dplyr.tidyverse.org/reference/mutate.html'>mutate()</a></code>):<br/>
<p>The returned AB codes can be transformed to official names, groups, etc. with all <code><ahref='ab_property.html'>ab_*</a></code> functions such as <code><ahref='ab_property.html'>ab_name()</a></code> and <code><ahref='ab_property.html'>ab_group()</a></code>, or by using the <code>translate_ab</code> argument.</p>
The <ahref='lifecycle.html'>lifecycle</a> of this function is <strong>maturing</strong>. The unlying code of a maturing function has been roughed out, but finer details might still change. Since this function needs wider usage and more extensive testing, you are very welcome <ahref='https://github.com/msberends/AMR/issues'>to suggest changes at our repository</a> or <ahref='AMR.html'>write us an email (see section 'Contact Us')</a>.</p>
<p>On our website <ahref='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <ahref='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <ahref='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <ahref='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <ahref='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
<spanclass='fu'>ab_from_text</span><spanclass='op'>(</span><spanclass='st'>"500 mg amoxi po and 400mg cipro iv"</span><spanclass='op'>)</span>
<spanclass='fu'>ab_from_text</span><spanclass='op'>(</span><spanclass='st'>"500 mg amoxi po and 400mg cipro iv"</span>, type <spanclass='op'>=</span><spanclass='st'>"dose"</span><spanclass='op'>)</span>
<spanclass='fu'>ab_from_text</span><spanclass='op'>(</span><spanclass='st'>"500 mg amoxi po and 400mg cipro iv"</span>, type <spanclass='op'>=</span><spanclass='st'>"admin"</span><spanclass='op'>)</span>
<spanclass='va'>abx</span><spanclass='op'><-</span><spanclass='fu'>ab_from_text</span><spanclass='op'>(</span><spanclass='st'>"500 mg amoxi po and 400mg cipro iv"</span><spanclass='op'>)</span>
abx_doses <spanclass='op'>=</span><spanclass='fu'>ab_from_text</span><spanclass='op'>(</span><spanclass='va'>clinical_text</span>, type <spanclass='op'>=</span><spanclass='st'>"doses"</span><spanclass='op'>)</span>,
abx_admin <spanclass='op'>=</span><spanclass='fu'>ab_from_text</span><spanclass='op'>(</span><spanclass='va'>clinical_text</span>, type <spanclass='op'>=</span><spanclass='st'>"admin"</span><spanclass='op'>)</span>,
<p>Developed by <ahref='https://www.rug.nl/staff/m.s.berends/'>Matthijs S. Berends</a>, <ahref='https://www.rug.nl/staff/c.f.luz/'>Christian F. Luz</a>, <ahref='https://www.rug.nl/staff/a.w.friedrich/'>Alexander W. Friedrich</a>, <ahref='https://www.rug.nl/staff/b.sinha/'>Bhanu N. M. Sinha</a>, <ahref='https://www.rug.nl/staff/c.j.albers/'>Casper J. Albers</a>, <ahref='https://www.rug.nl/staff/c.glasner/'>Corinna Glasner</a>.</p>