Spaces:
Build error
Build error
import streamlit as st | |
import pandas as pd | |
def display_demo_validations(): | |
st.header("Policies") | |
# demo_validations = [ | |
# # { | |
# # "Document Type": "Passport", | |
# # "Validation": "Full name must be present", | |
# # "Raises Red Flag": True, | |
# # # "Error Message": "Applicant's full name not present", | |
# # }, | |
# # { | |
# # "Document Type": "Passport", | |
# # "Validation": "Full name must have length between 2 & 61", | |
# # "Raises Red Flag": True, | |
# # # "Error Message": "Full name must have a length of at least 2 & at most 61", | |
# # }, | |
# # { | |
# # "Document Type": "Passport", | |
# # "Validation": "Full name must have at least two words", | |
# # "Raises Red Flag": True, | |
# # # "Error Message": "Full name must consist of at least 2 words (first name + last name)", | |
# # }, | |
# { | |
# "Document Type": "Passport", | |
# "Validation": ( | |
# "Full name must be present. " | |
# "Full name must have length between 2 & 61. " | |
# "Full name must have at least two words." | |
# ), | |
# # "Raises Red Flag": True, | |
# # "Error Message": "Applicant's full name not present", | |
# }, | |
# { | |
# "Document Type": "Passport", | |
# "Validation": "Expiry date must be present & after a year from current date", | |
# # "Raises Red Flag": True, | |
# # "Error Message": "Provided passport expires within 1 year", | |
# }, | |
# { | |
# "Document Type": "Payslip", | |
# "Validation": ( | |
# "Full name must be present. " | |
# "Full name must have length between 2 & 61. " | |
# "Full name must have at least two words." | |
# ), | |
# # "Raises Red Flag": True, | |
# # "Error Message": "Applicant's full name not present", | |
# }, | |
# { | |
# "Document Type": "Payslip", | |
# "Validation": "Employer name must be present", | |
# # "Raises Red Flag": True, | |
# # "Error Message": "Employer name not present", | |
# }, | |
# { | |
# "Document Type": "Payslip", | |
# "Validation": "Employer name must have at least alphabet", | |
# # "Raises Red Flag": True, | |
# # "Error Message": "Employer name must contain at least one letter", | |
# }, | |
# { | |
# "Document Type": "Payslip", | |
# "Validation": "Employer name cannot be only whitespace", | |
# # "Raises Red Flag": True, | |
# # "Error Message": "Employer name cannot be only whitespace", | |
# }, | |
# { | |
# "Document Type": "Payslip", | |
# "Validation": "Employer name must match the provided value", | |
# # "Raises Red Flag": True, | |
# # "Error Message": "Employer name mismatch with provided value", | |
# }, | |
# { | |
# "Document Type": "Payslip", | |
# "Validation": ( | |
# "Pay period start & dates must be present.\n" | |
# "Pay period start date cannot be on or after the end date.\n" | |
# "Pay period's end date must be within the last 35 days & not in the future.\n" | |
# "Pay period's date(s) must not be older than those of the last calendar month.\n" | |
# "Pay period's start date & end date must have a gap of at least 28 days." | |
# ), | |
# # "Raises Red Flag": True, | |
# # "Error Message": "Employer name mismatch with provided value", | |
# }, | |
# { | |
# "Document Type": "Payslip", | |
# "Validation": ( | |
# "Basic salary, Net Salary and/or other requisite salary components must be present. " | |
# "Tax Deduction line item must be present. " | |
# "NI/National Insurance line item must be present." | |
# ), | |
# # "Raises Red Flag": True, | |
# }, | |
# { | |
# "Document Type": "Payslip", | |
# "Validation": ( | |
# "Applicant's address must be present. " | |
# "Applicant's complete address must have a length of at least 10 & at most 300. " | |
# "Complete address must match with provided value. " | |
# ), | |
# # "Raises Red Flag": True, | |
# }, | |
# # { | |
# # "Document Type": "Payslip", | |
# # "Validation": "Employee number must be greater than 25", | |
# # "Raises Red Flag": True, | |
# # }, | |
# { | |
# "Document Type": "Digital Bank Account Statement", | |
# "Validation": ( | |
# "Full name must be present. " | |
# "Full name must have length between 2 & 61. " | |
# "Full name must have at least two words." | |
# ), | |
# # "Raises Red Flag": True, | |
# # "Error Message": "Applicant's full name not present", | |
# }, | |
# { | |
# "Document Type": "Digital Bank Account Statement", | |
# "Validation": ( | |
# "Bank name must be present. " | |
# "Bank name must have length between 4 & 50. " | |
# "Bank Name must match provided value." | |
# ), | |
# # "Raises Red Flag": True, | |
# # "Error Message": "Applicant's full name not present", | |
# }, | |
# { | |
# "Document Type": "Digital Bank Account Statement", | |
# "Validation": ( | |
# "Bank account number must be present. " | |
# "Bank account number must be of 8 digits only. " | |
# ), | |
# # "Raises Red Flag": True, | |
# # "Error Message": "Applicant's full name not present", | |
# }, | |
# { | |
# "Document Type": "Digital Bank Account Statement", | |
# "Validation": ( | |
# "Sort number must be present. " | |
# "It must be of the format xx-xx-xx wherein x are digits. " | |
# ), | |
# # "Raises Red Flag": True, | |
# # "Error Message": "Applicant's full name not present", | |
# }, | |
# { | |
# "Document Type": "Digital Bank Account Statement", | |
# "Validation": ( | |
# "Both statement start date & statement end date must be present. " | |
# "Account statement period's start date & end date must have a gap of at least 28 days. " | |
# "At least one salary credit must be present. " | |
# "Statement period's end date must be after the start date. " | |
# ), | |
# # "Raises Red Flag": True, | |
# # "Error Message": "Applicant's full name not present", | |
# }, | |
# ] | |
demo_validations = [ | |
# { | |
# "Topic / Document Type": "General Guidance", | |
# "Policy / Rule / Condition": "Income/Employment Docs Risk", | |
# "Action / Guidance / Requirement": "Be aware of higher risk of manipulation (Payslips, bank statements, Customer name).", | |
# "Red Flag / Caution": "Higher risk category.", | |
# "Notes / Details": "", | |
# }, | |
{ | |
"Topic / Document Type": "General Guidance", | |
"Policy / Rule / Condition": "Document Consistency", | |
# "Action / Guidance / Requirement": "Compare information across all documents (e.g., payslips vs bank statements) to ensure consistency.", | |
"Action / Guidance / Requirement": "Compare applicant's full name across all documents to ensure consistency.", | |
# "Red Flag / Caution": "Inconsistencies require investigation.", | |
# "Notes / Details": "", | |
}, | |
# { | |
# "Topic / Document Type": "General Guidance", | |
# "Policy / Rule / Condition": "Payslip YTD Check", | |
# "Action / Guidance / Requirement": "Do Year-to-Date figures (gross income, tax) make sense?", | |
# "Red Flag / Caution": "If figures don’t make sense, investigate.", | |
# "Notes / Details": "", | |
# }, | |
# { | |
# "Topic / Document Type": "General Guidance", | |
# "Policy / Rule / Condition": "Payslip Details Check", | |
# "Action / Guidance / Requirement": "Check for low employee numbers, rounded figures, differences in payment methods (e.g., payslip says BACS, statement shows Faster Payment).", | |
# "Red Flag / Caution": "These can be red flags requiring investigation.", | |
# "Notes / Details": "", | |
# }, | |
{ | |
"Topic / Document Type": "General Guidance", | |
"Policy / Rule / Condition": "Overall Validation", | |
"Action / Guidance / Requirement": "Ensure document is genuine, not fraudulent, belongs to the customer, and is from the expected source.", | |
# "Red Flag / Caution": "Any doubt may indicate fraud.", | |
# "Notes / Details": "Applies to all documents.", | |
}, | |
{ | |
"Topic / Document Type": "Passport", | |
"Policy / Rule / Condition": "Full Name", | |
"Action / Guidance / Requirement": ( | |
"Full name must be present. " | |
"Full name must have length between 2 & 61. " | |
"Full name must have at least two words." | |
), | |
# "Raises Red Flag": True, | |
# "Error Message": "Applicant's full name not present", | |
}, | |
{ | |
"Topic / Document Type": "Passport", | |
"Policy / Rule / Condition": "Expiry Date", | |
"Action / Guidance / Requirement": "Expiry date must be present & after a year from current date", | |
# "Raises Red Flag": True, | |
# "Error Message": "Provided passport expires within 1 year", | |
}, | |
{ | |
"Topic / Document Type": "Payslips", | |
"Policy / Rule / Condition": "Employer & Customer Names", | |
"Action / Guidance / Requirement": "Must include correct Employer’s and Customer’s names.", | |
# "Red Flag / Caution": "Missing or incorrect names.", | |
# "Notes / Details": "Cross-reference with BMM/HOME.", | |
}, | |
{ | |
"Topic / Document Type": "Payslips", | |
"Policy / Rule / Condition": "Submission Requirement (Monthly Pay)", | |
"Action / Guidance / Requirement": "Minimum one month's most recent payslip required.", | |
# "Red Flag / Caution": "", | |
# "Notes / Details": "", | |
}, | |
{ | |
"Topic / Document Type": "Payslips", | |
"Policy / Rule / Condition": "Pay Date Requirement", | |
# "Action / Guidance / Requirement": "Pay date must be within 35 days of FCD (Final Completion Date).", | |
"Action / Guidance / Requirement": "Pay date must be within 35 days of document upload date.", | |
# "Red Flag / Caution": "Pay date older than 35 days from FCD.", | |
# "Notes / Details": "", | |
}, | |
{ | |
"Topic / Document Type": "Payslips", | |
"Policy / Rule / Condition": "Pay Period End Date (DD/MM/YYYY, if no pay date)", | |
# "Action / Guidance / Requirement": "Period end date must be within 35 days of FCD.", | |
"Action / Guidance / Requirement": "Period end date must be within 35 days of document upload date.", | |
# "Red Flag / Caution": "Period end date older than 35 days from FCD.", | |
# "Notes / Details": "", | |
}, | |
{ | |
"Topic / Document Type": "Payslips", | |
# "Policy / Rule / Condition": "Pay Period Month (MM/YYYY, if no pay date)", | |
"Policy / Rule / Condition": "Pay Period Month (MM/YYYY, if no pay date) basis pay period duration", | |
"Action / Guidance / Requirement": "Payslips dated in the current or previous calendar month are acceptable (must be the most recent).", | |
# "Red Flag / Caution": "Older than previous calendar month.", | |
# "Notes / Details": "", | |
}, | |
{ | |
"Topic / Document Type": "Payslips", | |
"Policy / Rule / Condition": "Undated Payslips", | |
"Action / Guidance / Requirement": "Unacceptable.", | |
# "Red Flag / Caution": "Undated payslip received.", | |
# "Notes / Details": "Request a dated version.", | |
}, | |
{ # custom | |
"Topic / Document Type": "Payslips", | |
"Policy / Rule / Condition": "Pay Period Start & End Dates", | |
# "Action / Guidance / Requirement": "Pay date must be within 35 days of FCD (Final Completion Date).", | |
"Action / Guidance / Requirement": "Pay date must be within 35 days of document upload date.", | |
# "Red Flag / Caution": "Pay date older than 35 days from FCD.", | |
# "Notes / Details": "", | |
}, | |
{ # custom | |
"Topic / Document Type": "Payslips", | |
"Policy / Rule / Condition": "Requisite salary line items", | |
"Action / Guidance / Requirement": "Basic salary, Net Salary and/or other requisite salary components must be present", | |
# "Red Flag / Caution": "Missing or nonsensical Tax/NI figures.", | |
# "Notes / Details": "", | |
}, | |
{ | |
"Topic / Document Type": "Payslips", | |
"Policy / Rule / Condition": "Tax & NI Contributions", | |
"Action / Guidance / Requirement": "Must be visible. Perform a sense check.", | |
# "Red Flag / Caution": "Missing or nonsensical Tax/NI figures.", | |
# "Notes / Details": "", | |
}, | |
# custom | |
{ | |
"Topic / Document Type": "Payslips", | |
"Policy / Rule / Condition": "Applicant Address", | |
"Action / Guidance / Requirement": ( | |
"Applicant's address must be present. " | |
"Applicant's complete address must have a length of at least 10 & at most 300. " | |
"Complete address must match with provided value. " | |
), | |
# "Red Flag / Caution": "Missing or nonsensical Tax/NI figures.", | |
# "Notes / Details": "", | |
}, | |
# { | |
# "Topic / Document Type": "Payslips", | |
# "Policy / Rule / Condition": "YTD Figures Match", | |
# "Action / Guidance / Requirement": "Verify YTD figures match declared income.", | |
# "Red Flag / Caution": "YTD figures do not match declared income.", | |
# "Notes / Details": "Add to YMI/FDM memo if they do not match.", | |
# }, | |
# { | |
# "Topic / Document Type": "Payslips", | |
# "Policy / Rule / Condition": "Pension Income (on Payslip)", | |
# "Action / Guidance / Requirement": "Must show within the last 35 days / be the most recent.", | |
# "Red Flag / Caution": "Pension income shown is dated >35 days ago.", | |
# "Notes / Details": "Alternatively use pension annual statement/latest P60. Cross-reference with bank statement if possible.", | |
# }, | |
# { | |
# "Topic / Document Type": "Payslips", | |
# "Policy / Rule / Condition": "Joint Applicants", | |
# "Action / Guidance / Requirement": "Required if applicable.", | |
# "Red Flag / Caution": "Missing payslip for a joint applicant.", | |
# "Notes / Details": "", | |
# }, | |
# { | |
# "Topic / Document Type": "Payslips", | |
# "Policy / Rule / Condition": "Payslip Red Flags", | |
# "Action / Guidance / Requirement": "", | |
# "Red Flag / Caution": "Rounded figures. Low employee/payroll number. Presence of these flags.", | |
# "Notes / Details": "Investigate further.", | |
# }, | |
# { | |
# "Topic / Document Type": "Payslips", | |
# "Policy / Rule / Condition": "Payslip Verification (HOME)", | |
# "Action / Guidance / Requirement": "Check information in HOME against payslip details (employer name, customer name, etc.).", | |
# "Red Flag / Caution": "Mismatches found (e.g., misspellings, missing words).", | |
# "Notes / Details": "Correct HOME after consulting customer. If correction not possible (e.g., space), add YMI/FDM memo explaining.", | |
# }, | |
# { | |
# "Topic / Document Type": "Payslips", | |
# "Policy / Rule / Condition": "Payslip Near 35-Day Limit", | |
# "Action / Guidance / Requirement": "If payslip is close to the 35-day limit and no decision is obtained.", | |
# "Red Flag / Caution": "Decision pending, payslip nearing expiry.", | |
# "Notes / Details": "Another, more recent payslip may be required.", | |
# }, | |
# { | |
# "Topic / Document Type": "Digital Bank Stmts", | |
# "Policy / Rule / Condition": "Purpose", | |
# "Action / Guidance / Requirement": "Used to confirm income/expenditure.", | |
# "Red Flag / Caution": "", | |
# "Notes / Details": "Cannot be used for ID & VA confirmation.", | |
# }, | |
{ | |
"Topic / Document Type": "Digital Bank Stmts", | |
"Policy / Rule / Condition": "Coverage", | |
# "Action / Guidance / Requirement": "Must cover a full calendar month (vs 28 days for original).", | |
"Action / Guidance / Requirement": "Account statement period's start date & end date must have a gap of at least 28 days.", | |
# "Red Flag / Caution": "", | |
# "Notes / Details": "", | |
}, | |
{ # Custom | |
"Topic / Document Type": "Digital Bank Stmts", | |
"Policy / Rule / Condition": "Full Name", | |
"Action / Guidance / Requirement": ( | |
"Full name must be present. " | |
"Full name must have length between 2 & 61. " | |
"Full name must have at least two words." | |
), | |
# "Raises Red Flag": True, | |
# "Error Message": "Applicant's full name not present", | |
}, | |
{ | |
"Topic / Document Type": "Digital Bank Stmts", | |
"Policy / Rule / Condition": "Data Match", | |
"Action / Guidance / Requirement": "Customer data on statement must match profile.", | |
# "Red Flag / Caution": "Data mismatch.", | |
# "Notes / Details": "", | |
}, | |
# { | |
# "Topic / Document Type": "Digital Bank Stmts", | |
# "Policy / Rule / Condition": "Pay Info Match", | |
# "Action / Guidance / Requirement": "Verify pay information matches the payslip.", | |
# "Red Flag / Caution": "Pay info mismatch vs payslip.", | |
# "Notes / Details": "", | |
# }, | |
{ | |
"Topic / Document Type": "Digital Bank Stmts", | |
"Policy / Rule / Condition": "Authenticity Doubt", | |
"Action / Guidance / Requirement": "If any doubt regarding authenticity.", | |
# "Red Flag / Caution": "Suspected non-genuine digital statement.", | |
# "Notes / Details": "Cases may be referred to Fraud.", | |
}, | |
{ # Custom | |
"Topic / Document Type": "Digital Bank Stmts", | |
"Policy / Rule / Condition": "Salary deposit", | |
"Action / Guidance / Requirement": "At least one salary credit must be present", | |
# "Red Flag / Caution": "Data mismatch.", | |
# "Notes / Details": "", | |
}, | |
{ | |
"Topic / Document Type": "Digital Bank Stmts", | |
"Policy / Rule / Condition": "Bank name", | |
"Action / Guidance / Requirement": ( | |
"Bank name must be present. " | |
"Bank name must have length between 4 & 50. " | |
# "Bank Name must match provided value." | |
), | |
}, | |
{ | |
"Topic / Document Type": "Digital Bank Stmts", | |
"Policy / Rule / Condition": "Bank account number", | |
"Action / Guidance / Requirement": ( | |
"Bank account number must be present. " | |
"Bank account number must be of 8 digits only. " | |
), | |
}, | |
{ | |
"Topic / Document Type": "Digital Bank Stmts", | |
"Policy / Rule / Condition": "Sort code", | |
"Action / Guidance / Requirement": ( | |
"Sort number must be present. " | |
"It must be of the format xx-xx-xx wherein x are digits. " | |
), | |
}, | |
{ | |
"Topic / Document Type": "Digital Bank Stmts", | |
"Policy / Rule / Condition": "Date checks", | |
"Action / Guidance / Requirement": ( | |
"Both statement start date & statement end date must be present. " | |
"At least one salary credit must be present. " | |
"Statement period's end date must be after the start date. " | |
), | |
}, | |
] | |
demo_validations_df = pd.DataFrame(demo_validations) | |
demo_validations_df.index += 1 | |
# st.dataframe(demo_validations_df) | |
st.table(demo_validations_df) | |