I am attempting to write an ICD10 CM program look up using an ICD text file saved on my computer. I need to input the icd 10 code and have the program print a text description of the code. However, when I ran my code, the description doesn’t match my code. I have tried writing my program using regular expressions.#ICD-10-CM PROGRAM LOOK UP
`pattern=""
import re
regex=re.compile(pattern)
infile=open("icd10cm.txt", "r")
#patient_icd10= input("Please enter the ICD-10 code or diagnosis: ")
#pattern=patient_icd10
code=[]
description=[]
code_key_dict = {}
desc_key_dict = {}
infile.readline()
for line in infile:
line=line.strip()
elements=line.split("\t")
#elements[0]=elements[1]
code=elements[0]
description=elements[1]
code=input("Please enter the ICD-10 code or diagnosis: ")
print(description)
for X in infile:
description=code_key_dict.get(X)
code=desc_key_dict.get(X)
if re.search(patient_icd10, code):
print(description)
if re.search(patient_icd10,description):
print(code)
infile.close()