manabb commited on
Commit
fee88dd
·
verified ·
1 Parent(s): 26a949d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +93 -0
app.py CHANGED
@@ -8,6 +8,99 @@ import time
8
  #==== import completed
9
 
10
  client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  #====generate response function started
13
  def generate_response(manual,proposal):
 
8
  #==== import completed
9
 
10
  client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
11
+ #=====
12
+ #Payment type
13
+ manual_payment_type="""
14
+ 1. Tender documents must clearly specify terms of delivery and supplier responsibilities.
15
+ 2. Bidders must furnish cost break-up for goods, installation, training with applicable taxes.
16
+ 3. Domestic tenders quoted/paid in Indian currency; imported goods FOB/CIF in foreign currency.
17
+ 4. Indian agents receive commission in Indian Rupees.
18
+ 5. Payments made promptly as per contract terms without avoidable delay.
19
+ 6. Statutory certificates for TDS provided to supplier before tax return submission.
20
+ 7. Detailed payment advice issued showing calculations and deductions.
21
+ 8. Invoice cross-checked with actual receipt before payment.
22
+ 9. Contractor certifies payment claimed is within contract terms.
23
+ 10. FOR Dispatching Station: 60-100% on dispatch proof, balance on receipt/acceptance.
24
+ 11. FOR Destination: 100% on receipt and acceptance by consignee.
25
+ 12. Goods with installation: 60% dispatch/90% receipt + 10% post-installation.
26
+ 13. Payments via NEFT/RTGS or Advice to Bank for domestic goods.
27
+ 14. Documents required: Invoice, Packing list, RR, E-Waybill, Inspection cert.
28
+ 15. Imported goods: 100% FOB/CIF if no installation; 80-90% + balance post-installation.
29
+ 16. Agency commission paid 100% in INR after other payments.
30
+ 17. Imports conform to FEMA, EXIM policy, RBI directions.
31
+ 18. Payments through LC or direct bank transfer as per contract.
32
+ 19. Advance payments discouraged; require CA approval if given.
33
+ 20. Ad-hoc advances adjusted in next bill; approved by CA per DOA.
34
+ 21. No payments outside contract terms or excess of contract rates."""
35
+
36
+ #=================
37
+ #BasisOfEstimate
38
+
39
+ manual_basis_of_estimate="""
40
+ 1. Estimated cost should be worked out realistically using market survey, budgetary quotations, or published catalogues/MRP when no historical data is available.
41
+ 2. For custom-built equipment, obtain budgetary quotes from potential parties. Ideally three quotes, but if less than three, use available quotes with average if multiple.
42
+ 3. Minimum three offer is required for estimate calculation. If less than three offers, then reason is to be written.
43
+ 4. Estimated rates should include basic price, quantity, inspection fees, customs duty, packing, transport, GST, installation, testing, contingencies etc.
44
+ 5. All estimates prepared by User function shall be scrutinized and approved by competent authority as per DOA.
45
+ 6. Approved estimates are to be treated as strictly confidential and retained securely without disclosing to third party.
46
+ 7. In urgent cases, estimate can be prepared subsequent to tender floating but prior to opening priced bids after recording reasons.
47
+ 8. Foreign currency rates should be converted to Indian Rupees using TT selling rates published by RBI authorized bankers.
48
+ 9. Estimates should consider inflation, technology changes, profit margins etc.
49
+ 10. If estimates cannot be made meaningfully, full reason should be recorded.
50
+ 11. For procurements up to Rs.1,00,000, detailed estimates are not required.
51
+ 12. Price indices can be obtained from eaindustry.nic.in for indigenous items.
52
+ 13. Estimates should be based on latest indent rates which had not been converted to order.
53
+ 14. Last purchase price of similar items can be used for estimation.
54
+ 15. Costing analysis based on costs of various components/raw materials should be done."""
55
+
56
+ #=======================
57
+ PQC_rules="""
58
+ 1. If the proposal value is more than fifty lakh, the PQC shall include financial criteria
59
+ 2. PQC should be unrestrictive enough to not exclude any capable vendor/contractor.
60
+ 3. PQC should be restrictive enough to exclude incapable vendors/contractors.
61
+ 4. Framing of PQC requires due consideration to adequacy of competition.
62
+ 5. PQC should be carefully decided for each procurement with approval of Competent Authority (CA).
63
+ 6. Bidders must submit authenticated documents in support of eligibility criteria.
64
+ 7. For MSEs and past successful bidders, PQC can be proportional to quantity quoted.
65
+ 8. Sudden multiple times increase in requirement should not blindly adopt past PQCs.
66
+ 9. PQC misjudgement in either direction (too restrictive or unrestrictive) is detrimental.
67
+ 10. PQC should be clarified in tender documents that authenticated documents are required.
68
+ 11. Encourage MSEs by considering proportional PQC application.
69
+ 12. Past successful bidders should not be disqualified due to sudden requirement increase.
70
+ 13. Functional head approval is mandatory for PQC acceptance.
71
+ 14. Adequacy of competition must be evaluated while framing PQC.
72
+ 15. PQC should balance inclusion of capable vendors and exclusion of incapable ones."""
73
+
74
+ #============starting extract_docx_text
75
+ def extract_docx_text(file_path):
76
+ # Load the DOCX file
77
+ doc = Document(file_path)
78
+
79
+ # Extract all content in a structured way
80
+ final_data = []
81
+
82
+ # Process all tables in the document
83
+ for table_idx, table in enumerate(doc.tables):
84
+ for row in table.rows:
85
+ cells = [cell.text.strip() for cell in row.cells]
86
+
87
+ # If it's a 2-column layout (Key: Value format)
88
+ if len(cells) == 2:
89
+ key = cells[0].replace(':', '').strip()
90
+ value = cells[1].strip()
91
+ if key and value:
92
+ final_data.append({'Field': key, 'Value': value, 'Source': f'Table_{table_idx+1}'})
93
+ else:
94
+ # Multi-column or single column data
95
+ combined = ' | '.join([c for c in cells if c])
96
+ if combined:
97
+ final_data.append({'Field': 'Multi-Column Data', 'Value': combined, 'Source': f'Table_{table_idx+1}'})
98
+
99
+ # Create DataFrame
100
+ df= pd.DataFrame(final_data)
101
+ #doc = Document(file_path)
102
+ #text = "\n".join([para.text for para in doc.paragraphs])
103
+ return df
104
 
105
  #====generate response function started
106
  def generate_response(manual,proposal):