diff --git a/templateSubmission.txt b/templateSubmission.txt index 633aa77..34ec5fb 100644 --- a/templateSubmission.txt +++ b/templateSubmission.txt @@ -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 -#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 +#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 +#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 diff --git a/zymoTransmitSupport/hl7Encoder/encoders.py b/zymoTransmitSupport/hl7Encoder/encoders.py index 43d4f0e..8b41674 100644 --- a/zymoTransmitSupport/hl7Encoder/encoders.py +++ b/zymoTransmitSupport/hl7Encoder/encoders.py @@ -67,18 +67,22 @@ def makePIDLine(result:inputOutput.resultReader.TestResult): def makeORCLine(result:inputOutput.resultReader.TestResult): + if result.accession: + orderID = result.accession + else: + orderID = "%s.%s" % (result.patientID, result.specimenID) if "labName" in result.auxiliaryData or "labCLIA" in result.auxiliaryData: if not ("labName" in result.auxiliaryData and "labCLIA" in result.auxiliaryData): raise ValueError("Lab name and lab CLIA must both be either present or absent in auxiliary data") fillerOrderNumber = orderHeader.FillerOrderNumber( - "%s.%s" % (result.patientID, result.specimenID), + orderID, result.auxiliaryData["labName"], result.auxiliaryData["labCLIA"], "CLIA" ) else: fillerOrderNumber = orderHeader.FillerOrderNumber( - "%s.%s" % (result.patientID, result.specimenID), + orderID, config.LabInfo.name, config.LabInfo.clia, "CLIA" @@ -147,18 +151,22 @@ def makeORCLine(result:inputOutput.resultReader.TestResult): def makeOBRLine(result:inputOutput.resultReader.TestResult): + if result.accession: + orderID = result.accession + else: + orderID = "%s.%s" % (result.patientID, result.specimenID) if "labName" in result.auxiliaryData or "labCLIA" in result.auxiliaryData: if not ("labName" in result.auxiliaryData and "labCLIA" in result.auxiliaryData): raise ValueError("Lab name and lab CLIA must both be either present or absent in auxiliary data") fillerOrderNumber = orderRequest.FillerOrderNumber( - "%s.%s" % (result.patientID, result.specimenID), + orderID, result.auxiliaryData["labName"], result.auxiliaryData["labCLIA"], "CLIA" ) else: fillerOrderNumber = orderRequest.FillerOrderNumber( - "%s.%s" % (result.patientID, result.specimenID), + orderID, config.LabInfo.name, config.LabInfo.clia, "CLIA" @@ -305,6 +313,10 @@ def makeObservationValueAndAbnormalityObjects(resultString:str): def makeSPMLine(result:inputOutput.resultReader.TestResult): specimenData = snomed.snomedTable[result.specimenSNOMED] + if result.accession: + orderID = result.accession + else: + orderID = "%s.%s" % (result.patientID, result.specimenID) if "labName" in result.auxiliaryData: assignerName = result.auxiliaryData["labName"] else: @@ -317,14 +329,14 @@ def makeSPMLine(result:inputOutput.resultReader.TestResult): if not ("labName" in result.auxiliaryData and "labCLIA" in result.auxiliaryData): raise ValueError("Lab name and lab CLIA must both be either present or absent in auxiliary data") fillerAssignedIdentifier = specimen.FillerAssignedIdentifier( - "%s.%s" % (result.patientID, result.specimenID), + orderID, result.auxiliaryData["labName"], result.auxiliaryData["labCLIA"], "CLIA" ) else: fillerAssignedIdentifier = specimen.FillerAssignedIdentifier( - "%s.%s" % (result.patientID, result.specimenID), + orderID, config.LabInfo.name, config.LabInfo.clia, "CLIA" diff --git a/zymoTransmitSupport/inputOutput/caResultReader.py b/zymoTransmitSupport/inputOutput/caResultReader.py index da11e10..5240b74 100644 --- a/zymoTransmitSupport/inputOutput/caResultReader.py +++ b/zymoTransmitSupport/inputOutput/caResultReader.py @@ -87,13 +87,6 @@ def __init__(self, rawLine: [str, collections.Iterable], delimiter: str = "\t"): self.resultCode, self.unused ) = self.elementArray - if self.accession: - if self.specimenID: - holder = self.specimenID - self.specimenID = self.accession - self.accession = holder - else: - self.specimenID = self.accession self.patientDateOfBirth = self.processDateAndTime(patientDateOfBirth, "") self.collectionDateTime = self.processDateAndTime(collectionDate, "") self.reportedDateTime = self.processDateAndTime(reportedDateAndTime, "") @@ -348,6 +341,7 @@ def convertToStandardResultObject(self): self.note, self.race, self.ethnicity, + self.accession ] resultObject = resultReader.TestResult(resultArray) auxiliaryData = { diff --git a/zymoTransmitSupport/inputOutput/resultReader.py b/zymoTransmitSupport/inputOutput/resultReader.py index 7451fb8..830bbe1 100644 --- a/zymoTransmitSupport/inputOutput/resultReader.py +++ b/zymoTransmitSupport/inputOutput/resultReader.py @@ -9,7 +9,7 @@ class TestResult(object): - expectedElements = 34 + expectedElements = 35 def __init__(self, rawLine: [str, collections.Iterable], delimiter: str = "\t"): self.rawLine = rawLine @@ -52,6 +52,7 @@ def __init__(self, rawLine: [str, collections.Iterable], delimiter: str = "\t"): self.note, self.race, self.ethnicity, + self.accession ) = self.elementArray self.patientDateOfBirth = self.processDateAndTime(patientDateOfBirth, "") self.collectionDateTime = self.processDateAndTime(collectionDate, collectionTime)