KIDS Drug File

Introduction (statement of the problem to solve)
Currently, there is no easy existing way to transport a drug file in VISTA into a new VISTA installation. Previous methods relied on programmers hand crafting a solution for their systems. In addition, the existing drug file in WorldVistA 1.0 was not good enough to be used in an instance and had to be deleted and replaced with a new hand entered one.

This project aims to provide the following:
 * An easy way to transport a drug file
 * Example drug files as KIDS distributions to use for new installations
 * A spreadsheet to compare existing drug files.

Solution
A MUMPS routine was written to work with KIDS to distribute a drug file for installation on new systems. In addition, drug files were extracted and placed into an open office spreadsheet for comparison.

The following files are transported from a source instance to another: * ^PSDRUG     DRUG * ^PS(50.7)   PHARMACY ORDERABLE ITEM * ^PS(51.7)   DRUG TEXT * ^PS(52.6)   IV ADDITIVES * ^PS(52.7)   IV SOLUTIONS * ^PS(50.4)   DRUG ELECTROLYTES

CPRS (OE/RR) files are then synced with the new files.

Deliverables
Located on the WorldVistA Trac Server. See warning below on usage.
 * Comparison Spreadsheet
 * Routine VWPSSXPD
 * Example Drug File Source IC
 * Example Drug File Source W
 * Example Drug File Source H
 * README

How to use?
Using a KIDS file produced by this tool will result in your drug files (see the list above) being deleted and replaced. If your database contains pharmacy patient data, this will cause permanent corruption of your PHI.

Workflow

On the Origin System:
 * Create a KIDS build that calls the following:
 * 1) Routine VWPSSXPD to call from top is the Environment Check for the Build
 * 2) PRE^VWPSSXPD is the Pre-Init for the Destination System
 * 3) POST^VWPSSXPD is the Post-Init for the Destination System
 * 4) TRAN^VWPSSXPD is the Pre-Transport Routine for your originating system drug data
 * Generate the KIDS Build. The file will have all the Drug Data from the Origin System.

On the Destination System:
 * Install the KIDS Build

Generating the KIDS build, loading it, and installing it takes some time. In my tests, never more than 30 seconds each; typically 5 to 10 seconds.

Here is what the first screen of  menu option will look like. No other screens have to be filled out.

Edit a Build                         PAGE 1 OF 5 Name: DRUG FILE 4 WV SOURCE W 1.0          TYPE: SINGLE PACKAGE ---

Name: DRUG FILE 4 WV SOURCE W 1.0

Date Distributed: APR 16,2012

Description:                            Delete Routine after install Environment Check Routine: VWPSSXPD                     Y/N:

Pre-Install Routine: PRE^VWPSSXPD                 Y/N:

Post-Install Routine: POST^VWPSSXPD                Y/N:

Pre-Transportation Routine: TRAN^VWPSSXPD _______________________________________________________________________________

COMMAND:                                      Press H for help    Insert

The install log looks like this: MU-beta>D ^XPDIL,^XPDI

Enter a Host File: drug_file_4wv_source_ic_0100.kids

KIDS Distribution saved on Apr 16, 2012@13:16:04 Comment: Example Drug File Installation

This Distribution contains Transport Globals for the following Package(s): Build DRUG FILE 4 WV SOURCE IC 1.0 has been loaded before, here is when: DRUG FILE 4 WV SOURCE IC 1.0  Install Completed was loaded on Apr 13, 2012@08:58:03 OK to continue with Load? NO// YES

Distribution OK!

Want to Continue with Load? YES// Loading Distribution...

Build DRUG FILE 4 WV SOURCE IC 1.0 has an Enviromental Check Routine Want to RUN the Environment Check Routine? YES// NO  DRUG FILE 4 WV SOURCE IC 1.0 Use INSTALL NAME: DRUG FILE 4 WV SOURCE IC 1.0 to install this Distribution.

Select INSTALL NAME:   DRUG FILE 4 WV SOURCE IC 1.0     Loaded from Distributio n    Loaded from Distribution  4/13/12@13:24 => Example Drug File Installation ;Created on Apr 16, 2012@13:16:04

This Distribution was loaded on Apr 13, 2012@13:24 with header of   Example Drug File Installation  ;Created on Apr 16, 2012@13:16:04 It consisted of the following Install(s): DRUG FILE 4 WV SOURCE IC 1.0

Checking DRUG FILE 4 WV SOURCE IC 1.0 for overlap with VOE 1.0. OK           No overlap found

Checking DRUG FILE 4 WV SOURCE IC 1.0 for overlap with VOE 1.1. OK           No overlap found

