LogReg_model / utils /helpers.py
subbunanepalli's picture
Rename helpers.py to utils/helpers.py
2211905 verified
import pandas as pd
def create_sanction_context(row: pd.Series) -> str:
"""
Creates a textual Sanction_Context by concatenating important transaction fields.
This will be used as input to TF-IDF vectorizer or NLP models.
"""
context = f"""
Transaction ID: {row['Transaction_Id']}
Origin: {row['Origin']}
Designation: {row['Designation']}
Keywords: {row['Keywords']}
Name: {row['Name']}
SWIFT Tag: {row['SWIFT_Tag']}
Currency: {row['Currency']}
Entity: {row['Entity']}
Message: {row['Message']}
City: {row['City']}
Country: {row['Country']}
State: {row['State']}
Hit Type: {row['Hit_Type']}
Record Matching String: {row['Record_Matching_String']}
WatchList Match String: {row['WatchList_Match_String']}
Payment Sender: {row.get('Payment_Sender_Name', '')}
Payment Receiver: {row.get('Payment_Reciever_Name', '')}
Swift Message Type: {row['Swift_Message_Type']}
Text Sanction Data: {row['Text_Sanction_Data']}
Matched Sanctioned Entity: {row['Matched_Sanctioned_Entity']}
Red Flag Reason: {row['Red_Flag_Reason']}
Risk Level: {row['Risk_Level']}
Risk Score: {row['Risk_Score']}
CDD Level: {row['CDD_Level']}
PEP Status: {row['PEP_Status']}
Sanction Description: {row['Sanction_Description']}
Checker Notes: {row['Checker_Notes']}
Sanction Context: {row['Sanction_Context']}
Maker Action: {row['Maker_Action']}
Customer Type: {row['Customer_Type']}
Industry: {row['Industry']}
Transaction Type: {row['Transaction_Type']}
Transaction Channel: {row['Transaction_Channel']}
Geographic Origin: {row['Geographic_Origin']}
Geographic Destination: {row['Geographic_Destination']}
Risk Category: {row['Risk_Category']}
Risk Drivers: {row['Risk_Drivers']}
Alert Status: {row['Alert_Status']}
Investigation Outcome: {row['Investigation_Outcome']}
Source of Funds: {row['Source_Of_Funds']}
Purpose of Transaction: {row['Purpose_Of_Transaction']}
Beneficial Owner: {row['Beneficial_Owner']}
"""
return context.strip()