Selections
Provides an SSVC selection object and functions to facilitate transition from an SSVC decision point to a selection.
MinimalDecisionPointValue
Bases: _Base
, _Keyed
, BaseModel
A minimal representation of a decision point value. Intended to parallel the DecisionPointValue object, but with fewer required fields. A decision point value is uniquely identified within a decision point by its key. Globally, the combination of Decision Point namespace, key, and version coupled with the value key uniquely identifies a value across all decision points and values. Other required fields in the DecisionPointValue object, such as name and description, are optional here.
Source code in src/ssvc/selection.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
validate_values(data)
If name or description are empty strings, set them to None so that they are not included in the JSON output when serialized using model_dump_json.
Source code in src/ssvc/selection.py
71 72 73 74 75 76 77 78 79 80 81 |
|
Reference
Bases: BaseModel
A reference to a resource that provides additional context about the decision points or selections. This object is intentionally minimal and contains only the URL and an optional description.
Source code in src/ssvc/selection.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
Selection
Bases: _Valued
, _Versioned
, _Keyed
, _Namespaced
, _Base
, BaseModel
A minimal selection object that contains the decision point ID and the selected values. While the Selection object parallels the DecisionPoint object, it is intentionally minimal, with fewer required fields and no additional metadata, as it is meant to represent a selection made from a previously defined decision point. The expectation is that a Selection object will usually have fewer values than the original decision point, as it represents a specific evaluation at a specific time and may therefore rule out some values that were previously considered. Other fields like name and description may be copied from the decision point, but are not required.
Source code in src/ssvc/selection.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
from_decision_point(decision_point, include_optional=False)
classmethod
Converts a decision point to a minimal selection object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
decision_point
|
DecisionPoint
|
The decision point to convert. |
required |
Returns:
Name | Type | Description |
---|---|---|
Selection |
Selection
|
The resulting minimal selection object. |
Source code in src/ssvc/selection.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
|
SelectionList
Bases: _Timestamped
, BaseModel
A list decision point selections that represent an evaluation at a specific time of evaluation. Individual selections are derived from decision points, and each selection contains a minimal representation of the decision point and the selected values.
A SelectionList requires a timestamp in RFC 3339 format, which indicates when the selections were made.
Optional fields include
target_ids
: If present, a non-empty list of identifiers for the item or items being evaluated.resources
: If present, a non-empty list of references to resources that provide additional context about the decision points found in this selection. Resources point to documentation, JSON files, or other relevant information that describe what the decision points are and how they should be interpreted.references
: If present, a non-empty list of references to resources that provide additional context about the specific values selected. References point to reports, advisories, or other relevant information that describe why the selected values were chosen.
Source code in src/ssvc/selection.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
|
add_selection(selection)
Adds a minimal selection to the list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
selection
|
Selection
|
The minimal selection to add. |
required |
Source code in src/ssvc/selection.py
295 296 297 298 299 300 301 302 |
|
validate_target_ids(value)
classmethod
Validate the target_ids field. If target_ids is provided, it must be a non-empty list of strings.
Source code in src/ssvc/selection.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
|
main()
Prints example selections and their schema in JSON format.
Returns:
Type | Description |
---|---|
None
|
None |
Source code in src/ssvc/selection.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
|