Skip to content

Commit

Permalink
Merge pull request #3
Browse files Browse the repository at this point in the history
Security improvement and data update
  • Loading branch information
michael-weinstein authored Dec 2, 2020
2 parents d51366b + 241c9e1 commit a86eedc
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 11 deletions.
2 changes: 1 addition & 1 deletion templateSubmission.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#PatientID,Patient Last Name,Patient First Name,Patient Middle Name,Patient Date of Birth,Patient Sex,Patient Street Address,Patient City,Patient State,Patient Zip,Patient Phone,Provider Last Name,Provider First Name,Provider Middle Name,Provider Street,Provider City,Provider State,Provider Zip,Provider Phone,Specimen ID,Collection Date,Collection Time,Received Date,Received Time,Specimen SNOMED Code,Test LOINC Code,Analysis Date,Analysis Time,Result,Reported Date,Reported Time,Notes,Race,Ethnicity,Accession ID,Test Ordered Date,Test Ordered Time,Test Equipment Code,Test Equipment Description,Test Equipment ID Number,Provider NPI
#1K94U,Weinstein,Andrew,P,8/15/2017,M,17062 Murphy Ave. #1,Irvine,CA,92614,888-882-9682,Rain,Leo,,13842 Tustin East Drive,Tustin,CA,92780,(818) 344-3434,1234567,6/8/2020,0:00,6/8/2020,13:00,258529004,94306-8,6/9/2020,11:00,Negative,6/10/2020,14:00,"Phone is pretty flexible for formatting, just be reasonable. Email address is also an acceptable entry there, if needed. Please stick to mm/dd/yyyy formatting for dates. Having a # at the start of a line will cause that line to be ignored as a comment or header.",unknown,unk,1A2B3C4D5E,6/8/2020,0:00,qPCR,Zymo Research Quick SARS-CoV-2 rRT-PCR Kit,R3011,
1K94U,Weinstein,Andrew,P,8/15/2017,M,17062 Murphy Ave. #1,Irvine,CA,92614,888-882-9682,Rain,Leo,,13842 Tustin East Drive,Tustin,CA,92780,(818) 344-3434,1234567,6/8/2020,0:00,6/8/2020,13:00,258529004,94306-8,6/9/2020,11:00,Negative,6/10/2020,14:00,"Phone is pretty flexible for formatting, just be reasonable. Email address is also an acceptable entry there, if needed. Please stick to mm/dd/yyyy formatting for dates. Having a # at the start of a line will cause that line to be ignored as a comment or header.",unknown,unk,1A2B3C4D5E,6/8/2020,0:00,qPCR,Zymo Research Quick SARS-CoV-2 rRT-PCR Kit,R3011,
1 change: 1 addition & 0 deletions zymoTransmitSupport/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class LabInfo:
phone = configDict.setdefault("lab phone", "")
email = configDict.setdefault("lab email", "")
street = configDict.setdefault("lab street", "")
suite = configDict.setdefault("lab suite", "")
city = configDict.setdefault("lab city", "")
state = configDict.setdefault("lab state", "")
zip = configDict.setdefault("lab zip", "")
Expand Down
1 change: 1 addition & 0 deletions zymoTransmitSupport/configClean.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Lab Name:
Lab Phone:
Lab Email:
Lab Street:
Lab Suite:
Lab City:
Lab State:
Lab Zip:
Expand Down
6 changes: 4 additions & 2 deletions zymoTransmitSupport/hl7Encoder/encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def makeORCLine(result:inputOutput.resultReader.TestResult):
config.LabInfo.street,
config.LabInfo.city,
config.LabInfo.state,
config.LabInfo.zip
config.LabInfo.zip,
otherDesignation=config.LabInfo.suite
)
if "labPhone" in result.auxiliaryData:
orderingFacilityPhone = orderHeader.OrderingFacilityPhone(result.auxiliaryData["labPhone"])
Expand Down Expand Up @@ -303,7 +304,8 @@ def makeObservationValueAndAbnormalityObjects(resultString:str):
config.LabInfo.street,
config.LabInfo.city,
config.LabInfo.state,
config.LabInfo.zip
config.LabInfo.zip,
otherDesignation=config.LabInfo.suite
)
if config.LabDirectorInfo.assigningAuthority:
medicalDirectorAssignmentAuthority = observedResults.MedicalDirectorNumberAssignmentAuthority(
Expand Down
4 changes: 2 additions & 2 deletions zymoTransmitSupport/hl7Encoder/generics.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ class Address(Hl7Field):

defaultAddressType = "H"

def __init__(self, streetAddress:str, city:str, state:str, zip:str, country:str="USA", addressType:str=None):
def __init__(self, streetAddress:str, city:str, state:str, zip:str, country:str="USA", addressType:str=None, otherDesignation:str=""):
self.streetAddress = streetAddress
self.otherDesignation = ""
self.otherDesignation = otherDesignation
self.city = city
self.state = state
self.zip = correctLostLeadingZeroZipcode(zip, state)
Expand Down
8 changes: 4 additions & 4 deletions zymoTransmitSupport/hl7Encoder/observedResults.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ def getAbnormalityObject(result:str):
if not result in validResults:
raise ValueError("Result type must be in: " %validResults)
if result == "detected":
return generics.SystemCode(code="260373001", text="Detected", coding="SNOMED", codingSystemDateOrVersion="2.7")
return generics.SystemCode(code="A", text="Abnormal", coding="HL70078", codingSystemDateOrVersion="2.7")
elif result == "indeterminate":
return generics.SystemCode(code="419984006", text="Inconclusive", coding="SNOMED", codingSystemDateOrVersion="2.7")
return generics.SystemCode(code="A", text="Abnormal", coding="HL70078", codingSystemDateOrVersion="2.7")
elif result == "negative":
return generics.SystemCode(code="260415000", text="Not detected", coding="SNOMED", codingSystemDateOrVersion="2.7")
return generics.SystemCode(code="N", text="Normal", coding="HL70078", codingSystemDateOrVersion="2.7")
elif result == "unsatisfactory":
return generics.SystemCode(code="125154007", text="Specimen unsatisfactory", coding="SNOMED", codingSystemDateOrVersion="2.7")
return generics.SystemCode(code="A", text="Abnormal", coding="HL70078", codingSystemDateOrVersion="2.7")
elif result == "":
return ""
else:
Expand Down
20 changes: 20 additions & 0 deletions zymoTransmitSupport/inputOutput/connection.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
import requests
import os
import zeep
import ssl
import requests.adapters
import requests.packages.urllib3

strongSSLCipherSuiteEnforcement = True
permittedCipherSuites = 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256'
defaultSSLRules = (ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3 | ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1)


class TLSEnforcer(requests.adapters.HTTPAdapter):
def __init__(self, sslRules=defaultSSLRules, **kwargs):
self.sslRules = sslRules
super(TLSEnforcer, self).__init__(**kwargs)

def init_poolmanager(self, *pool_args, **pool_kwargs):
sslSettings = requests.packages.urllib3.util.ssl_.create_urllib3_context(ciphers=permittedCipherSuites, cert_reqs=ssl.CERT_REQUIRED, options=self.sslRules)
self.poolmanager = requests.packages.urllib3.poolmanager.PoolManager(*pool_args, ssl_context=sslSettings, **pool_kwargs)



def getSOAPClient(wsdlURL:str, clientCertificatePath:str=None, dumpClientInfo:bool=False, testOnly:bool=False):
session = requests.Session()
if strongSSLCipherSuiteEnforcement:
session.mount("https://", adapter=TLSEnforcer())
if clientCertificatePath:
if not os.path.isfile(clientCertificatePath):
raise FileNotFoundError("Unable to find client certificate path at %s" %clientCertificatePath)
Expand Down
4 changes: 2 additions & 2 deletions zymoTransmitSupport/supportData.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

softwareVersion = "1.3.0"
softwareVersion = "1.4.0"

softwareDate = "20200805"
softwareDate = "20201201"

0 comments on commit a86eedc

Please sign in to comment.