def simpleSetup2(): try: print "Connecting to MUMPS roll n scroll ..." VistA = ConnectToMUMPS(LOGFILE) except: print "EXIT_PYS_CANT_CONNECT_TO_MUMPS" return # NB: simpleSetup and postImportSetupBasics should go too try: print "Now setting up Users (signatures only now) ..." postImportSetupUsers(VistA) except Exception as e: print "EXIT_PYS_PROBLEM_SETTING_USERS_BUT_GOING_ON" VistA = ConnectToMUMPS(LOGFILE) try: print "Now setting up Patients ..." # have to reset VistA as Signature Setup halts from VISTA time.sleep(10) VistA = ConnectToMUMPS(LOGFILE) # reset up VISTA postImportSetupPatients(VistA) except: print "EXIT_PYS_CANT_SETUP_PATIENTS" return print "Setup User, Patient ... Complete OK"
def connect_VistA(testname, result_dir, namespace): ''' This method is used to establish the connection to VistA via ConnectToMUMPS''' logging.debug('Connect_VistA' + ', Namespace: ' + namespace) from OSEHRAHelper import ConnectToMUMPS, PROMPT VistA = ConnectToMUMPS(logfile=result_dir + '/' + timeStamped(testname + '.txt'), instance='', namespace=namespace) if VistA.type == 'cache': try: VistA.ZN(namespace) except IndexError, no_namechange: pass
def simpleSetup(): try: print "Connecting to MUMPS roll n scroll ..." VistA = ConnectToMUMPS(LOGFILE) except: print "EXIT_PYS_CANT_CONNECT_TO_MUMPS" return try: print "Setting up basics ..." postImportSetupBasics(VistA) except: print "EXIT_PYS_CANT_SETUP_BASICS" return try: print "Now setting up Users ..." postImportSetupUsers(VistA) except Exception as e: print "EXIT_PYS_PROBLEM_SETTING_USERS_BUT_GOING_ON" VistA = ConnectToMUMPS(LOGFILE) try: print "Now setting up Patients ..." # have to reset VistA as Signature Setup halts from VISTA time.sleep(10) VistA = ConnectToMUMPS(LOGFILE) # reset up VISTA postImportSetupPatients(VistA) except: print "EXIT_PYS_CANT_SETUP_PATIENTS" return try: print "Finally complete PARAMETER setup (VITALs/CAPRI) ..." time.sleep(10) VistA = ConnectToMUMPS(LOGFILE) # reset up VISTA completeVitalsSetup(VistA) except Exception as e: print "EXIT_PYS_CANT_COMPLETE_PARAMETER_SETUP" return print "OK"
def connect_VistA(self, test_suite_details): ''' Generic method to connect to VistA. Inteded to be reused by the ATF Recorder. ''' if test_suite_details.remote_conn_details: location = test_suite_details.remote_conn_details.remote_address else: location = '127.0.0.1' from OSEHRAHelper import ConnectToMUMPS, PROMPT VistA = ConnectToMUMPS(logfile=test_suite_details.result_dir + '/' + self.testname + '.txt', instance=test_suite_details.instance, namespace=test_suite_details.namespace, location=location, remote_conn_details=test_suite_details.remote_conn_details) if not test_suite_details.remote_conn_details or not test_suite_details.remote_conn_details.default_namespace: try: VistA.ZN(VistA.namespace) except IndexError, no_namechange: pass VistA.wait(PROMPT)
def connect_VistA(self, test_suite_details): ''' Generic method to connect to VistA. Intended to be used by the ATF Recorder. ''' if test_suite_details.remote_conn_details: location = test_suite_details.remote_conn_details.remote_address else: location = '127.0.0.1' from OSEHRAHelper import ConnectToMUMPS, PROMPT try: VistA = ConnectToMUMPS(logfile=test_suite_details.result_dir + '/' + self.testname + '.txt', instance=test_suite_details.instance, namespace=test_suite_details.namespace, location=location, remote_conn_details=test_suite_details.remote_conn_details) except ImportError as ex: print ex raise if VistA.type is not None and VistA.type =='cache' and test_suite_details.namespace != '': try: VistA.ZN(test_suite_details.namespace) except IndexError, no_namechange: pass VistA.wait(PROMPT)
def connect_VistA(self, test_suite_details): ''' Generic method to connect to VistA. Inteded to be reused by the ATF Recorder. ''' if test_suite_details.remote_conn_details: location = test_suite_details.remote_conn_details.remote_address else: location = '127.0.0.1' from OSEHRAHelper import ConnectToMUMPS, PROMPT VistA = ConnectToMUMPS( logfile=test_suite_details.result_dir + '/' + self.testname + '.txt', instance=test_suite_details.instance, namespace=test_suite_details.namespace, location=location, remote_conn_details=test_suite_details.remote_conn_details) if not test_suite_details.remote_conn_details or not test_suite_details.remote_conn_details.default_namespace: try: VistA.ZN(VistA.namespace) except IndexError, no_namechange: pass VistA.wait(PROMPT)
def simpleSetup(): try: print "Platform", sys.platform, "GT.M MUMPS VM", os.getenv( 'gtm_dist'), "GTM Prompt", os.getenv("gtm_prompt") print "Connecting to MUMPS roll n scroll ..." # change to get from env: os.getenv('gtm_dist') VistA = ConnectToMUMPS(LOGFILE) except Exception as e: print e print "EXIT_PYS_CANT_CONNECT_TO_MUMPS" return try: print "Setting up basics ..." postImportSetupBasics(VistA) except Exception as e: print e print "EXIT_PYS_CANT_SETUP_BASICS" return print "Setup1 COMPLETE OK"
import sys sys.path = [sys.argv[7] + '/lib/vista'] + sys.path from OSEHRAHelper import ConnectToMUMPS, PROMPT VistA = ConnectToMUMPS(sys.argv[1], sys.argv[3], sys.argv[4]) if (sys.argv[5] and sys.argv[6]): VistA.login(sys.argv[5], sys.argv[6]) if VistA.type == 'cache': try: VistA.ZN(sys.argv[4]) except IndexError, no_namechange: pass VistA.wait(PROMPT) VistA.write('K ^XUTL("XQ",$J)') VistA.write('D ^XINDEX') if VistA.type == 'cache': VistA.wait('No =>') VistA.write('No') arglist = sys.argv[2].split(',') for routine in arglist: VistA.wait('Routine:') VistA.write(routine) VistA.wait('Routine:') VistA.write('') selectionList = [ 'Select BUILD NAME:', 'Select INSTALL NAME:', 'Select PACKAGE NAME:' ] while True: index = VistA.multiwait(selectionList) VistA.write('')
import sys, os sys.path = [sys.argv[7] + "/lib/vista"] + sys.path from OSEHRAHelper import ConnectToMUMPS, PROMPT VistA = ConnectToMUMPS(sys.argv[1], sys.argv[3], sys.argv[4]) if sys.argv[5] and sys.argv[6]: VistA.login(sys.argv[5], sys.argv[6]) if VistA.type == "cache": try: VistA.ZN(sys.argv[4]) except IndexError, no_namechange: pass if sys.argv[8] == "ON": VistA.wait(PROMPT) VistA.startCoverage() VistA.wait(PROMPT) VistA.write('K ^XUTL("XQ",$J)') VistA.write("D ^XINDEX") if VistA.type == "cache": VistA.wait("No =>") VistA.write("No") arglist = sys.argv[2].split(",") for routine in arglist: VistA.wait("Routine:") VistA.write(routine) VistA.wait("Routine:") VistA.write("") selectionList = ["Select BUILD NAME:", "Select INSTALL NAME:", "Select PACKAGE NAME:"] while True:
def postImportSetupUsers(VistA): """ Setup Users - paired down in v1.2. Now only resetting signatures. """ # Required to add Patient, User etc OSEHRASetup.addSystemManager(VistA) # Open FileMan and create the VistA Health Care institution OSEHRASetup.addInstitution(VistA, "VISTA HEALTH CARE", "999") # Create the Medical Center Division of # the VistA Health Care institution OSEHRASetup.addDivision(VistA, 'VISTA MEDICAL CENTER', "6101", "999") # The Sikuli test for CPRS orders a Streptozyme test for the patient # This information ensures the test can be ordered at the VistA Health care # Facility OSEHRASetup.setupStrepTest(VistA) OSEHRASetup.signonZU(VistA, "SM1234", "SM1234!!") """ Note that these verifies are temporary - VISTA forces a reset which is done as part of the electronic signature setups below. It's the reset signature that will be used from now on """ OSEHRASetup.addDoctor(VistA, "ALEXANDER,ROBERT", "RA", "000000029", "M", "fakedoc1", "2Doc!@#$") #Enter the Nurse Mary Smith OSEHRASetup.addNurse(VistA, 'SMITH,MARY', 'MS', '000000030', 'F', 'fakenurse1', '2Nur!@#$') # Add a clerk user with permissions for Problem List Data entry OSEHRASetup.addClerk(VistA, "CLERK,JOE", "JC", "000000112", "M", "fakeclerk1", "2Cle!@#$") # Add a Pharmacist OSEHRASetup.addPharmacist(VistA, "SHARMA,FRED", "FS", "000000031", "M", "fakepharma1", "2Pha!@#$") #Create a new Order Menu OSEHRASetup.createOrderMenu(VistA) #Give all users of the instance permission to mark allergies as "Entered in error') OSEHRASetup.addAllergiesPermission(VistA) #Give Mary Smith permission to create shared templates OSEHRASetup.addTemplatePermission(VistA, "MS") # Add clinic via the XUP menu to allow scheduling OSEHRASetup.createClinic(VistA, 'VISTA HEALTH CARE', 'VHC', 'M') """ The sleep and ConnectToMUMPS is needed as createClinic has halted and setup signature does a similar thing. Could debug and stop the halts but as replacing with JS, not worth it. Same "logic" is in OSEHRA's PostImportSetupScript.py """ time.sleep(10) VistA = ConnectToMUMPS(LOGFILE) #Set up the Doctors electronic signature OSEHRASetup.setupElectronicSignature(VistA, "fakedoc1", '2Doc!@#$', '1Doc!@#$', 'ROBA123') VistA = ConnectToMUMPS(LOGFILE) # #Set up the Nurse electronic signature OSEHRASetup.setupElectronicSignature(VistA, "fakenurse1", "2Nur!@#$", "1Nur!@#$", "MARYS123") VistA = ConnectToMUMPS(LOGFILE) # #Set up the Clerk verification code OSEHRASetup.setupElectronicSignature(VistA, "fakeclerk1", "2Cle!@#$", "1Cle!@#$", "CLERKJ123")
VistA.write(self.cdate[day]) VistA.wait('TIME:') VistA.write(self.ctime) VistA.wait('SLOTS:') VistA.write(self.cslots) VistA.wait('TIME:') VistA.write('') VistA.wait('INDEFINITELY') VistA.write('Yes') VistA.wait('DATE:') VistA.write('') VistA.wait('NAME:') VistA.write('') VistA = ConnectToMUMPS("./VistA/bin/Testing/Log/ClinicSetup.log", "CACHE", "VISTA") if ('' and ''): VistA.login('', '') if VistA.type == 'cache': try: VistA.ZN('VISTA') except IndexError, no_namechange: pass VistA.wait(PROMPT, 60) ''' (cname, cabr, cstarttime, ctime, cdate, cslots, cservice, ctype, cxray, cprofiles, ccico, cproviders, cdiagnosisICD10,cdiagnosis, cvarlen, cstopcode):''' Clinic('Clinic1', 'C1', '0', '0000-0800', ['t', 't+1', 't+2', 't+3', 't+4', 't+5', 't+6', 't+7'], '16', 'Medicine', 'Regular', 'Yes', '', 'YES', ['Alexander'], '', '', '', 'Cardiology').setup(VistA)
def postImportSetupUsers(VistA): """ The following is the second half of 'postImportSetupScript' and is more about providers and patients but has some PARAMETER settings too TODO: split out PARAMETER settings and move above. Then make doctor/nurse etc setups a separate User Setup pass """ # The Sikuli test for CPRS orders a Streptozyme test for the patient # This information ensures the test can be ordered at the VistA Health care # Facility OSEHRASetup.setupStrepTest(VistA) OSEHRASetup.signonZU(VistA, "SM1234", "SM1234!!") """ Note that these verifies are temporary - VISTA forces a reset which is done as part of the electronic signature setups below. It's the reset signature that will be used from now on """ OSEHRASetup.addDoctor(VistA, "ALEXANDER,ROBERT", "RA", "000000029", "M", "fakedoc1", "2Doc!@#$") #Enter the Nurse Mary Smith OSEHRASetup.addNurse(VistA, 'SMITH,MARY', 'MS', '000000030', 'F', 'fakenurse1', '2Nur!@#$') # Add a clerk user with permissions for Problem List Data entry OSEHRASetup.addClerk(VistA, "CLERK,JOE", "JC", "000000112", "M", "fakeclerk1", "2Cle!@#$") #Create a new Order Menu OSEHRASetup.createOrderMenu(VistA) #Give all users of the instance permission to mark allergies as "Entered in error') OSEHRASetup.addAllergiesPermission(VistA) #Give Mary Smith permission to create shared templates OSEHRASetup.addTemplatePermission(VistA, "MS") # Add clinic via the XUP menu to allow scheduling OSEHRASetup.createClinic(VistA, 'VISTA HEALTH CARE', 'VHC', 'M') """ The sleep and ConnectToMUMPS is needed as createClinic has halted and setup signature does a similar thing. Could debug and stop the halts but as replacing with JS, not worth it. Same "logic" is in OSEHRA's PostImportSetupScript.py """ time.sleep(10) VistA = ConnectToMUMPS(LOGFILE) #Set up the Doctors electronic signature OSEHRASetup.setupElectronicSignature(VistA, "fakedoc1", '2Doc!@#$', '1Doc!@#$', 'ROBA123') VistA = ConnectToMUMPS(LOGFILE) #Set up the Nurse electronic signature OSEHRASetup.setupElectronicSignature(VistA, "fakenurse1", "2Nur!@#$", "1Nur!@#$", "MARYS123") VistA = ConnectToMUMPS(LOGFILE) #Set up the Clerk verification code OSEHRASetup.setupElectronicSignature(VistA, "fakeclerk1", "2Cle!@#$", "1Cle!@#$", "CLERKJ123")
VistA.wait('SLOTS:') VistA.write(self.cslots) VistA.wait('TIME:') VistA.write('') VistA.wait('INDEFINITELY') VistA.write('Yes') VistA.wait('DATE:') VistA.write('') VistA.wait('NAME:') VistA.write('') LOGFILE = '/home/nodevista/log/importClinicSetup.txt' print "Connecting to MUMPS roll n scroll for clinic ..." VistA = ConnectToMUMPS(LOGFILE) VistA.wait(PROMPT, 60) ''' (cname, cabr, cstarttime, ctime, cdate, cslots, cservice, ctype, cxray, cprofiles, ccico, cproviders, cdiagnosisICD10,cdiagnosis, cvarlen, cstopcode):''' Clinic('Clinic1', 'C1', '0', '0000-0800', ['t', 't+1', 't+2', 't+3', 't+4', 't+5', 't+6', 't+7'], '16', 'Medicine', 'Regular', 'Yes', '', 'YES', ['Alexander'], '', '', '', 'Cardiology').setup(VistA) Clinic('Clinic2', 'C2', '8', '0800-1600', ['t', 't+1', 't+2', 't+3', 't+4', 't+5', 't+6', 't+7'], '16', 'Medicine', 'Regular', 'Yes', '', 'YES', ['Alexander'], '', '', '', 'Cardiology').setup(VistA) Clinic('CLINICX', 'CX', '16', '1600-2400',
import sys,os sys.path = [sys.argv[7] + '/Python/vista'] + sys.path from OSEHRAHelper import ConnectToMUMPS,PROMPT VistA=ConnectToMUMPS(sys.argv[1],sys.argv[3],sys.argv[4]) if (sys.argv[5] and sys.argv[6]): VistA.login(sys.argv[5],sys.argv[6]) if VistA.type=='cache': try: VistA.ZN(sys.argv[4]) except IndexError,no_namechange: pass if sys.argv[8]=='ON': VistA.wait(PROMPT) VistA.startCoverage() VistA.wait(PROMPT) VistA.write('K ^XUTL("XQ",$J)') VistA.write('D ^XINDEX') if VistA.type == 'cache': VistA.wait('No =>') VistA.write('No') arglist = sys.argv[2].split(',') for routine in arglist: VistA.wait('Routine:') VistA.write(routine) VistA.wait('Routine:') VistA.write('') selectionList = ['Select BUILD NAME:', 'Select INSTALL NAME:', 'Select PACKAGE NAME:']
def ZTMGRSET(): VistA = ConnectToMUMPS(LOGFILE) VistA.wait(PROMPT) VistA.write('D ^ZTMGRSET') while True: index = VistA.multiwait(['Should I continue?', 'System:']) if index == 0: VistA.write('YES') continue if index == 1: break # After choosing GTM (8), will see: # 'I will now rename a group of routines specific to your operating system VistA.write('8') # MANAGER's VistA.wait('NAME OF') VistA.write(TEST_VISTA_SETUP_UCI_NAME + "," + TEST_VISTA_SETUP_VOLUME_SET) # PRODUCTION SIGN ON VistA.wait('PRODUCTION') VistA.write(TEST_VISTA_SETUP_UCI_NAME + "," + TEST_VISTA_SETUP_VOLUME_SET) # VOLUME SET must match one used in PRODUCTION VistA.wait('NAME OF') VistA.write(TEST_VISTA_SETUP_VOLUME_SET) # Accept /tmp VistA.wait('The temp directory for the system') VistA.write('') # last step - Now to load routines common to all systems. VistA.wait('Want to rename the FileMan routines: No//') VistA.write('YES') VistA.wait(PROMPT, 200)
def connect_VistA(self, test_suite_details): """ Generic method to connect to VistA. Intended to be used by the ATF Recorder. """ if test_suite_details.remote_conn_details: location = test_suite_details.remote_conn_details.remote_address else: location = "127.0.0.1" from OSEHRAHelper import ConnectToMUMPS, PROMPT try: VistA = ConnectToMUMPS( logfile=test_suite_details.result_dir + "/" + self.testname + ".txt", instance=test_suite_details.instance, namespace=test_suite_details.namespace, location=location, remote_conn_details=test_suite_details.remote_conn_details, ) except ImportError as ex: print ex raise if test_suite_details.username != "": test_suite_details.password = os.getenv("CACHE_PASSWORD", "") VistA.wait("Username") VistA.write(test_suite_details.username) VistA.wait("Password") VistA.write(test_suite_details.password) if VistA.type is not None and VistA.type == "cache" and test_suite_details.namespace != "": try: VistA.ZN(test_suite_details.namespace) except IndexError, no_namechange: pass VistA.wait(PROMPT)
def connect_VistA(self, test_suite_details): ''' Generic method to connect to VistA. Intended to be used by the ATF Recorder. ''' if test_suite_details.remote_conn_details: location = test_suite_details.remote_conn_details.remote_address else: location = '127.0.0.1' from OSEHRAHelper import ConnectToMUMPS, PROMPT try: VistA = ConnectToMUMPS( logfile=test_suite_details.result_dir + '/' + self.testname + '.txt', instance=test_suite_details.instance, namespace=test_suite_details.namespace, location=location, remote_conn_details=test_suite_details.remote_conn_details) except ImportError as ex: print ex raise if test_suite_details.username != '': test_suite_details.password = os.getenv('CACHE_PASSWORD', '') VistA.wait("Username") VistA.write(test_suite_details.username) VistA.wait("Password") VistA.write(test_suite_details.password) if VistA.type is not None and VistA.type == 'cache' and test_suite_details.namespace != '': try: VistA.ZN(test_suite_details.namespace) except IndexError, no_namechange: pass VistA.wait(PROMPT)
## ''' This script sets up VistA after the Routines and Globals import is complete @copyright The Open Source Electronic Health Record Agent @license http://www.apache.org/licenses/LICENSE-2.0 ''' import sys sys.path = ['/vagrant/VistA/Python/vista'] + sys.path import os import time import OSEHRASetup from OSEHRAHelper import ConnectToMUMPS, PROMPT VistA = ConnectToMUMPS("./VistA/bin/Testing/Log/PostImport1.log", "CACHE", "VISTA") if ('' and ''): VistA.login('', '') if VistA.type == 'cache': try: VistA.ZN('VISTA') except IndexError, no_namechange: pass VistA.wait(PROMPT, 60) #--------------------------------------------------------------------- #- SECTION TO SETUP DEMO VistA SITE - #--------------------------------------------------------------------- #Initialize FileMan # Pass a site name from CMake and have a default site name of 6161
sys.path = ['/vagrant/VistA/Python/vista' ] + ['/vagrant/VistA/Testing/Functional/RAS/lib'] + sys.path from PATActions import PATActions import datetime import TestHelper import sys resfile = './VistA/bin/Testing/Log/importPAT_results.txt' resultlog = file(resfile, 'w') logging.basicConfig( level=logging.INFO, #filename='debug.log', #format='%(asctime)s %(levelname)s: %(message)s', datefmt='%Y-%m-%d %H:%M:%S') try: from OSEHRAHelper import ConnectToMUMPS, PROMPT VistA = ConnectToMUMPS('./VistA/bin/Testing/Log/importPats_details.txt', 'CACHE', 'VISTA') if ('' and ''): VistA.login('', '') if VistA.type == 'cache': try: VistA.ZN('VISTA') except IndexError, no_namechange: pass VistA.wait(PROMPT) pat = PATActions(VistA) pat.signon() pat.patientaddallcsv( '/vagrant/VistA/Testing/Functional/dataFiles/patdata0.csv') except TestHelper.TestError, e: resultlog.write(e.value) logging.error('*****exception*********')