Checking DRUG FILE 4 WV SOURCE IC 1.0 for overlap with NO HOME 1.0. OK           No overlap found

Checking Install for Package DRUG FILE 4 WV SOURCE IC 1.0 Will first run the Environment Check Routine, VWPSSXPD --  WARNING WARNING WARNING   -

This package will delete your drug file and add a new drug file contained in the distribution.

If you have patient pharmacy data, this will CORRUPT your database.

You are running in a Test Environment.

Are you sure you want to continue? Type a full YES/yes if you want to proceed) ANSWER: YES

Install Questions for DRUG FILE 4 WV SOURCE IC 1.0

Want KIDS to INHIBIT LOGONs during the install? NO// Want to DISABLE Scheduled Options, Menu Options, and Protocols? NO//

Enter the Device you want to print the Install messages. You can queue the install by enter a 'Q' at the device prompt. Enter a '^' to abort the install.

DEVICE: HOME// ;P-OTHER;80;99999 TELNET

Install Started for DRUG FILE 4 WV SOURCE IC 1.0 : Apr 13, 2012@13:24:23 Build Distribution Date: Apr 16, 2012 Installing Routines:.. Apr 13, 2012@13:24:23 Running Pre-Install Routine: PRE^VWPSSXPD.

Killing Drug (50) Killing Pharmacy Orderable Item (OI) (50.7) Killing Drug Text (51.7) Killing IV Additives (52.6) Killing IV Solutions (52.7) Killing Drug Electrolytes (50.4) Removing Pharmacy OIs from the Orderable Item (101.43) Syncing the Order Quick View (101.44) --> Rebuilding IVA RX --> Rebuilding IVB RX --> Rebuilding IVM RX --> Rebuilding NV RX --> Rebuilding O RX --> Rebuilding UD RX Running Post-Install Routine: POST^VWPSSXPD.

Syncing Pharamcy Orderable Item 1 Syncing Pharamcy Orderable Item 2 Syncing Pharamcy Orderable Item 3 [output elided] Syncing Pharamcy Orderable Item 417 Syncing Pharamcy Orderable Item 418 --> Rebuilding IVA RX --> Rebuilding IVB RX --> Rebuilding IVM RX --> Rebuilding NV RX --> Rebuilding O RX --> Rebuilding UD RX Updating Routine file...... Updating KIDS files..... DRUG FILE 4 WV SOURCE IC 1.0 Installed. Apr 13, 2012@13:24:41 No link to PACKAGE file NO Install Message sent

Limitations

 * If the Administration Schedules from the originating system and destination system don't match, you need to either change the schedules on the orderable items, or make the schedules on the destination system the same as the ones from incoming drug file, otherwise, the problems you run into is this (see below for how to investigate the issue):
 * Orders do not calculate frequency correctly if the schedule is not present in the destination system. This means that the proper number of pills cannot be calculated.
 * In Outpatient Pharmacy, Schedules do not expand into patient readable instructions
 * If the National Drug Files are not up to date in the destination system, there will be some broken pointers. All you have to do is update the NDF with the latest patches.
 * If some drugs are linked with lab tests, these need to be re-linked. Preferably, these should be removed prior to transporting the drug file. You can print the Lab-related fields on the Drug File to see if there is data. The fields are:
 * LAB TEST MONITOR field.
 * SPECIMEN TYPE field.
 * CLOZAPINE LAB TEST:LAB TEST MONITOR field
 * CLOZAPINE LAB TEST:SPECIMEN TYPE field

Administration Schedules
To find the current administration schedules in the Pharmacy Orderable Item file, print the unique entries for Schedule like so in Fileman: Select OPTION:   PRINT FILE ENTRIES

OUTPUT FROM WHAT FILE: PHARMACY ORDERABLE ITEM// SORT BY: NUMBER// +SCHEDULE 1  SCHEDULE 2  SCHEDULE TYPE CHOOSE 1-2: 1 SCHEDULE START WITH SCHEDULE: FIRST// WITHIN SCHEDULE, SORT BY: FIRST PRINT FIELD: !.01 NAME THEN PRINT FIELD: Heading (S/C): PHARMACY ORDERABLE ITEM STATISTICS Replace DEVICE: ;;999 (ignore this output)

Select OPTION: other OPTIONS Select OTHER OPTION: statISTICS Select STATISTICAL ROUTINE: 1 DESCRIPTIVE STATISTICS DEVICE: HOME// ;;99 PHARMACY ORDERABLE ITEM FILE: COUNTS                 APR 18,2012    Page 1

SCHEDULE

