`4F„2‡„MSH0\Ec:\tempHL7#7ƒg ÿÿÿÿÿÿÿÿ#7ƒg|~FR#7ƒg^Sÿÿÿÿ#7ƒg&Tÿÿÿÿ ÿHL7MðhéË’Óy»—Ü} n3³MðhéË’Óy»—Ü} n3³Y4F„V6&‡PatientRegisterÿÿÿÿE53TMessagePatientRegister MACHINEIDCODEÿÿÿÿdefaultÿÿÿÿASCIIASCIIvalue = 'MSH' + value .import xml.dom.minidom import time import sys sys.path.append('C:\MySOAPDirectory\SOAPpy-ifw-0.11.4') import SOAPpy def getText(nodelist): rc = "" for node in nodelist: if node.nodeType == node.TEXT_NODE: rc = rc + node.data return rc def getItem(DomMessage, TableName, Index, ColumnName): Table = DomMessage.getElementsByTagName(TableName)[Index] ColumnTag = Table.getElementsByTagName(ColumnName)[0] return getText(ColumnTag.childNodes) # Take the normalized XML (Table-short tags format) # extract the data out of it, # and store it in variables # Initialize minidom for XML parsing InMsg = xml.dom.minidom.parseString(value[3:]) Table = InMsg.getElementsByTagName('Patient')[0] for node in Table.childNodes: if node.nodeType == node.ELEMENT_NODE: if node.localName == "PatientID": PatientID = getItem(InMsg, "Patient", 0, node.localName) elif node.localName == "FirstName": FirstName = getItem(InMsg, "Patient", 0, node.localName) elif node.localName == "LastName": LastName = getItem(InMsg, "Patient", 0, node.localName) output = "The patient ID is: " + PatientID + "\n" output = output + "The patient first name is: " + FirstName + "\n" output = output + "The patient last name is: " + LastName + "\n" #Connecting to SUGAR and using the patient information to create a Lead USERNAME= "myusername" PASSWORD= "mypassword" auth = {'user_name': USERNAME, 'password': PASSWORD, "version": "1.1"} # Url of SugarCRM + soap.php?wsdl SUGAR_URL = 'http://mysugarsite.com/sugarcrm/soap.php?wsdl' sugar = SOAPpy.WSDL.Proxy(SUGAR_URL) session = sugar.login(auth, "foobar") module = "Leads" adata = [{'name': 'first_name', 'value': FirstName}, {'name': 'last_name', 'value': LastName}, {'name': 'account_name', 'value': "iNTERFACEWARE"}] response = sugar.set_entry(session['id'], module, adata) value = output + "\nThis patient information was used to create a Lead in Sugar." ASCIITABLE - Short TagsV$q