• prescribing duration;
  • routinely-collected data;
  • health-related research;
  • electronic health data



To develop and test an algorithm that translates total dose and daily regimen, inputted as ‘free text’ on a prescription, into numerical values to calculate the prescribed treatment duration.


The algorithm was developed using antibiotic prescriptions (n = 711 714) from multiple primary care computer systems. For validation, the prescribed treatment duration of an independent sample of antibiotic scripts was calculated in two ways: (a) computer algorithm, (b) manually reviewed by a researcher blinded to the results of (a). The outputs of the two methods were compared and the level of agreement assessed, using confidence intervals for differences in proportions. This was repeated on sample of antidepressant scripts to test generalisabilty of the algorithm.


For the antibiotic prescriptions, the algorithm processed 98.5% with an accuracy of 99.8% and the manual review processed 98.5% with 98.9% accuracy. The differences between these proportions are 0.0% (95%CI of −0.9, 0.9%) and 1.0% (95%CI of −0.1, 2.3%), respectively. For the antidepressant prescriptions, the algorithm processed 91.5% with an accuracy of 96.6% compared to the manual review with 96.4% processed and 99.8% accuracy; difference between these proportions is 4.9% (95%CI of 2.0, 8.0%) and 3.2% (95%CI of 1.6, 5.3%), respectively.


The algorithm proved to be applicable and efficient for assessing prescribed duration, with sensitivity and specificity values close to the manual review, but with the added advantage that the computer can process large volume of scripts rapidly and automatically. Copyright © 2010 John Wiley & Sons, Ltd.