The Marriage of VFE, SQL, Visual Studio John W. Fitzgerald, MD Gregory P. Sanders, MD CHUG 2014 Fall Conference GETTING THE DATA YOU CAN’T GET: WHEN MEL JUST ISN’T ENOUGH The Problem . Built in data symbols are powerful but may not provide the data you need MEDS_AFTER() PROB_LIST_CHANGES() ALL_NEW() ….etc . Mldefs.txt may be available to address your needs but are undocumented, difficult to locate, and may not survive version changes. There are tables with no MEL connections . Complex relationships are generally not available Our Approach . Create SQL Centricity data access statements in Visual Studio, Visual Scripts as an .exe . Store in Centricity Client . Pass arguments to the .exe from VFE . Return results from .exe call . Parse the results as required. Non-trivial Set of Skills Required . VFE . Data Symbols . Centricity table structure and relationships . Model solution in Crystal, Access . SQL statement construction . Visual Studio or equivalent . Lots of debugging THE CLIENT . Folder on each local machine . EXE sits in Client folder for easy access . Code is run locally . Client calls EXE and passes its authentication to it . Client has access to network (ie, SQL server) . EXE must be pushed out to all Clients Dataflow: Call & Query Centricity SQL Centricity calls EXE EXE queries SQL Database EXE Dataflow: Compile & Return Centricity SQL EXE returns data to Centricity SQL returns data to EXE EXE Inside the EXE . Capture Passed Data . Compile SQL Statement . Connect to Database . Organize Queried Data . Pass Back to Centricity Capture Passed Data . Output Data . File name and path designated with “ /o “ primer . Input Data . Data passed to EXE from Centricity . Desginated with “ /i “ primer . Separated by spaces Compile SQL Statement . Read-only (SELECT statement) . Specify which columns desired . JOIN tables if necessary . Passed data used in WHERE statement . ORDER BY SELECT Birthdate FROM PatientProfile WHERE PatientID = ‘<passed data>’ SQL for ICD9 Search SELECT CODE, DESCRIPTION FROM ICD9codes WHERE DESCRIPTION Like ‘<data>%’ OR CODE Like ‘<data>%’ ORDER BY CODE, DESCRIPTION 11 SQL for RxPillCount SELECT MEDICATE.DESCRIPTION, MEDICATE.GPI, PRESCRIB.QUANTITY, PRESCRIB.REFILLS, PRESCRIB.CLINICALDATE FROM PatientProfile INNER JOIN MEDICATE ON PatientProfile.PId = PRESCRIB.MID INNER JOIN PRESCRIB ON MEDICATE.MID = PRESCRIB.MID WHERE PatientProfile.PatientID = <data> AND MEDICATE.stopdate = ’12/31/4700’’ ORDER BY MEDICATE.DESCRIPTION, PRESCRIB.CLINICALDATE 12 Connect to Database . SQL connection string . Connect using ADO . Need appropriate credentials in database 13 Organize Queried Data . Open a recordset of data based upon SQL statement . If you are looking for one record: grab the data . If you are looking for a recordset: cycle through the recordset . Format data accordingly add labels choose delimiter 14 Pass Back to Centricity . Create a text file with the formatted data . Write the text file: . use file name provided in “ /o “ variable . this includes the path . Saving the file: . Centricity waiting for file . Centricity opens file and returns contents 15 Advantages . Local Client . fast . return path built in to process . multiple users do not compete for same EXE . Scalable . Put multiple EXEs in Client . Build EXE that accepts “FUNCTION” argument 16 Limitations . Updates . recompile EXE . distribute to all Clients . Hardwired Information . SQL statement . Connection . database location . credentials 17 Resources: Basic VFE Coding Reference Resources: MEL Rosetta Stone MEL: RunTextProcess Resources: Data Dictionary . Data Dictionary for Centricity Data schema Basic database structure List of tables Identifiers, time stamp, various ID conventions Designing reports, linking tables Complete table definitions: columns, type, description Linkages to other tables . Database linking diagrams Resources: Data Dictionary Resources: Table Definition-1 Resources: Table Definition-2 Resources: Table Definition-3 Resources: Linkage Diagram ICD9Code Table Structure Using Access to Model Solution SELECT dbo_ICD9Codes.Code, dbo_ICD9Codes.Description FROM dbo_ICD9Codes WHERE (((dbo_ICD9Codes.Description) Like "*" & [Search String] & "*")); Access Modeling: Results VFE Code: RunTextProcess A Simple Example: Search ICD9 Table by Description A Simple Example: Search ICD9 Table by ICD9 Code VFE Code: Adding Problem Table Relationships: Meds Table Relationships: Meds, Output Rx Pill Count: Table Relationships Pill Count: Data VFE Filtering: Narcotic Pill Count GPI left 4 characters: 6510—hydromorphone, levorphanol, meperidine, codeine, fentanyl, methadone 6520—buprenorphine, nalbuphine, pentazocine 6599—oxycodone-acetaminophen, other combinations VFE Filtering: Narcotic Pill Count Conclusion . Using .exe calls via RunTextProcess() essentially any data can be retrieved from Centricity . Multiple skill sets required . Filter at server or client, balance flexibility vs speed, consider ease of coding, server vs client side . Minimize bandwidth issues . In the argument string, multiple subroutines can be called .
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages39 Page
-
File Size-