Sakshi commited on
Commit
c18f47f
·
1 Parent(s): ca4343d

added policy document ocr display; changed rules.txt

Browse files
Files changed (2) hide show
  1. app.py +6 -0
  2. policy_analyser/prompts/health/rules.txt +17 -1
app.py CHANGED
@@ -108,9 +108,13 @@ def main():
108
  (item for item in response if item.get("stage") == "SUGGEST"), None
109
  )['response']
110
  suggestion = suggestion.split('<POLICY_PITCH>')[-1].split('</POLICY_PITCH>')[0]
 
 
 
111
  # Store results
112
  all_analyses.append({
113
  'name': uploaded_file.name,
 
114
  'analysis' : analysis,
115
  'suggestion' : suggestion
116
  })
@@ -122,6 +126,8 @@ def main():
122
  with tab1:
123
  for idx, analysis in enumerate(all_analyses):
124
  with st.expander(f"### Policy {idx + 1}: {analysis['name']}"):
 
 
125
  with st.container():
126
  st.markdown(re.sub(r'\<\/?(GOOD|AVERAGE|BAD|FINAL_VERDICT)\>', '', analysis['analysis']))
127
  with st.container():
 
108
  (item for item in response if item.get("stage") == "SUGGEST"), None
109
  )['response']
110
  suggestion = suggestion.split('<POLICY_PITCH>')[-1].split('</POLICY_PITCH>')[0]
111
+ text = next(
112
+ (item for item in response if item.get("stage") == "OCR"), None
113
+ )['response']
114
  # Store results
115
  all_analyses.append({
116
  'name': uploaded_file.name,
117
+ 'text' : text,
118
  'analysis' : analysis,
119
  'suggestion' : suggestion
120
  })
 
126
  with tab1:
127
  for idx, analysis in enumerate(all_analyses):
128
  with st.expander(f"### Policy {idx + 1}: {analysis['name']}"):
129
+ with st.container():
130
+ st.markdown(f'Policy Document : {analysis["text"]}')
131
  with st.container():
132
  st.markdown(re.sub(r'\<\/?(GOOD|AVERAGE|BAD|FINAL_VERDICT)\>', '', analysis['analysis']))
133
  with st.container():
policy_analyser/prompts/health/rules.txt CHANGED
@@ -1,5 +1,21 @@
1
  Extract the following data points from the policy document and apply rules on them:
2
- Parameters : ["Sum Insured", "Adults", "Children", "Insured_Address_City", "Room Rent Limit", "Deductible", "Sublimits", "Copay", "PED Waiting Period", "Thirty Day Waiting Period", "Specific Illness Waiting Period", "Maternity Benefits", "Pre_Post_Hospitalization", "Daycare_Procedures", "Restoration_Benefit", "Preventive_Annual_Health_Checkup", "Ambulance_Cover"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  IF Insured_Address_City in Top_Cities:
5
  Is_Top_City = true
 
1
  Extract the following data points from the policy document and apply rules on them:
2
+ - "Sum Insured" : Sum insured in policy
3
+ - "Adults" : no. of adults covered in policy
4
+ - "Children" : no. of children covered in policy
5
+ - "Insured_Address_City" : Insured person city of residence
6
+ - "Room Rent Limit" : limit on hospital room rent
7
+ - "Deductible" : deductible in policy
8
+ - "Sublimits" : Sublimit or amount caps on different diseases
9
+ - "Copay" : copayment
10
+ - "PED Waiting Period" : Waiting period on pre-existing diseases
11
+ - "Thirty Day Waiting Period" : 30-day waiting period
12
+ - "Specific Illness Waiting Period" : waiting period on specific illnesses/diseases
13
+ - "Maternity Benefits" : benefits on maternity illnesses or cases
14
+ - "Pre_Post_Hospitalization" : pre & pos-hospitalization benefits
15
+ - "Daycare_Procedures" : if daycare procedures & treatments are covered
16
+ - "Restoration_Benefit" : if sum insured is restored after it gets exhausted
17
+ - "Preventive_Annual_Health_Checkup" : if free annual health checkup is covered
18
+ - "Ambulance_Cover" : cover on ambulance charges of hospitalization
19
 
20
  IF Insured_Address_City in Top_Cities:
21
  Is_Top_City = true