Skip to content

Commit

Permalink
Now checks for valid SNOMED code in CDPH CSV fields before trying any…
Browse files Browse the repository at this point in the history
…thing else and uses that if present.
  • Loading branch information
michael-weinstein committed Jul 20, 2020
1 parent 2528fff commit bbfec81
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
8 changes: 3 additions & 5 deletions zymoTransmitSupport/hl7Encoder/snomed.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,16 @@ def loadRawDataTable():
dataTable = []
for line in data:
line = [element.strip() for element in line]
if len(line) == 7:
line.append("")
dataTable.append(line)
return dataTable


def makeSnomedTable(data:list):
loincTable = {}
snomedTable = {}
for line in data:
code, fullName, preferredName = line
loincTable[code] = SNOMED(code, fullName, preferredName)
return loincTable
snomedTable[code] = SNOMED(code, fullName, preferredName)
return snomedTable


def makeLookupTables(loincTable:typing.Dict[str, SNOMED]):
Expand Down
21 changes: 21 additions & 0 deletions zymoTransmitSupport/inputOutput/caResultReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ def makeSpecimenRegexes():
swabRegex = re.compile("SWAB", re.IGNORECASE)


def getSnomedList(): # Doing this to avoid circular references and because SNOMED format is not specific enough
inputFileDirectory = os.path.split(os.path.abspath(__file__))[0]
inputFileDirectory = os.path.split(inputFileDirectory)[0]
inputFileDirectory = os.path.split(inputFileDirectory)[0]
inputFile = "snomedSpecimens.txt"
inputPath = os.path.join(inputFileDirectory, inputFile)
data = open(inputPath, 'r').readlines()
data = [line.strip() for line in data if line and not line.startswith("#")]
data = [line.split("\t") for line in data if line]
codeTable = []
for line in data:
line = [element.strip() for element in line]
codeTable.append(line[0])
return codeTable

snomedList = getSnomedList()


class CATestResult(object):
expectedElements = 40

Expand Down Expand Up @@ -263,6 +281,9 @@ def checkFields(regexList:list):
bloodSNOMED = "788707000"
swabNotOtherwiseSpecifiedSNOMED = "257261003"
fields = [self.specimenType, self.specimenSite]
for field in fields:
if field in snomedList:
return field
nasal = checkFields(nasalRegexList)
swab = checkFields([swabRegex])
oral = checkFields(oralRegexList)
Expand Down
2 changes: 1 addition & 1 deletion zymoTransmitSupport/supportData.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

softwareVersion = "1.0.0"
softwareVersion = "1.0.1"

softwareDate = "20200719"

0 comments on commit bbfec81

Please sign in to comment.