Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,10 +2,9 @@ import streamlit as st
|
|
2 |
from process import process,process_using_llm
|
3 |
import os
|
4 |
import shutil
|
5 |
-
TEMP_DIR = "temp_files"
|
6 |
-
|
7 |
import PyPDF2
|
8 |
|
|
|
9 |
st.set_page_config(layout="wide",page_title="KYC Doc AI")
|
10 |
|
11 |
def cleanup_temp_files():
|
@@ -18,7 +17,6 @@ def cleanup_temp_files():
|
|
18 |
os.makedirs(TEMP_DIR)
|
19 |
except Exception as e:
|
20 |
print(f"An error occurred during cleanup: {e}")
|
21 |
-
|
22 |
def extract_pages(input_pdf_path, output_pdf_path, start_page=None, end_page=None):
|
23 |
try:
|
24 |
# Open the PDF file
|
@@ -88,15 +86,25 @@ def merge_dicts_by_aadhaar(data):
|
|
88 |
|
89 |
def process_uploads(uploaded_files):
|
90 |
try:
|
91 |
-
company_name=
|
92 |
-
company_name_legal=
|
93 |
-
company_trade_name=
|
94 |
-
gst_number=
|
95 |
-
pan_number_company=
|
96 |
-
coi_number=
|
97 |
director_names=[]
|
98 |
-
|
99 |
extracted_results={}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
if not os.path.exists(TEMP_DIR):
|
101 |
os.makedirs(TEMP_DIR)
|
102 |
|
@@ -147,7 +155,7 @@ def process_uploads(uploaded_files):
|
|
147 |
if name not in director_names:
|
148 |
director_names.append(name)
|
149 |
extracted_results["Aadhaar Cards of Directors"]=director_aadhars_data_new
|
150 |
-
|
151 |
|
152 |
|
153 |
gst_cert=uploaded_files.get('gst_certificate',None)
|
@@ -160,38 +168,19 @@ def process_uploads(uploaded_files):
|
|
160 |
content = ""
|
161 |
for page_num, text in ocr_data.items():
|
162 |
content += text + '\n'
|
163 |
-
|
164 |
-
if "Legal Name" in
|
165 |
-
company_name_legal=
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
if "Registration Number" in dict:
|
172 |
-
gst_number=dict.get('Registration Number')
|
173 |
-
|
174 |
-
if "Names of directors" in dict:
|
175 |
-
gst_director_names = dict.get("Names of directors", [])
|
176 |
-
dict["Names of directors"]=",".join(gst_director_names)
|
177 |
-
missing_directors = []
|
178 |
-
gst_director_names_lower = [name.strip().lower() for name in gst_director_names]
|
179 |
-
for direc_name in director_names:
|
180 |
-
if direc_name not in gst_director_names_lower:
|
181 |
-
missing_directors.append(direc_name)
|
182 |
|
183 |
-
|
184 |
-
|
185 |
|
186 |
-
else:
|
187 |
-
# List missing director names in red
|
188 |
-
missing_directors_text = ', '.join(
|
189 |
-
[f"<span style='color: red;'>{name}</span>" for name in missing_directors])
|
190 |
-
dict[
|
191 |
-
"All director names present?"] = f"<span style='color: red;'><strong>No</strong></span> (Missing: {missing_directors_text})"
|
192 |
|
193 |
|
194 |
-
extracted_results['GST Certificate Details']=dict
|
195 |
|
196 |
company_pan = uploaded_files.get('company_pan',None)
|
197 |
if company_pan:
|
@@ -203,16 +192,16 @@ def process_uploads(uploaded_files):
|
|
203 |
content = ""
|
204 |
for page_num, text in ocr_data.items():
|
205 |
content += text + '\n'
|
206 |
-
|
207 |
-
if "Company Name" in
|
208 |
-
name=
|
209 |
-
|
210 |
-
|
211 |
-
|
|
|
|
|
|
|
212 |
|
213 |
-
if "PAN Number" in dict:
|
214 |
-
pan_number_company=dict.get('PAN Number').strip()
|
215 |
-
extracted_results['Company PAN Details']=dict
|
216 |
|
217 |
coi = uploaded_files.get('coi',None)
|
218 |
if coi:
|
@@ -224,25 +213,22 @@ def process_uploads(uploaded_files):
|
|
224 |
content = ""
|
225 |
for page_num, text in ocr_data.items():
|
226 |
content += text + '\n'
|
227 |
-
|
228 |
-
if "Company Name" in
|
229 |
-
name=
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
|
|
|
|
|
|
|
|
|
|
235 |
|
236 |
-
if "PAN Number" in dict and dict.get('PAN Number','').strip()==pan_number_company:
|
237 |
-
dict['Is Company PAN Number Matching']="Yes"
|
238 |
-
elif "PAN Number" in dict and dict.get('PAN Number','').strip()!=pan_number_company:
|
239 |
-
dict['Is Company PAN Number Matching'] = "No"
|
240 |
|
241 |
-
if "Corporate Identity Number" in dict:
|
242 |
-
coi_number=dict.get("Corporate Identity Number").strip()
|
243 |
|
244 |
-
extracted_results['COI Details']=dict
|
245 |
-
print(dict)
|
246 |
|
247 |
aoa = uploaded_files.get('aoa',None)
|
248 |
if aoa:
|
@@ -257,19 +243,13 @@ def process_uploads(uploaded_files):
|
|
257 |
for page_num, text in ocr_data.items():
|
258 |
content += text + '\n'
|
259 |
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
dict['Is Company Matching'] = "No"
|
268 |
-
if "Share Holders" in dict:
|
269 |
-
share_holders=dict.get("Share Holders",[])
|
270 |
-
dict["Share Holders"]=",".join(share_holders)
|
271 |
-
extracted_results['AOA Details']=dict
|
272 |
-
print(dict)
|
273 |
|
274 |
moa = uploaded_files.get('moa',None)
|
275 |
if moa:
|
@@ -284,19 +264,13 @@ def process_uploads(uploaded_files):
|
|
284 |
for page_num, text in ocr_data.items():
|
285 |
content += text + '\n'
|
286 |
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
dict['Is Company Matching'] = "No"
|
295 |
-
if "Share Holders" in dict:
|
296 |
-
share_holders=dict.get("Share Holders",[])
|
297 |
-
dict["Share Holders"]=",".join(share_holders)
|
298 |
-
extracted_results['MOA Details']=dict
|
299 |
-
print(dict)
|
300 |
|
301 |
|
302 |
share=uploaded_files.get('share',None)
|
@@ -312,28 +286,18 @@ def process_uploads(uploaded_files):
|
|
312 |
for page_num, text in ocr_data.items():
|
313 |
content += text + '\n'
|
314 |
|
315 |
-
|
316 |
-
if "Company Name" in dict:
|
317 |
-
name=dict.get("Company Name").strip()
|
318 |
-
if name==company_trade_name or name == company_name_legal or name==company_name:
|
319 |
-
dict['Is Company Matching']="Yes"
|
320 |
-
company_name=name
|
321 |
-
else:
|
322 |
-
dict['Is Company Matching'] = "No"
|
323 |
|
324 |
|
|
|
|
|
|
|
325 |
|
326 |
-
if "Corporate Identity Number" in
|
327 |
-
|
328 |
-
|
329 |
-
dict['Is Corporate Identity Number Matching'] = "No"
|
330 |
|
331 |
-
if "Share Holders" in dict:
|
332 |
-
share_holders=dict.get("Share Holders",[])
|
333 |
-
dict["Share Holders"]=",".join(share_holders)
|
334 |
|
335 |
-
extracted_results['Shareholding Details']=dict
|
336 |
-
print(dict)
|
337 |
|
338 |
address_proof = uploaded_files.get('address_proof', None)
|
339 |
if address_proof:
|
@@ -347,17 +311,220 @@ def process_uploads(uploaded_files):
|
|
347 |
for page_num, text in ocr_data.items():
|
348 |
content += text + '\n'
|
349 |
|
350 |
-
|
351 |
-
if "Stamp Duty" in
|
352 |
-
duty=
|
353 |
if duty>=100:
|
354 |
-
|
355 |
subword = "nota"
|
356 |
if subword in content.lower():
|
357 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
|
359 |
-
extracted_results['Address Proof Details(Non Judicial Stamp)']=dict
|
360 |
-
print(dict)
|
361 |
|
362 |
return extracted_results
|
363 |
except Exception as e:
|
|
|
2 |
from process import process,process_using_llm
|
3 |
import os
|
4 |
import shutil
|
|
|
|
|
5 |
import PyPDF2
|
6 |
|
7 |
+
TEMP_DIR = "temp_files"
|
8 |
st.set_page_config(layout="wide",page_title="KYC Doc AI")
|
9 |
|
10 |
def cleanup_temp_files():
|
|
|
17 |
os.makedirs(TEMP_DIR)
|
18 |
except Exception as e:
|
19 |
print(f"An error occurred during cleanup: {e}")
|
|
|
20 |
def extract_pages(input_pdf_path, output_pdf_path, start_page=None, end_page=None):
|
21 |
try:
|
22 |
# Open the PDF file
|
|
|
86 |
|
87 |
def process_uploads(uploaded_files):
|
88 |
try:
|
89 |
+
company_name=None
|
90 |
+
company_name_legal=None
|
91 |
+
company_trade_name=None
|
92 |
+
gst_number=None
|
93 |
+
pan_number_company=None
|
94 |
+
coi_number=None
|
95 |
director_names=[]
|
|
|
96 |
extracted_results={}
|
97 |
+
gst_dict={}
|
98 |
+
pan_dict={}
|
99 |
+
coi_dict={}
|
100 |
+
moa_dict={}
|
101 |
+
aoa_dict={}
|
102 |
+
add_dict={}
|
103 |
+
share_dict={}
|
104 |
+
total_pan_number=0
|
105 |
+
total_company_names=0
|
106 |
+
total_coi_numbers=0
|
107 |
+
|
108 |
if not os.path.exists(TEMP_DIR):
|
109 |
os.makedirs(TEMP_DIR)
|
110 |
|
|
|
155 |
if name not in director_names:
|
156 |
director_names.append(name)
|
157 |
extracted_results["Aadhaar Cards of Directors"]=director_aadhars_data_new
|
158 |
+
|
159 |
|
160 |
|
161 |
gst_cert=uploaded_files.get('gst_certificate',None)
|
|
|
168 |
content = ""
|
169 |
for page_num, text in ocr_data.items():
|
170 |
content += text + '\n'
|
171 |
+
gst_dict = process_using_llm(content, "gst")
|
172 |
+
if "Legal Name" in gst_dict:
|
173 |
+
company_name_legal=gst_dict.get('Legal Name','').strip()
|
174 |
+
elif "Trade Name" in gst_dict:
|
175 |
+
company_trade_name=gst_dict.get('Trade Name','').strip()
|
176 |
+
if "Registration Number"in gst_dict:
|
177 |
+
gst_number=gst_dict.get('Registration Number').strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
|
179 |
+
if company_name_legal or company_trade_name:
|
180 |
+
total_company_names+=1
|
181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
|
|
|
184 |
|
185 |
company_pan = uploaded_files.get('company_pan',None)
|
186 |
if company_pan:
|
|
|
192 |
content = ""
|
193 |
for page_num, text in ocr_data.items():
|
194 |
content += text + '\n'
|
195 |
+
pan_dict = process_using_llm(content, "company_pan")
|
196 |
+
if "Company Name" in pan_dict:
|
197 |
+
name=pan_dict.get("Company Name").strip()
|
198 |
+
company_name=name
|
199 |
+
total_company_names+=1
|
200 |
+
|
201 |
+
if "PAN Number" in pan_dict:
|
202 |
+
pan_number_company=pan_dict.get('PAN Number').strip()
|
203 |
+
total_pan_number+=1
|
204 |
|
|
|
|
|
|
|
205 |
|
206 |
coi = uploaded_files.get('coi',None)
|
207 |
if coi:
|
|
|
213 |
content = ""
|
214 |
for page_num, text in ocr_data.items():
|
215 |
content += text + '\n'
|
216 |
+
coi_dict = process_using_llm(content, "coi")
|
217 |
+
if "Company Name" in coi_dict:
|
218 |
+
name=coi_dict.get("Company Name").strip()
|
219 |
+
company_name=name
|
220 |
+
total_company_names+=1
|
221 |
+
|
222 |
+
if "Corporate Identity Number" in coi_dict:
|
223 |
+
coi_number=coi_dict.get("Corporate Identity Number").strip()
|
224 |
+
total_coi_numbers+=1
|
225 |
+
|
226 |
+
if "PAN Number" in coi_dict:
|
227 |
+
total_pan_number+=1
|
228 |
+
pan_number_company=coi_dict.get("PAN Number").strip()
|
229 |
|
|
|
|
|
|
|
|
|
230 |
|
|
|
|
|
231 |
|
|
|
|
|
232 |
|
233 |
aoa = uploaded_files.get('aoa',None)
|
234 |
if aoa:
|
|
|
243 |
for page_num, text in ocr_data.items():
|
244 |
content += text + '\n'
|
245 |
|
246 |
+
aoa_dict = process_using_llm(content, "aoa")
|
247 |
+
|
248 |
+
if "Share Holders" in aoa_dict:
|
249 |
+
share_holders=aoa_dict.get("Share Holders",[])
|
250 |
+
aoa_dict["Share Holders"]=",".join(share_holders)
|
251 |
+
|
252 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
|
254 |
moa = uploaded_files.get('moa',None)
|
255 |
if moa:
|
|
|
264 |
for page_num, text in ocr_data.items():
|
265 |
content += text + '\n'
|
266 |
|
267 |
+
moa_dict = process_using_llm(content, "moa")
|
268 |
+
|
269 |
+
if "Share Holders" in moa_dict:
|
270 |
+
share_holders=moa_dict.get("Share Holders",[])
|
271 |
+
moa_dict["Share Holders"]=",".join(share_holders)
|
272 |
+
|
273 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
|
275 |
|
276 |
share=uploaded_files.get('share',None)
|
|
|
286 |
for page_num, text in ocr_data.items():
|
287 |
content += text + '\n'
|
288 |
|
289 |
+
share_dict = process_using_llm(content, "share")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
|
291 |
|
292 |
+
if "Share Holders" in share_dict:
|
293 |
+
share_holders=share_dict.get("Share Holders",[])
|
294 |
+
share_dict["Share Holders"]=",".join(share_holders)
|
295 |
|
296 |
+
if "Corporate Identity Number" in share_dict:
|
297 |
+
coi_number=share_dict.get('Corporate Identity Number').strip()
|
298 |
+
total_coi_numbers+=1
|
|
|
299 |
|
|
|
|
|
|
|
300 |
|
|
|
|
|
301 |
|
302 |
address_proof = uploaded_files.get('address_proof', None)
|
303 |
if address_proof:
|
|
|
311 |
for page_num, text in ocr_data.items():
|
312 |
content += text + '\n'
|
313 |
|
314 |
+
add_dict = process_using_llm(content, "stamp")
|
315 |
+
if "Stamp Duty" in add_dict:
|
316 |
+
duty=add_dict.get("Stamp Duty",None)
|
317 |
if duty>=100:
|
318 |
+
add_dict['Valid Stamp']="Yes"
|
319 |
subword = "nota"
|
320 |
if subword in content.lower():
|
321 |
+
add_dict['Notary Stamp']="Present"
|
322 |
+
|
323 |
+
extracted_results['Address Proof Details(Non Judicial Stamp)']=add_dict
|
324 |
+
|
325 |
+
|
326 |
+
|
327 |
+
if company_name is not None or company_name_legal is not None or company_trade_name is not None:
|
328 |
+
if total_company_names>1:
|
329 |
+
if pan_dict:
|
330 |
+
name=pan_dict.get("Company Name",None)
|
331 |
+
if name and (name.strip() == company_name or name.strip() == company_name_legal or name.strip() == company_trade_name):
|
332 |
+
pan_dict['Is Company Matching']="Yes"
|
333 |
+
else:
|
334 |
+
pan_dict['Is Company Matching']="No"
|
335 |
+
|
336 |
+
if coi_dict:
|
337 |
+
name = coi_dict.get("Company Name",None)
|
338 |
+
if name and (name.strip() == company_name or name.strip() == company_name_legal or name.strip() == company_trade_name):
|
339 |
+
coi_dict['Is Company Matching'] = "Yes"
|
340 |
+
else:
|
341 |
+
coi_dict['Is Company Matching'] = "No"
|
342 |
+
|
343 |
+
|
344 |
+
if gst_dict:
|
345 |
+
name1 = gst_dict.get("Legal Name",None)
|
346 |
+
name2 = gst_dict.get("Trade Name",None)
|
347 |
+
|
348 |
+
if name1 and (name1.strip() == company_name or name1.strip() == company_name_legal or name1.strip() == company_trade_name):
|
349 |
+
gst_dict['Is Company Matching'] = "Yes"
|
350 |
+
|
351 |
+
elif name2 and (name2.strip() == company_name or name2.strip() == company_name_legal or name2.strip() == company_trade_name):
|
352 |
+
gst_dict['Is Company Matching'] = "Yes"
|
353 |
+
|
354 |
+
else:
|
355 |
+
gst_dict['Is Company Matching']="No"
|
356 |
+
|
357 |
+
if moa_dict:
|
358 |
+
name = moa_dict.get("Company Name", None)
|
359 |
+
if name and (name.strip() == company_name or name.strip() == company_name_legal or name.strip() == company_trade_name):
|
360 |
+
moa_dict['Is Company Matching'] = "Yes"
|
361 |
+
else:
|
362 |
+
moa_dict['Is Company Matching'] = "No"
|
363 |
+
|
364 |
+
if aoa_dict:
|
365 |
+
name = moa_dict.get("Company Name", None)
|
366 |
+
if name and (name.strip() == company_name or name.strip() == company_name_legal or name.strip() == company_trade_name):
|
367 |
+
moa_dict['Is Company Matching'] = "Yes"
|
368 |
+
else:
|
369 |
+
moa_dict['Is Company Matching'] = "No"
|
370 |
+
|
371 |
+
if share_dict:
|
372 |
+
name = share_dict.get("Company Name",None)
|
373 |
+
if name and (name.strip() == company_name or name.strip() == company_name_legal or name.strip() == company_trade_name):
|
374 |
+
share_dict['Is Company Matching'] = "Yes"
|
375 |
+
else:
|
376 |
+
share_dict['Is Company Matching'] = "No"
|
377 |
+
|
378 |
+
else: # if total count is less than or equal to 1 then we cannot validate
|
379 |
+
if pan_dict:
|
380 |
+
pan_dict[
|
381 |
+
'More information needed to validate company name'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
382 |
+
if coi_dict:
|
383 |
+
coi_dict[
|
384 |
+
'More information needed to validate company name'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
385 |
+
if gst_dict:
|
386 |
+
gst_dict[
|
387 |
+
'More information needed to validate company name'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
388 |
+
if aoa_dict:
|
389 |
+
aoa_dict[
|
390 |
+
'More information needed to validate company name'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
391 |
+
if moa_dict:
|
392 |
+
moa_dict[
|
393 |
+
'More information needed to validate company name'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
394 |
+
if share_dict:
|
395 |
+
share_dict[
|
396 |
+
'More information needed to validate company name'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
397 |
+
|
398 |
+
|
399 |
+
else:
|
400 |
+
if pan_dict:
|
401 |
+
pan_dict['More information needed to validate company name'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
402 |
+
if coi_dict:
|
403 |
+
coi_dict['More information needed to validate company name'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
404 |
+
if gst_dict:
|
405 |
+
gst_dict['More information needed to validate company name'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
406 |
+
if aoa_dict:
|
407 |
+
aoa_dict[
|
408 |
+
'More information needed to validate company name'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
409 |
+
if moa_dict:
|
410 |
+
moa_dict[
|
411 |
+
'More information needed to validate company name'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
412 |
+
if share_dict:
|
413 |
+
share_dict[
|
414 |
+
'More information needed to validate company name'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
415 |
+
|
416 |
+
|
417 |
+
if pan_number_company is not None:
|
418 |
+
if total_pan_number>1:
|
419 |
+
if pan_dict:
|
420 |
+
pan_number=pan_dict.get('PAN Number',None)
|
421 |
+
if pan_number is not None and pan_number.strip()==pan_number_company:
|
422 |
+
pan_dict['Is Company PAN Number Matching']="Yes"
|
423 |
+
else:
|
424 |
+
pan_dict['Is Company PAN Number Matching'] = "No"
|
425 |
+
|
426 |
+
if coi_dict:
|
427 |
+
pan_number = coi_dict.get('PAN Number',None)
|
428 |
+
if pan_number is not None and pan_number.strip() == pan_number_company:
|
429 |
+
coi_dict['Is Company PAN Number Matching'] = "Yes"
|
430 |
+
else:
|
431 |
+
coi_dict['Is Company PAN Number Matching'] = "No"
|
432 |
+
|
433 |
+
else:
|
434 |
+
if pan_dict:
|
435 |
+
pan_dict[
|
436 |
+
'More information needed to validate company PAN number'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
437 |
+
|
438 |
+
if coi_dict:
|
439 |
+
coi_dict[
|
440 |
+
'More information needed to validate company PAN number'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
441 |
+
|
442 |
+
|
443 |
+
|
444 |
+
else:
|
445 |
+
if pan_dict:
|
446 |
+
pan_dict['More information needed to validate company PAN number'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
447 |
+
|
448 |
+
if coi_dict:
|
449 |
+
coi_dict['More information needed to validate company PAN number']= f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
450 |
+
|
451 |
+
|
452 |
+
if coi_number is not None:
|
453 |
+
|
454 |
+
if total_coi_numbers>1:
|
455 |
+
|
456 |
+
if coi_dict:
|
457 |
+
coi_number_check=coi_dict.get('Corporate Identity Number',None)
|
458 |
+
if coi_number_check is not None and coi_number_check.strip()==coi_number:
|
459 |
+
coi_dict['Is Corporate Identity Number Matching']="Yes"
|
460 |
+
|
461 |
+
else:
|
462 |
+
coi_dict['Is Corporate Identity Number Matching']="No"
|
463 |
+
|
464 |
+
if share_dict:
|
465 |
+
coi_number_check=share_dict.get('Corporate Identity Number',None)
|
466 |
+
if coi_number_check is not None and coi_number_check.strip()==coi_number:
|
467 |
+
share_dict['Is Corporate Identity Number Matching']="Yes"
|
468 |
+
else:
|
469 |
+
share_dict['Is Corporate Identity Number Matching'] = "No"
|
470 |
+
|
471 |
+
else:
|
472 |
+
if coi_dict:
|
473 |
+
coi_dict[
|
474 |
+
'More information needed to validate company COI number'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
475 |
+
|
476 |
+
if share_dict:
|
477 |
+
share_dict[
|
478 |
+
'More information needed to validate company COI number'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
479 |
+
|
480 |
+
|
481 |
+
|
482 |
+
else:
|
483 |
+
if coi_dict:
|
484 |
+
coi_dict['More information needed to validate company COI number']=f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
485 |
+
|
486 |
+
if share_dict:
|
487 |
+
share_dict['More information needed to validate company COI number'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
488 |
+
|
489 |
+
|
490 |
+
|
491 |
+
if "Names of directors" in gst_dict:
|
492 |
+
gst_director_names = gst_dict.get("Names of directors", [])
|
493 |
+
if gst_director_names:
|
494 |
+
gst_dict["Names of directors"]=",".join(gst_director_names)
|
495 |
+
missing_directors = []
|
496 |
+
gst_director_names_lower = [name.strip().lower() for name in gst_director_names]
|
497 |
+
if director_names:
|
498 |
+
for direc_name in director_names:
|
499 |
+
if direc_name not in gst_director_names_lower:
|
500 |
+
missing_directors.append(direc_name)
|
501 |
+
|
502 |
+
if not missing_directors:
|
503 |
+
gst_dict["All director names present?"] = "<span style='color: green;'><strong>Yes</strong></span>"
|
504 |
+
|
505 |
+
else:
|
506 |
+
# List missing director names in red
|
507 |
+
missing_directors_text = ', '.join(
|
508 |
+
[f"<span style='color: red;'>{name}</span>" for name in missing_directors])
|
509 |
+
gst_dict["All director names present?"] = f"<span style='color: red;'><strong>No</strong></span> (Missing: {missing_directors_text})"
|
510 |
+
else:
|
511 |
+
gst_dict['More information needed to validate Director names'] = f"<span style='color: #d4ac0d;'><strong>Yes</strong></span>"
|
512 |
+
|
513 |
+
|
514 |
+
if pan_dict:
|
515 |
+
extracted_results['Company PAN Details']=pan_dict
|
516 |
+
if coi_dict:
|
517 |
+
extracted_results['COI Details']=coi_dict
|
518 |
+
if gst_dict:
|
519 |
+
extracted_results['GST Certificate Details']=gst_dict
|
520 |
+
if moa_dict:
|
521 |
+
extracted_results['MOA Details']=gst_dict
|
522 |
+
if aoa_dict:
|
523 |
+
extracted_results['AOA Details']=aoa_dict
|
524 |
+
if share_dict:
|
525 |
+
extracted_results['Shareholding Details']=share_dict
|
526 |
+
|
527 |
|
|
|
|
|
528 |
|
529 |
return extracted_results
|
530 |
except Exception as e:
|