Tanish28 commited on
Commit
358d2c4
·
verified ·
1 Parent(s): 278e5bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +91 -91
app.py CHANGED
@@ -32,98 +32,98 @@ class PDFTextExtractor:
32
  img_base64 = base64.b64encode(img_buffer.getvalue()).decode('utf-8')
33
 
34
  response = self.client.chat.completions.create(
35
- model="gpt-4o",
36
- messages=[
37
- {
38
- "role": "system",
39
- "content": """You are an expert in document processing and OCR with deep knowledge of Markdown formatting.
40
- Extract the Patient Admission Form (KMHIPF002V3) from this image and format it in clean markdown.
41
- Follow this exact markdown structure:
42
 
43
- # PATIENT ADMISSION FORM
44
- ## DR.KAMAKSHI MEMORIAL HOSPITAL, PALLIKARANAI, CHENNAI.
45
-
46
- ### PATIENT PROFILE
47
- *Please paste the sticker within the box*
48
-
49
- * UHID: ______
50
- * Patient Name: ______
51
- * Age/Gender: ______
52
- * Doctor Name: ______
53
-
54
- ### BASIC INFORMATION
55
- * Date & Time of Admission: [DD/MM/YYYY]
56
- * Date of Birth: [DD/MM/YYYY]
57
-
58
- ### IDENTIFICATION
59
- **ID Proof Already Registered**: □ Yes □ No
60
-
61
- **Type of ID**:
62
- * □ Aadhar
63
- * □ Passport
64
- * □ Voter ID
65
- * □ Driving License
66
- * □ Others
67
-
68
- ID No.: ________________
69
- Contact No.: ________________
70
-
71
- ### MEDICAL DETAILS
72
- * Provisional Diagnosis:
73
- * Reason for Admission:
74
- * Plan of Care:
75
- * Expected Outcome*:
76
-
77
- ### CONSULTANT DETAILS
78
- * Primary Consultant Name:
79
- * Speciality:
80
-
81
- ### PATIENT REFERENCE INFORMATION
82
- *(To be filled by Front Office)*
83
-
84
- **Reference Via**:
85
- * □ Doctor
86
- * □ Hospital
87
- * □ Ambulance
88
- * □ DRKMH Employee
89
- * □ Self / Walk In
90
-
91
- **Referrer Details**:
92
- * Name: ________________
93
- * Contact No.: ________________
94
-
95
- ### TYPE OF ADMISSION
96
- * □ Emergency
97
- * □ Elective
98
- * □ MLC
99
- * □ Surgery
100
- * □ Medical
101
- * □ Others: ________________
102
-
103
- ### TREATMENT TYPE
104
- * □ In Patient
105
- * □ Day Care
106
- * Transfer To: ________________
107
-
108
- ### CONTACT DETAILS
109
- **Person to Contact (Next of Kin)**:
110
- * Name: ________________
111
- * Relationship with Patient: ________________
112
- * Address: ________________
113
- * Pincode: ________________
114
- * Mobile: ________________
115
- * Email: ________________
116
-
117
- ### OFFICIAL USE
118
- * Front Office Executive Name:
119
- * Front Office Executive Signature:
120
- * Advance Amount Paid:
121
- * ICD-10 Code (For Medical Records Section):
122
-
123
- *\\* Subject to change during the course of diseases*
124
-
125
- ---
126
- *Form No: KMHIPF002V3*
127
  """
128
  },
129
  {
 
32
  img_base64 = base64.b64encode(img_buffer.getvalue()).decode('utf-8')
33
 
34
  response = self.client.chat.completions.create(
35
+ model="gpt-4o",
36
+ messages=[
37
+ {
38
+ "role": "system",
39
+ "content": """You are an expert in document processing and OCR with deep knowledge of Markdown formatting.
40
+ Extract the Patient Admission Form (KMHIPF002V3) from this image and format it in clean markdown.
41
+ Follow this exact markdown structure:
42
 
43
+ # PATIENT ADMISSION FORM
44
+ ## DR.KAMAKSHI MEMORIAL HOSPITAL, PALLIKARANAI, CHENNAI.
45
+
46
+ ### PATIENT PROFILE
47
+ *Please paste the sticker within the box*
48
+
49
+ * UHID: ______
50
+ * Patient Name: ______
51
+ * Age/Gender: ______
52
+ * Doctor Name: ______
53
+
54
+ ### BASIC INFORMATION
55
+ * Date & Time of Admission: [DD/MM/YYYY]
56
+ * Date of Birth: [DD/MM/YYYY]
57
+
58
+ ### IDENTIFICATION
59
+ **ID Proof Already Registered**: □ Yes □ No
60
+
61
+ **Type of ID**:
62
+ * □ Aadhar
63
+ * □ Passport
64
+ * □ Voter ID
65
+ * □ Driving License
66
+ * □ Others
67
+
68
+ ID No.: ________________
69
+ Contact No.: ________________
70
+
71
+ ### MEDICAL DETAILS
72
+ * Provisional Diagnosis:
73
+ * Reason for Admission:
74
+ * Plan of Care:
75
+ * Expected Outcome*:
76
+
77
+ ### CONSULTANT DETAILS
78
+ * Primary Consultant Name:
79
+ * Speciality:
80
+
81
+ ### PATIENT REFERENCE INFORMATION
82
+ *(To be filled by Front Office)*
83
+
84
+ **Reference Via**:
85
+ * □ Doctor
86
+ * □ Hospital
87
+ * □ Ambulance
88
+ * □ DRKMH Employee
89
+ * □ Self / Walk In
90
+
91
+ **Referrer Details**:
92
+ * Name: ________________
93
+ * Contact No.: ________________
94
+
95
+ ### TYPE OF ADMISSION
96
+ * □ Emergency
97
+ * □ Elective
98
+ * □ MLC
99
+ * □ Surgery
100
+ * □ Medical
101
+ * □ Others: ________________
102
+
103
+ ### TREATMENT TYPE
104
+ * □ In Patient
105
+ * □ Day Care
106
+ * Transfer To: ________________
107
+
108
+ ### CONTACT DETAILS
109
+ **Person to Contact (Next of Kin)**:
110
+ * Name: ________________
111
+ * Relationship with Patient: ________________
112
+ * Address: ________________
113
+ * Pincode: ________________
114
+ * Mobile: ________________
115
+ * Email: ________________
116
+
117
+ ### OFFICIAL USE
118
+ * Front Office Executive Name:
119
+ * Front Office Executive Signature:
120
+ * Advance Amount Paid:
121
+ * ICD-10 Code (For Medical Records Section):
122
+
123
+ *\\* Subject to change during the course of diseases*
124
+
125
+ ---
126
+ *Form No: KMHIPF002V3*
127
  """
128
  },
129
  {