|
| 1 | +# PUML Models |
| 2 | +## Introdcution |
| 3 | +Internally `tel2puml` uses a model that it builds from event sequences that are passed into it. This model is built with the following components: |
| 4 | + |
| 5 | + |
| 6 | +- **EventSet** - This is a unique "set" of `eventTypes` and their counts e.g., `A: 3, B: 2, C: 1`. This is used to represent a single possibility specific events and their occurence |
| 7 | +- **Event**: Represents a single event with: |
| 8 | + - `eventType` - e.g., `A`, `B`, `C`, etc. |
| 9 | + - `outgoingEventSets` - This is a list of `EventSet` objects that represent the possible next events that can occur after this event with a forward connection. |
| 10 | + - `incomingEventSets` - This is a list of `EventSet` objects that represent the possible previous events that can occur before this event with a backwards connection. |
| 11 | +- **EventModel**: This is the main model that is built from the event sequences. It contains a list of `Event` objects that represent the events in the sequence. It also contains a list of `EventSet` objects that represent the possible event sets that can occur in the sequence. |
| 12 | + |
| 13 | +Functionality is present in tel2puml to input and save these "models" as JSON files. Saved models can be loaded back into the tool to be updated with new event sequences. This can provide a way to build up a model over time as more event sequences are collected or in the circumstances that there are large volumes of data that need to be processed. |
| 14 | + |
| 15 | +## Model JSON file format |
| 16 | +The model file is provided as a specific JSON file format. This file format is used to save the model that is built from the event sequences. It should be noted that there will always be a "Dummy" starting event added with `eventType` of `|||START|||` to represent the start of the sequence. This is added to ensure that all events have a starting point so that logic can be derived even for multiple starting points in the actual data. |
| 17 | + |
| 18 | +The JSON file format has the following JSON schema |
| 19 | + |
| 20 | +```json |
| 21 | +{ |
| 22 | + "$schema": "http://json-schema.org/schema#", |
| 23 | + "type": "object", |
| 24 | + "properties": { |
| 25 | + "job_name": { |
| 26 | + "type": "string" |
| 27 | + }, |
| 28 | + "events": { |
| 29 | + "type": "array", |
| 30 | + "items": { |
| 31 | + "type": "object", |
| 32 | + "properties": { |
| 33 | + "eventType": { |
| 34 | + "type": "string" |
| 35 | + }, |
| 36 | + "outgoingEventSets": { |
| 37 | + "type": "array", |
| 38 | + "items": { |
| 39 | + "type": "array", |
| 40 | + "items": { |
| 41 | + "type": "object", |
| 42 | + "properties": { |
| 43 | + "eventType": { |
| 44 | + "type": "string" |
| 45 | + }, |
| 46 | + "count": { |
| 47 | + "type": "integer" |
| 48 | + } |
| 49 | + }, |
| 50 | + "required": [ |
| 51 | + "count", |
| 52 | + "eventType" |
| 53 | + ] |
| 54 | + } |
| 55 | + } |
| 56 | + }, |
| 57 | + "incomingEventSets": { |
| 58 | + "type": "array", |
| 59 | + "items": { |
| 60 | + "type": "array", |
| 61 | + "items": { |
| 62 | + "type": "object", |
| 63 | + "properties": { |
| 64 | + "eventType": { |
| 65 | + "type": "string" |
| 66 | + }, |
| 67 | + "count": { |
| 68 | + "type": "integer" |
| 69 | + } |
| 70 | + }, |
| 71 | + "required": [ |
| 72 | + "count", |
| 73 | + "eventType" |
| 74 | + ] |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | + }, |
| 79 | + "required": [ |
| 80 | + "eventType", |
| 81 | + "incomingEventSets", |
| 82 | + "outgoingEventSets" |
| 83 | + ] |
| 84 | + } |
| 85 | + } |
| 86 | + }, |
| 87 | + "required": [ |
| 88 | + "events", |
| 89 | + "job_name" |
| 90 | + ] |
| 91 | +} |
| 92 | +``` |
| 93 | + |
| 94 | +An example derived using the data in the [end-to-end walkthrough](/docs/e2e_walkthrough/example_pv_event_sequence_files) is shown below |
| 95 | + |
| 96 | +```json |
| 97 | +{ |
| 98 | + "job_name": "Users_Service", |
| 99 | + "events": [ |
| 100 | + { |
| 101 | + "eventType": "return_response_200", |
| 102 | + "outgoingEventSets": [], |
| 103 | + "incomingEventSets": [ |
| 104 | + [{"eventType": "fetch_user_data_200", "count": 1}], |
| 105 | + [{"eventType": "request_data_200", "count": 1}] |
| 106 | + ] |
| 107 | + }, |
| 108 | + { |
| 109 | + "eventType": "fetch_user_data_200", |
| 110 | + "outgoingEventSets": [ |
| 111 | + [{"eventType": "return_response_200", "count": 1}] |
| 112 | + ], |
| 113 | + "incomingEventSets": [ |
| 114 | + [{"eventType": "authorization_check_200", "count": 1}] |
| 115 | + ] |
| 116 | + }, |
| 117 | + { |
| 118 | + "eventType": "authorization_check_200", |
| 119 | + "outgoingEventSets": [ |
| 120 | + [{"eventType": "fetch_user_data_200", "count": 1}], |
| 121 | + [{"eventType": "authorization_check_200", "count": 1}] |
| 122 | + ], |
| 123 | + "incomingEventSets": [ |
| 124 | + [{"eventType": "user_login_200", "count": 1}], |
| 125 | + [{"eventType": "authorization_check_200", "count": 1}] |
| 126 | + ] |
| 127 | + }, |
| 128 | + { |
| 129 | + "eventType": "user_login_200", |
| 130 | + "outgoingEventSets": [ |
| 131 | + [{"eventType": "authenticate_credentials_200", "count": 1}], |
| 132 | + [{"eventType": "authorization_check_200", "count": 1}] |
| 133 | + ], |
| 134 | + "incomingEventSets": [ |
| 135 | + [{"eventType": "|||START|||", "count": 1}] |
| 136 | + ] |
| 137 | + }, |
| 138 | + { |
| 139 | + "eventType": "|||START|||", |
| 140 | + "outgoingEventSets": [ |
| 141 | + [{"eventType": "user_login_200", "count": 1}] |
| 142 | + ], |
| 143 | + "incomingEventSets": [] |
| 144 | + }, |
| 145 | + { |
| 146 | + "eventType": "request_data_200", |
| 147 | + "outgoingEventSets": [ |
| 148 | + [{"eventType": "return_response_200", "count": 1}] |
| 149 | + ], |
| 150 | + "incomingEventSets": [ |
| 151 | + [{"eventType": "session_expired_200", "count": 1}], |
| 152 | + [{"eventType": "validate_session_200", "count": 1}] |
| 153 | + ] |
| 154 | + }, |
| 155 | + { |
| 156 | + "eventType": "validate_session_200", |
| 157 | + "outgoingEventSets": [ |
| 158 | + [{"eventType": "authenticate_credentials_200","count": 1}], |
| 159 | + [{"eventType": "request_data_200", "count": 1}] |
| 160 | + ], |
| 161 | + "incomingEventSets": [ |
| 162 | + [{"eventType": "authenticate_credentials_200", "count": 1}] |
| 163 | + ] |
| 164 | + }, |
| 165 | + { |
| 166 | + "eventType": "authenticate_credentials_200", |
| 167 | + "outgoingEventSets": [ |
| 168 | + [{"eventType": "session_expired_200", "count": 1}], |
| 169 | + [{"eventType": "validate_session_200", "count": 1}] |
| 170 | + ], |
| 171 | + "incomingEventSets": [ |
| 172 | + [{"eventType": "user_login_200", "count": 1}], |
| 173 | + [{"eventType": "session_expired_200", "count": 1}], |
| 174 | + [{"eventType": "validate_session_200", "count": 1}] |
| 175 | + ] |
| 176 | + }, |
| 177 | + { |
| 178 | + "eventType": "session_expired_200", |
| 179 | + "outgoingEventSets": [ |
| 180 | + [{"eventType": "authenticate_credentials_200", "count": 1}], |
| 181 | + [{"eventType": "request_data_200", "count": 1}] |
| 182 | + ], |
| 183 | + "incomingEventSets": [ |
| 184 | + [{"eventType": "authenticate_credentials_200", "count": 1}] |
| 185 | + ] |
| 186 | + } |
| 187 | + ] |
| 188 | +} |
| 189 | +``` |
0 commit comments