These are notes relating to the Prism project carried out for SwitchX.
- Built by, and Primary Maintenance: Owen, Tanya
- For help/assistance: Owen, Tanya
- Likely Client: Cody (SwitchX)
There are two servers currently supporting this project. There is the UAT server (prismuat.technocore.co.za) and the Production server (prism.technocore.coz.a).
These credentials may be out of date. There are currently plans to move this project to a new DB.
- ServeReport9400: For serving front end.
- ServeWebHook9500: For serving WebHooks.
- ObjScheduler: For scheduled tasks like moving documents to bulk storage.
Prism is a project commissioned by SwitchX. The aim is to allow their partners, or "tenants" (currently ABSA, SAHL) to upload Bank Statements and Payslips. This information is then sent, via API, to truID, who extract the information and send it back. We then present the information for the user.
The aim is so that lenders may verify a customer's declared income and expenses against their bank statements and payslips, verifying the integrity of their information.
A large part of this project is the "mapping". The mapping refers to how the information returned by TruID is grouped and displayed. Each tenant will have their own mapping.
The flow works in the following way:
- Documents are uploaded to Axion via a form.
- We send the documents to truID, along with our endpoint (i.e prism.technocore.co.za/webhook/truidcallback) and receive a 200 OK message from truID.
- TruID processes the documents and extracts the information via their AI models.
- TruID sends a call to our endpoint that we sent them notifying us that they have finished extracting the data and it is ready to be transferred.
- We make a call to TruID to receive a list of "Product IDs". These product ID's are used to determine which information TruID needs to send back i.e Categorized Bank Transactions, Payslip Data, Fraud Data. TruID will determine which information is available and only send product IDs for available information.
- We then make another call to TruID, this time including a Product ID. TruID then sends us a JSON paylod containing the requested information.
¶ Key Files and Features
- factory.service/package.switchx/ObjServiceTruID.py
- This controls all the calls made to TruID. IMPORTANT: Workflows with this service must always contain a CALC step prior to the SERVICE step. This CALC step must set a
_calc_api_route variable. This variable will be used to determine which one of the TruID API calls will be triggered.
- factory.report/package.switchx/ObjReportDisplayBankStatement.py
- This is a custom report made to display the Categorized transactions returned by TruID. The report takes data from data_collection_transaction table, maps it to the right mappings for a specific tenant, pivots it for viewing, and builds a table around the data.
- factory.report/package.switchx/ObjReportDisplayPayslip.py
- Similarly a custom report used to display the information for Payslip data.
- S3 Storage
- An AWS S3 bucket is mounted to data.documents. This is for long term storage of the documents we receive. Documents are moved to this directory via ObjDatastore.py. Their lifespan in local.documents is determined by the TTL field in
def_document. After this TTL, they are moved to data.documents.
- Auth0
- User authetication and Logins are being implemented via Auth0.
- Transaction: Defined by SwitchX - this term refers to a single "application", i.e if John Smith is applying for a mortgage, his application would count as a single "transaction".
- Collection: This is how TruID refers to a transaction. Functionally the same as a transaction. It is worth noting that the table
data_transaction refers to the above version of transaction, whereas data_collection_transaction refers to Bank Statement Transactions retuned for a specific collection. In hindsight, we could've chosen better names, but we were working with what was infront of us at the time, soz
.
- Issue: Currently being hosted on the same DB as the switchbi machine, which is spawning too many connections.
- Remedy: On the switchbi.technocore.co.za server =>
supervisorctl restart all. Will close all stagnant connections.