1 Q3W       1 10 MIN AC   1 15 MIN AC   1 15M AC      1 AC          1 BD          1 BID        24 NOW         1 ONCE        1 PRN         1 Q12H        5 Q3-4H       1 Q3MONTHS    1 Q4-6H       1 Q6          1 Q6H        18 Q8H         1 QAM         1 QD         86 QHS        15 QID         4 QWEEK       1 TID        18 WEEKLY      1 qd          1 Compare the output with the Administration Schedule file output: Select OPTION: print FILE ENTRIES

OUTPUT FROM WHAT FILE: PHARMACY ORDERABLE ITEM// ADMINIST 1  ADMINISTRATION SCHEDULE          (24 entries) 2  ADMINISTRATION SHIFT             (0 entries) 3  ADMINISTRATIVE CERTIFICATIONS    (0 entries) CHOOSE 1-3: 1 ADMINISTRATION SCHEDULE    (24 entries) SORT BY: NAME// START WITH NAME: FIRST// FIRST PRINT FIELD: .01 NAME THEN PRINT FIELD: Heading (S/C): ADMINISTRATION SCHEDULE LIST Replace DEVICE: ;;999 TELNET ADMINISTRATION SCHEDULE LIST                  APR 18,2012  12:29    PAGE 1 NAME

BID MO-WE-FR NOW ONCE Q12H Q2-4H Q24H Q2H Q3H Q4-6H Q4H Q6H Q8H QAC QAM QD QHS QID QOD QPC STAT TID TODAY TOMORROW

To edit Administration Schedules, nagivate to XUCORE > Pharmacy Data Management [PSS MGR] > Standard Schedule Management ... [PSS SCHEDULE MANAGEMENT]

Remarks on Broken Pointers
Because many files point to the Pharmacy Orderable Item and Drug files, you practically cannot use this package on a database that contains patient-specific pharmacy data since all data will be corrupted.

When installing a new drug and pharmacy orderable item file, the following may be broken:
 * For Drug File:
 * LAB TEST MONITOR field.
 * SPECIMEN TYPE field.
 * CLOZAPINE LAB TEST:LAB TEST MONITOR field
 * CLOZAPINE LAB TEST:SPECIMEN TYPE field
 * ATC CANISTER:WARD GROUP FOR CANISTER
 * ACTIVITY LOG:INITIATOR OF ACTIVITY (field not used currently)
 * NDC BY OUTPATIENT SITE:OUTPATIENT SITE
 * IFCAP ITEM NUMBER:ITEM NUMBER (field not used currently)
 * Custom UNIT DOSE MED ROUTE (field not used currently)
 * NATIONAL DRUG FILE ENTRY (if you don't have a recently patched NDF)
 * PSNDF VA PRODUCT NAME ENTRY (if you don't have a recently patched NDF).


 * For Pharmacy Orderable Item File:
 * MEDICATION ROUTES (additions are allowed, not deletions)

The National Drug Files are Standardized. However, a system may be out of date. If you do not have the latest National Drug Files, you have will broken pointers if the source of your drug files has a more recent National Drug File. For best results, the source system and the destination system should be patched up to the latest patch level.

To check for broken pointers, use the VERIFY FIELDs option in Fileman. Here is an example of a drug file from a patched system installed on a system that is not patched:

GTM>D P^DI

VA FileMan 22.0

Select OPTION:   UTILITY FUNCTIONS Select UTILITY OPTION:   VERIFY FIELDS

MODIFY WHAT FILE: DRUG// VERIFY WHICH FIELD:   PSNDF VA PRODUCT NAME ENTRY

DEVICE: HOME//

VERIFY FIELDS REPORT DRUG FILE (#50)                                  APR 16, 2012  12:40    PAGE 1 ---  POINTER (CANNOT CHECK CROSS-REFERENCE)

ENTRY#   GENERIC NAME                  ERROR 148      GUANFACINE 1MG TAB ER         No '21739' in pointed-to File 149      GUANFACINE 2MG TAB ER         No '21740' in pointed-to File 168      LURASIDONE 40MG TAB           No '22028' in pointed-to File 169      LURASIDONE 80MG TAB           No '22030' in pointed-to File 221      LEVONORGESTREL 1.5MG TAB      No '21157' in pointed-to File 450      LIDOCAINE 5% PATCH            No '22004' in pointed-to File 456      NEOMYCIN/POLYMYXIN/BACITRACIN OINT No '21497' in pointed-to File 485      MICONAZOLE 4% VAGINAL CREAM   No '22325' in pointed-to File 585      PALIPERIDONE 234MG INJ SUSP PFSNo '21021' in pointed-to File 586      PALIPERIDONE 156MG INJ SUSP PFSNo '21022' in pointed-to File