The tel2puml
tool allows a custom mapping configuration file to be specified using the --mapping-config
or -mc
flag. This mapping configuration file maps application-specific data fields to the corresponding fields in the PVEvent
object, ensuring that the conversion process correctly translates the data.
A typical mapping_config.yaml
file would look like this:
# Configuration file for mapping application data to user data for PVEvent objects.
jobId: jobIdNew
eventId: eventIdNew
timestamp: timestampNew
previousEventIds: previousEventIdsNew
applicationName: applicationNameNew
jobName: jobNameNew
eventType: eventTypeNew
Each key in the configuration file represents a field in the PVEvent object, and its value represents the corresponding key in the application data.
A custom mapping_config.yaml
file is used when the structure of the data does not match the default PVEvent
schema. Defining a custom mapping ensures that data fields are correctly translated into the required format for generating PlantUML diagrams or PV formats.
If no mapping configuration file is provided, tel2puml
uses its default internal mappings for the PVEvent
object. A custom mapping configuration is only necessary when the data structure deviates from the default schema.
In cases where application data fields do not match the default field names used in PVEvent
, a custom mapping configuration can be defined. For instance, consider the following data structure for an event:
{
"job_identifier": "1234",
"event_identifier": "abcd-efgh",
"time_of_event": "2023-10-15T12:34:56Z",
"previous_event_ids": ["prev-123"],
"app_name": "my_application",
"job_name": "test_job",
"type_of_event": "A"
}
In this example, the default PVEvent
field names such as jobId
, eventId
, and timestamp
do not align with the application data field names. To handle this, a custom mapping_config.yaml file can be created to map the application fields to the corresponding PVEvent
fields:
# Custom mapping_config.yaml
jobId: job_identifier
eventId: event_identifier
timestamp: time_of_event
previousEventIds: previous_event_ids
applicationName: app_name
jobName: job_name
eventType: type_of_event