An Online Prescription Error Checking Expert System in Community Pharmacies Rodger Tsai.

33
An Online Prescription An Online Prescription Error Checking Expert Error Checking Expert System in Community System in Community Pharmacies Pharmacies Rodger Tsai Rodger Tsai

Transcript of An Online Prescription Error Checking Expert System in Community Pharmacies Rodger Tsai.

An Online Prescription Error An Online Prescription Error Checking Expert System in Checking Expert System in

Community Pharmacies Community Pharmacies

Rodger TsaiRodger Tsai

Agenda - Agenda - Jess and ServletJess and Servlet Introduction to JessIntroduction to Jess Programming with Programming with

Jess in JavaJess in Java ExamplesExamples Java ServletJava Servlet TomCatTomCat

WARWAR Web.xmlWeb.xml Servlet ExampleServlet Example SummarySummary

Agenda - Prescription Error Agenda - Prescription Error Checking Expert SystemChecking Expert System

BackgroundBackground Pharmacist Pharmacist

InterventionIntervention Prescription Error Prescription Error Benefit Benefit

Drug Information Drug Information ResourceResource

NDC DirectoryNDC Directory Unnecessary DrugUnnecessary Drug DoseDose

Drug – Drug Drug – Drug interactioninteraction

InputInput OutputOutput Architecture Architecture SummarySummary ReferenceReference

Introduction to JessIntroduction to Jess

Written by Ernest Friedman-HillWritten by Ernest Friedman-HillSimilar to CLIPSSimilar to CLIPSRule engine and scripting environment Rule engine and scripting environment

written in Javawritten in Java

Programming with Jess in JavaProgramming with Jess in Java

jess.Rete ( Rule Engine )jess.Rete ( Rule Engine ) jess.Jesp ( Parser )jess.Jesp ( Parser ) jess.ConsoleApplet ( for Applet ) jess.ConsoleApplet ( for Applet ) jess.Console ( for Console )jess.Console ( for Console )Access Java object in Jess Access Java object in Jess Embed java functions in Jess codeEmbed java functions in Jess code

ReteRete

import jess.*;import jess.*; // Jess 6.0// Jess 6.0

public class example1public class example1{{

public static void main( String [] argus ) throws JessExceptionpublic static void main( String [] argus ) throws JessException{{Rete r = new Rete();Rete r = new Rete();

r.executeCommand("(deftemplate node (slot name)(slot value))");r.executeCommand("(deftemplate node (slot name)(slot value))");r.executeCommand("(assert(node (name root)(value 0 )))");r.executeCommand("(assert(node (name root)(value 0 )))");r.executeCommand("(facts)");r.executeCommand("(facts)");}}

}}

JespJespimport java.io.*;import java.io.*;import jess.*;import jess.*; // Jess 6.0// Jess 6.0

public class example2public class example2{{

public static void main( String [] argus ) throws JessExceptionpublic static void main( String [] argus ) throws JessException{{

Rete r = new Rete();Rete r = new Rete();Jesp jesp;Jesp jesp;

try{try{jesp=new Jesp(new FileReader("c:/project.clp"), r);jesp=new Jesp(new FileReader("c:/project.clp"), r);jesp.parse(false); // false means a prompt should not jesp.parse(false); // false means a prompt should not // be // be

printedprintedr.run();r.run();

}catch(FileNotFoundException e){};}catch(FileNotFoundException e){};}}

}}

Console and ConsoleAppletConsole and ConsoleApplet

Console // Jess 6.0 & 5.2Console // Jess 6.0 & 5.2C:\java jess.Console C:\project.clpC:\java jess.Console C:\project.clp

AppletApplet // Jess 5.2 // Jess 5.2 <applet code=jess.ConsoleApplet width="500" height="330" <applet code=jess.ConsoleApplet width="500" height="330"

archive=jess.jar >archive=jess.jar >

<param name=INPUT value=project.clp></applet><param name=INPUT value=project.clp></applet>

Access Java Object in Jess Access Java Object in Jess

Jess > (bind ?o (new Hello))Jess > (bind ?o (new Hello))Jess > (bind ?f (call ?o test 3))Jess > (bind ?f (call ?o test 3))Jess > (set-member ?o a1 4)Jess > (set-member ?o a1 4)Jess > (set-member ?o a2 5)Jess > (set-member ?o a2 5)Jess > (bind ?m Jess > (bind ?m (get-member ?o a2)(get-member ?o a2) ))==================================================?o = address of Hello object?o = address of Hello object?f = 9?f = 9?o.a1 = 4?o.a1 = 4?o.a2 = 5?o.a2 = 5?m = 5?m = 5

