This page will be used for documenting cloud functions and changes. We are using Gen 2 Cloud Functions - Cloud Functions 2nd gen is GA
See also - Pub/Sub Topic Deployment ; Cloud Functions Triggers
Naming Conventions
The naming convention for Cloud Functions in risk will follow the naming convention of businessFunction-subcategory-task
. The strings in the name will be “-” dash separated.
For example, slacker-transaction-intrabank-sync
indicates a function for evaluating intrabank transactions, and this is used for the main business functionality of synchronously interacting with Slacker.
businessFunction
- Refers to the main functionality that the cloud function is used for and will be grouped underThere can only be one Business Function
E.g.
stream-xxxxx
subcategory
- Within the supposed business function, there can be various subtasks that each function performs, related to the categories.Subcategory details are “-” underscore separated
Can accept up to 2 subcategories, should be hierarchical in nature, where the second category is intuitively a subset of the first
E.g.
stream-logging-telestatus-xxxxxx
task
- Will contain more specific descriptions of the subtask or job handled by each function. Can be anything as long as it is documented.Preferably indicate tasks with a verb whenever possible - E.g.
write
,score
,ingest
, etc.E.g.
stream-logging-telestatus-fswrite
Github: Cloud Functions Reference
Naming rules for Cloud Functions - Name must start with a letter followed by up to 62 letters, numbers, hyphens or underscores and must end with a letter or a number. Name must also be lower-case.
Business Functions
SLACKER
This refers to all Cloud Functions that will be interacting with Slacker. In general, the functions here will either receive and API request from Slacker and return a decision COMMAND, or the function will listen for some signal from other areas and return an event-triggered COMMAND to slacker.
In general, there are 2 ways to monitor and trigger via Slacker
Synchronously using Slacker → Cloud Functions → Slacker
command
/ ResponseAsynchronously from Pub/Sub → Cloud Functions → Slacker
command
Workflow:
Domain | Cloud Function Name | Description | Input | Output | In Brave | Ready for Integration Tests | In Stage |
---|---|---|---|---|---|---|---|
Cards |
| Used for handling REST API calls from Slacker in a synchronous workflow. Returns the approval status of cards transactions and relevant Slacker commands. This is for risk and fraud checks. | JSON | JSON <HTTP Response>
|
| ||
Transaction |
| Non-AML Transaction Checks: Used for handling REST API calls from Slacker in a synchronous workflow. Returns the approval status of the transaction, with the relevant Slacker commands. This is for risk and fraud checks. (previously | JSON | JSON <HTTP Response>
|
|
| |
Transaction |
| Basically, runs the same checks as | JSON | JSON <HTTP Response>
|
|
DECISION
This refers to all Cloud Functions that will be be involved in some form of decisioning but not for interacting with Slacker. These functions can, for instance, interact with other microservices or 3rd Party Workflows such as One Stop Platform.
In general, these functions will accept some API request and return some decision response based on the received message. Also, they will most likely follow a synchronous workflows
Due to the low-latency requirements of synchronous processes, the future workflow will include AlloyDB. Meaning to say, a SQL query to extract the given features will be ran against AlloyDB, which will return the results of that query. The query results are then not only returned as a response, but also written to the Online FeatureStore for further processing.
This achieves 3 things:
Low-latency with AlloyDB’s capabilities, allowing for millisecond queries
Reduce the need to continually run SQL queries in BigQuery in order to refresh the online FeatureStore with the latest queries
Only relevant
feature values
andentity_id
that have been triggered by decisioning workflows, will be written to the FeatureStore. This prevents a flood of continuous feature ingestions from step (2) of which most will not be used for decisioning anyway
Domain | Cloud Function Name | Description | Input | Output | In Brave | Ready for Integration Tests | In Stage |
---|---|---|---|---|---|---|---|
Customer |
| Used to check the values from Execution logic:
| JSON Message with customerId as referenceId { "referenceId":"XXXXXXXX" } | JSON <HTTP Response> |
|
| |
Customer |
| Returns the device fingerprint features of given customerId to OSP for risk decisioning. Also returns a device fingerprint score as well. Execution Logic:
| JSON Message with customerId as referenceId { "referenceId":"XXXXXXXX" } | JSON <HTTP Response> |
| ||
Loans |
| Evaluates customer’s risk and returns decision whether the loan application should be approved or declined | JSON Message with customerId as referenceId { "referenceId":"XXXXXXXX" } | JSON <HTTP Response> |
|
| |
Loans |
| This is used for evaluating a customer’s recommended and maximum loan amount, as part of the loans product table recommendation. Returns a response with the necessary parameters that can be translated downstream to retrieve a product from the recommendation table. | JSON <HTTP Response> |
| |||
Customer |
| Used for checking the presence or absence of a value in a specified list from a HTTP request https://safibank.atlassian.net/wiki/spaces/ITArch/pages/192806935 | JSON Message with list of parameters to be queried { "dataset":"fraud_list_management", "table":"blacklist_others", "values":[] } | JSON <HTTP Response> |
|
|
STREAM
This refers to all Cloud Functions related to ingesting from data streams (Kafka or Pub/Sub) and perform some task on it. This can also cover ingesting data from continuous async/sync REST API calls.
The functions here in general will operate asynchronously and are not expected to return a response as part of the data ingestion process.
Example of Stream Setup for Writing to Online FeatureStore or BigQuery
One current stream is that from Kafka Topics -
Kafka Topic --> Pub/Sub --> Cloud Function
Another “stream” would be that from the Logging functionality of One-Stop-Platform -
OSP --> Cloud Function
A successful ingestion will display a message similar to the one below, with status 200. This message can be viewed in the logs of the given Cloud Function
SUCCESS - TEST12-edf261c1-53f4-43fc-b88b-1573e0c82691 - Written to device_fingerprint_fs: devicelabel_features SUCCESS - TEST12-edf261c1-53f4-43fc-b88b-1573e0c82691 - Written to device_fingerprint_fs: risklabel_features RESPONSE LIST: [(200, 'devicelabel_features'), (200, 'risklabel_features')]
Kafka Topics → Pub/Sub Topic → Cloud Function → FeatureStore/BigQuery
Domain | Cloud Function Name | Description | Input | Output | In Brave | Ready for Integration Tests | In Stage |
---|---|---|---|---|---|---|---|
Customer |
| Parses the Device Fingerprint response from the given Pub/Sub topic and writes the output to the Online FeatureStore Device Fingerprint Kafka Topic → Pub/Sub → Cloud Function → Writes to Online Featurestore | JSON Message from Kafka Topic | HTTP Response Status Code on whether the features have been successfully written to 200 = Success |
|
| |
Customer |
| Parses the Customer Snapshot payload from the given Pub/Sub topic and writes the output to the Online FeatureStore Device Fingerprint Kafka Topic → Pub/Sub → Cloud Function → Writes to Online Featurestore | JSON Message from Kafka Topic | HTTP Response Status Code on whether the features have been successfully written to 200 = Success |
|
| |
Customer |
| Parses the OCR Lite Response from the given Pub/Sub topic and writes the output to the Online FeatureStore | JSON Message from Kafka Topic | HTTP Response Status Code on whether the features have been successfully written to 200 = Success |
|
| |
Customer |
| Parses the Liveness Detection and Facial Verification Response from the given Pub/Sub topic and writes the output to the Online FeatureStore | JSON Message from Kafka Topic | HTTP Response Status Code on whether the features have been successfully written to 200 = Success |
|
| |
Cards |
| Parses the incoming Cards message payload, from the given Pub/Sub topic and writes the output to the Online FeatureStore | JSON Message from Kafka Topic | HTTP Response Status Code on whether the features have been successfully written to 200 = Success |
|
OSP Logging → REST API Request → Cloud Function → FeatureStore/BigQuery
See also - One-Stop Platform Logging for FeatureStore
Domain | Cloud Function Name | Description | Input | Output | In Brave | Ready for Integration Tests | In Stage |
---|---|---|---|---|---|---|---|
One Stop Platform |
| Parses the OSP Logging Response from Telco Behaviour Score into | Logging JSON Message from One-Stop-Platform | HTTP Response Status Code on whether the features have been successfully written to 200 = Success |
| ||
One Stop Platform |
| Parses the OSP Logging Response from Tele Status Service into | Logging JSON Message from One-Stop-Platform | HTTP Response Status Code on whether the features have been successfully written to 200 = Success |
| ||
One Stop Platform |
| Parses the OSP Logging Response from Email Detection (Seon) into | Logging JSON Message from One-Stop-Platform | HTTP Response Status Code on whether the features have been successfully written to 200 = Success |
| ||
One Stop Platform |
| Parses the OSP Logging Response from Social Media Detection (Seon) into | Logging JSON Message from One-Stop-Platform | HTTP Response Status Code on whether the features have been successfully written to 200 = Success |
| ||
One Stop Platform |
| Parses the OSP Logging Response from Identity Check into | Logging JSON Message from One-Stop-Platform | HTTP Response Status Code on whether the features have been successfully written to 200 = Success |
|
INGEST
Data ingestion related, but not related to processing from data streams. Examples include nightly batch ingestion jobs. For now, this is under the purview of the data engineering team.
Domain | Cloud Function Name | Description | Input | Output | In Brave | Ready for Integration Tests | In Stage |
---|---|---|---|---|---|---|---|
Customer |
| Used for nightly batch jobs to the Writes to the entity_type | A HTTP Request containing the source tables and source dataset in BigQuery | HTTP Response Status Code on whether the features have been successfully written to |
|
DATA
This refers to all Cloud Functions that will be be deploy as part of data science or machine learning pipelines. For instance, reading a deployed model, etc. This is currently inactive.
Domain | Cloud Function Name | Description | Input | Output | In Brave | Ready for Integration Tests | In Stage |
---|---|---|---|---|---|---|---|
Risk |
| Example Only | |||||
Attachments:
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio.png (image/png)
~drawio~61cbdc0ff63ac80070187682~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio.png (image/png)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio.png (image/png)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio.png (image/png)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio.png (image/png)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio.png (image/png)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio.png (image/png)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
~Untitled Diagram.drawio.tmp (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio (application/vnd.jgraph.mxfile)
Untitled Diagram.drawio.png (image/png)
Untitled.drawio-c7c9287f1b222fc83532976108d15275e65a2554.png (image/png)
Untitled Diagram.drawio-ab83368e0b7e4bd3bcc96a9768a4037958f3f25d.png (image/png)
Untitled.drawio-c7c9287f1b222fc83532976108d15275e65a2554.png (image/png)
Untitled.drawio-c7c9287f1b222fc83532976108d15275e65a2554.png (image/png)
Untitled.drawio-c7c9287f1b222fc83532976108d15275e65a2554.png (image/png)
image-20230202-023334.png (image/png)