Background: Physicians' adherence to guidelines can be used for measuring prescribing appropriateness. We present a simple approach allowing the automation of this process. Design: The drug therapy is described in terms of treatment type, pharmacotherapeutic classes, international non proprietary names (INN) and doses. A rule-based engine implementing the guideline generates recommendations for each patient record. These are automatically compared with prescriptions of the same patient in three levels of detail. Participants: Ambulatory patients admitted for the follow-up of their type 2 diabetes between June 2003 and September 2004 in a university hospital in France. Results: For 574 patient records included in the study, physicians agreed with the guideline recommendations over the choice of type of treatment in 473 cases (82%). When agreement over pharmacotherapeutic class of drugs was also taken into account, the adherence ratio decreased to 448 cases (78%). Finally, when the ...