public class Hellopublic class Hello{{

public int a1;public int a1;public int a2;public int a2;

public int test(int value)public int test(int value){{

return value * value;return value * value;}}

}}

Use Java Functions in Jess Use Java Functions in Jess

Import jess.*;Import jess.*;

Public class XXX implements UserfunctionPublic class XXX implements Userfunction{{

public String getName();public String getName();public Value call( ValueVector vv, Context context)public Value call( ValueVector vv, Context context)

throws JessExceptionthrows JessException{{

// coding// coding}}

}}

Use Java Functions in Jess (Con’t)Use Java Functions in Jess (Con’t)import jess.*;import jess.*;

public class MyTry implements Userfunctionpublic class MyTry implements Userfunction{{

public String getName()public String getName(){{

return "my-try";return "my-try";}}

public Value call( ValueVector vv, public Value call( ValueVector vv, Context context)Context context)

throws JessExceptionthrows JessException{{

int a = vv.get(1).intValue(context);int a = vv.get(1).intValue(context);int b = vv.get(2).intValue(context);int b = vv.get(2).intValue(context);

return new Value(a * b, return new Value(a * b, RU.INTEGER );RU.INTEGER );}}

}}

Jess > (load-function MyTry)Jess > (load-function MyTry)TRUETRUEJess > (my-try 45 67)Jess > (my-try 45 67)30153015

Java ServletJava Servlet

Server-side JavaServer-side JavaExtensions to Java-enabled serversExtensions to Java-enabled serversReplacement of CGIReplacement of CGIPlatform independentPlatform independent

TomCatTomCat

Stand-alone serverStand-alone serverTomcat, a servlet container, implements Tomcat, a servlet container, implements

the Servlet and JSP specifications from the Servlet and JSP specifications from Java SoftwareJava Software

For developing, testing , deploying web For developing, testing , deploying web applications and web servicesapplications and web services

Web Application Archive (WAR)Web Application Archive (WAR)

Application Name/Application Name/*.html, *.jsp , etc.*.html, *.jsp , etc.WEB-INF/WEB-INF/

web.xmlweb.xml classes/classes/

Your Java class filesYour Java class files lib/lib/

*.jar files ( Jess.jar )*.jar files ( Jess.jar )

Configure web application Configure web application deployment descriptor ( web.xml )deployment descriptor ( web.xml )

<servlet><servlet>

<servlet-name>MyProjectServlet</servlet-name><servlet-name>MyProjectServlet</servlet-name>

<servlet-class>MyProjectServlet</servlet-class><servlet-class>MyProjectServlet</servlet-class>

</servlet></servlet>

<servlet-mapping><servlet-mapping>

<servlet-name>MyProjectServlet</servlet-name><servlet-name>MyProjectServlet</servlet-name>

<url-pattern>/MyProjectServlet</url-pattern><url-pattern>/MyProjectServlet</url-pattern>

</servlet-mapping></servlet-mapping>

import javax.servlet.*;import javax.servlet.*;import javax.servlet.http.*;import javax.servlet.http.*;import jess.*;import jess.*;import java.io.*;import java.io.*;

public class MyProjectServlet extends HttpServlet {public class MyProjectServlet extends HttpServlet {

private Rete r;private Rete r;private PrintWriter w;private PrintWriter w;private Value v;private Value v;

public void init() throws ServletExceptionpublic void init() throws ServletException{{}}

public void doGet(HttpServletRequest req, public void doGet(HttpServletRequest req, HttpServletResponse res) throws HttpServletResponse res) throws ServletException,IOExceptionServletException,IOException{{

r = new Rete();r = new Rete();w = res.getWriter();w = res.getWriter();

w.println("<html>");w.println("<html>");w.println("<body>");w.println("<body>");w.println("<head>");w.println("<head>");w.println("<title>Servlet w.println("<title>Servlet

Example</title>");Example</title>");w.println("</head>");w.println("</head>");

try{try{w.println("<p>");w.println("<p>");w.println("( + 15 7 ) = ");w.println("( + 15 7 ) = ");v = r.executeCommand("(+ 15 7)");v = r.executeCommand("(+ 15 7)");

w.println(v.intValue(r.getGlobalContext()));w.println(v.intValue(r.getGlobalContext()));w.println("</p>");w.println("</p>");

w.println("<p>");w.println("<p>");w.println("( - 15 7 ) = ");w.println("( - 15 7 ) = ");v = r.executeCommand("( - 15 7)");v = r.executeCommand("( - 15 7)");

w.println(v.intValue(r.getGlobalContext()));w.println(v.intValue(r.getGlobalContext()));w.println("</p>");w.println("</p>");

w.println("<p>");w.println("<p>");w.println("( * 15 7 ) = ");w.println("( * 15 7 ) = ");v = r.executeCommand("( * 15 7)");v = r.executeCommand("( * 15 7)");

w.println(v.intValue(r.getGlobalContext()));w.println(v.intValue(r.getGlobalContext()));w.println("</p>");w.println("</p>");

w.println("<p>");w.println("<p>");w.println("( / 15 7 ) = ");w.println("( / 15 7 ) = ");v = r.executeCommand("( / 15 7)");v = r.executeCommand("( / 15 7)");

w.println(v.intValue(r.getGlobalContext()));w.println(v.intValue(r.getGlobalContext()));w.println("</p>");w.println("</p>");

}catch(JessException je){};}catch(JessException je){};

w.println("</body>");w.println("</body>"); w.println("</html>");w.println("</html>");

}}}}

ResultResult

Summary - JessSummary - Jess Programming with Jess in JavaProgramming with Jess in Java

Rete ClassRete Class Jesp ClassJesp Class Console ClassConsole Class ConsoleApplet ClassConsoleApplet Class

Java ServletJava Servlet Init()Init() Service()Service() DoGet()DoGet() DoPost()DoPost() ……

TomCat ( Servlet Container )TomCat ( Servlet Container )

An Online Prescription Error An Online Prescription Error Checking Expert System in Checking Expert System in Community Pharmacies : Community Pharmacies :

BackgroundBackground

Pharmacist InterventionPharmacist InterventionPrescription ErrorsPrescription ErrorsBenefit Benefit

Pharmacist InterventionPharmacist Intervention

Prevent Prescription Error & Prevent Prescription Error & Side EffectSide EffectReducing Cost of Therapy Reducing Cost of Therapy

Prescription ErrorsPrescription Errors

Unnecessary or Duplicate DrugUnnecessary or Duplicate Drug Inappropriate Dose Range, Dosing Inappropriate Dose Range, Dosing

Frequency, and Duration of TherapyFrequency, and Duration of Therapy Inappropriate Dosage FormInappropriate Dosage FormDrug – Drug InteractionDrug – Drug InteractionAllergy Allergy PregnancyPregnancy

BenefitBenefit ““Community pharmacists have performed countless interventions Community pharmacists have performed countless interventions

and enhanced health outcomes for many patients through correcting and enhanced health outcomes for many patients through correcting errors of omission and commission made by physicians and other errors of omission and commission made by physicians and other providers and saving vast expenditures by private, governmental, providers and saving vast expenditures by private, governmental, and other third-party programs.”and other third-party programs.”[1][1]

Rupp and colleaguesRupp and colleagues[2] [2] found that Pharmacist interventions found that Pharmacist interventions produced an added value of produced an added value of $2.32$2.32 to each prescription filled. to each prescription filled.[1][1]

Iverson found that Iverson found that 2%2% of prescriptions needed dosage corrections of prescriptions needed dosage corrections or other actions. He also concluded that the cost savings amounted or other actions. He also concluded that the cost savings amounted to to $16.74$16.74 per prescription. per prescription.[1][3][1][3]

Rupp Rupp [4][4] found that found that $123$123 in medical-care costs were avoided through in medical-care costs were avoided through pharmacist interventions.pharmacist interventions.[1][1]

““In managed care settings, pharmacist interventions have been In managed care settings, pharmacist interventions have been calculated to save calculated to save $24$24 per intervention.” per intervention.”[1][5][1][5]

Drug Information ResourcesDrug Information Resources

PDR (Physicians' Desk ReferencePDR (Physicians' Desk Reference®®))FDAFDADrug.comDrug.comDrugfacts.comDrugfacts.comMayoClinical.comMayoClinical.com

National Drug Code DirectoryNational Drug Code Directory The NDC System was used to be a part of an out-of-The NDC System was used to be a part of an out-of-

hospital drug reimbursement program under Medicarehospital drug reimbursement program under Medicare 4 support tables and 7 databases 4 support tables and 7 databases

National Drug Code (NDC) National Drug Code (NDC) 10 digits number and 3 segments 10 digits number and 3 segments [ [ Labeler / VendorLabeler / Vendor ] [ ] [ Product CodeProduct Code ] [ ] [ Package SizePackage Size ] ] 44 - - 44 - - 22, , 55 – – 33 – – 22 , , 55 – – 44 – – 11

Dosage Form Dosage Form Routes of Administration Routes of Administration Active Ingredient(s)Active Ingredient(s) StrengthStrength Unit Unit Package Size and TypePackage Size and Type Major Drug ClassMajor Drug Class

Unnecessary Drugs Unnecessary Drugs

Same Drug : A brand-name drug and Same Drug : A brand-name drug and a generic equivalent. a generic equivalent.

Different Drug : If the pharmacological Different Drug : If the pharmacological properties of drugs are the same, then it properties of drugs are the same, then it may cause overdose problems.may cause overdose problems.

DoseDose

Age and weightAge and weightDrug FormDrug FormDurationDurationLiver and Kidney FunctionLiver and Kidney Function

Drug – Drug InteractionDrug – Drug Interaction

2 or more drug have interaction2 or more drug have interaction Increase drug effectIncrease drug effectDecrease drug effectDecrease drug effect

Input : Drug Data & Input : Drug Data & Basic Patient InformationBasic Patient Information

AgeAge WeightWeight GenderGender Brief Survey Brief Survey

Liver FunctionLiver Function Kidney Function Kidney Function Drug Allergy HistoryDrug Allergy History PregnancyPregnancy

Prescription Prescription Drugs( Rx )Drugs( Rx ) Brand nameBrand name DoseDose DurationDuration Drug formDrug form

Medicine history ( If the Medicine history ( If the customer has been customer has been here before)here before)

Output : Suggestion & AdviceOutput : Suggestion & Advice

Unnecessary DrugUnnecessary Drug Excessive Dose Excessive Dose Insufficient DoseInsufficient Dose Excessive DurationExcessive Duration Insufficient DurationInsufficient Duration

Inappropriate FormInappropriate Form Drug – Drug Drug – Drug

InteractionInteraction Pregnancy PrecautionPregnancy Precaution Drug Allergy Drug Allergy

PrecautionPrecaution

ArchitectureArchitecture

Summary – Prescription Error Summary – Prescription Error Checking Expert System Checking Expert System

Benefit of A Prescription Error Checking Expert SystemBenefit of A Prescription Error Checking Expert System Prescription Error:Prescription Error:

Unnecessary or Duplicate DrugUnnecessary or Duplicate Drug Inappropriate Dose Range, Dosing Frequency, and Duration of TherapyInappropriate Dose Range, Dosing Frequency, and Duration of Therapy Inappropriate Dosage FormInappropriate Dosage Form Drug – Drug InteractionDrug – Drug Interaction Allergy Allergy PregnancyPregnancy

National Drug Code DirectoryNational Drug Code Directory Input & Output:Input & Output:

In: Drug data and Basic Patient InformationIn: Drug data and Basic Patient Information Out: Suggestion and Advice Out: Suggestion and Advice

ReferenceReference

1.1. Jack E. Fincham: Pharmaceutical Care Studies: A Review and Jack E. Fincham: Pharmaceutical Care Studies: A Review and Update. Drug Benefit Trends 10(6):41-45, 1998. Update. Drug Benefit Trends 10(6):41-45, 1998.

2.2. Rupp MT, DeYoung M, Schondelmeyer SW: Prescribing Rupp MT, DeYoung M, Schondelmeyer SW: Prescribing problems and pharmacist interventions in community practice. problems and pharmacist interventions in community practice. Med Care 30:926-940, 1992. Med Care 30:926-940, 1992.

3.3. Iverson PS: Pharmacists' interventions. Minn Pharmacist 8:11-14, Iverson PS: Pharmacists' interventions. Minn Pharmacist 8:11-14, 1992. 1992.

4.4. Rupp MT: Value of community pharmacists' interventions to Rupp MT: Value of community pharmacists' interventions to correct prescribing errors. Ann Pharmacother 26:1580-1584, correct prescribing errors. Ann Pharmacother 26:1580-1584, 1992. 1992.

5.5. Davis KR, Allen KL: Poster Presentation. Financial impact of Davis KR, Allen KL: Poster Presentation. Financial impact of routine pharmacist intervention in a managed care system. routine pharmacist intervention in a managed care system. Abstracts from the proceedings of the American Society of Abstracts from the proceedings of the American Society of Health-System Pharmacists (ASHP) 25th Midyear Clinical Health-System Pharmacists (ASHP) 25th Midyear Clinical Meeting, Las Vegas, Nev., December 1990. Abstract HMO06. Meeting, Las Vegas, Nev., December 1990. Abstract HMO06.

Thank You !!Thank You !!