MariiaRazno commited on
Commit
724157a
1 Parent(s): 4c0bf97

ICD prediction based on found dia

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -30,7 +30,7 @@ def text_preparation(text):
30
  return text
31
 
32
  def prompt_creation_icd(clean_text):
33
- prompt = ' Exctract ICD-10 codes from this text:\n'+clean_text+'.\n'
34
  return prompt
35
 
36
  def prompt_creation_dia(clean_text):
@@ -39,11 +39,12 @@ def prompt_creation_dia(clean_text):
39
 
40
  def get_result(text):
41
  clean_text = text_preparation(text)
42
- prompt_icd = prompt_creation_icd(clean_text)
43
  prompt_dia = prompt_creation_dia(clean_text)
44
  try:
45
- response_icd = GPT_answer(prompt_icd)
46
  response_dia = GPT_answer(prompt_dia)
 
 
 
47
  answer = 'ICD-10 CODES:\n'+re.sub('\n', '', response_icd)+'\n\nFound DIAGNOSES:\n'+re.sub('\n', '', response_dia)
48
  return answer
49
  except openai.error.InvalidRequestError as e:
 
30
  return text
31
 
32
  def prompt_creation_icd(clean_text):
33
+ prompt = ' What are ICD-10 codes for these diagnoses:\n'+clean_text+'.\n'
34
  return prompt
35
 
36
  def prompt_creation_dia(clean_text):
 
39
 
40
  def get_result(text):
41
  clean_text = text_preparation(text)
 
42
  prompt_dia = prompt_creation_dia(clean_text)
43
  try:
 
44
  response_dia = GPT_answer(prompt_dia)
45
+ #creating ICD codes based on found diagnoses
46
+ prompt_icd = prompt_creation_icd(response_dia)
47
+ response_icd = GPT_answer(prompt_icd)
48
  answer = 'ICD-10 CODES:\n'+re.sub('\n', '', response_icd)+'\n\nFound DIAGNOSES:\n'+re.sub('\n', '', response_dia)
49
  return answer
50
  except openai.error.InvalidRequestError as e: