New data source connection, with Bud Financial example
1. The process of creating a client and receiving data from Bud
customer_id: A unique client identifier from Bud system.
OS: The timveroOS (operating system).
public_link: A link to Open Banking which the client uses to grant/deny data access permission.
notification_module: An OS module for client and user notifications.
callback: A function executed by Bud within OS after client consent.
When a new participant is added, the Operating System (OS) creates a client in the Bud service and saves their customer_id in the data model. Once the client is created, the OS requests a public_link from Bud using the customer_id. The OS then generates and sends a notification to the client via the notification_module. When the client follows the public_link and grants data usage permission, the Bud system executes a callback. Based on the customer_id, the OS requests the client’s data and saves it in the model. Afterwards, the data becomes available for use in the feature store.
2. Connections for integrating timveroOS as a data source
The timveroOS, among other features, provides ready-made interfaces that allow you to connect an unlimited number of data sources at any stage of the system’s implementation and use.
To connect an external data source, you need to extend the DataSource interface by implementing its two main methods:
A data retrieval method - getData(Participant) - which encapsulates the logic for connecting to an external data source API.
A data parsing method - parseRecord(Content) - which allows transforming the received data of any format into a simple JSON or XML structure.
MappedDataSource interface and implement two main methods:
getData(Participant): Logic for API connection to an external data source.
parseRecord(Content): Converts data of any format into a simple JSON or XML structure.
DataSource Interface:
public interface DataSource<E extends DataSourceSubject, T> {
Content getData(E subject) throws Exception;
T parseRecord(Content data) throws Exception;
class Content {
private final byte[] body;
private final String mime;
public Content(byte[] body, String mime) {
this.body = body;
this.mime = mime;
}
public byte[] getBody() {
return this.body;
}
public String getMime() {
return this.mime;
}
}
}
E- a deal entity implementing the DataSourceSubject interface.
Connection of the BudTransactionDataSource data source:
@Service(BudTransactionsDataSource.DATASOURCE_NAME)
public class BudTransactionsDataSource implements DataSource<Participant, TransactionsRoot> {
public static final String DATASOURCE_NAME = "bud-transactions";
@Autowired
private BudService budService;
private ObjectMapper objectMapper = new ObjectMapper();
@Override
public Content getData(Participant subject) throws Exception {
UUID customerId = subject.getCustomerId();
TransactionsRoot transactions = budService.getTransactions(customerId);
return new Content(objectMapper.writeValueAsBytes(transactions), MediaType.APPLICATION_JSON_VALUE);
}
@Override
public TransactionsRoot parseRecord(Content data) throws Exception {
return objectMapper.readValue(data.getBody(), TransactionsRoot.class);
}
@Override
public Class<TransactionsRoot> getType() {
return TransactionsRoot.class;
}
}
To form and send requests, the standard RestTemplate tool provided by the Spring Web framework is used.
For parsing responses, the standard ObjectMapper tool provided by the Jackson library is used.
This example showcases the ease of connecting data sources and the transparency of their implementation. Thanks to the multi-level architecture of Timvero OS, sources are readily available for use immediately and without additional modifications.
3. Implementation of Bud integration
For the implementation of integration, we register a working project in the Bud system and obtain client_id and client_secret. We place the client_id and client_secret values in a configuration file. This allows for the keys to be updated without changing the code.
Retrieving the public_link: The BudService#getPublicLink(UUID customerId) method is for obtaining a public link that the client can use to give permissions: