Skip to content

Commit

Permalink
Add vulnerability adjustments field to schema (#81)
Browse files Browse the repository at this point in the history
* added vulnerability adjustments field to schema

* added vuln set to model_settings, renamed vuln adj fields

* added vulnerability options

* separated vulnerability_replacements in replace_file and replace_data
  • Loading branch information
ncerutti authored Jan 29, 2024
1 parent 54338a2 commit e63bf1a
Show file tree
Hide file tree
Showing 2 changed files with 172 additions and 0 deletions.
46 changes: 46 additions & 0 deletions ods_tools/data/analysis_settings_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,52 @@
}
}
},
"vulnerability_adjustments": {
"type": "object",
"title": "Vulnerability Adjustments",
"description": "Object containing vulnerability adjustments and replacements.",
"properties": {
"adjustments": {
"type": "object",
"title": "Vulnerability Factor Adjustments",
"description": "Dictionary containing vulnerability adjustments with vulnerability ID as integer keys and adjustment factors as float values.",
"patternProperties": {
"^[0-9]+$": {
"type": "number",
"minimum": 0
}
},
"additionalProperties": false
},
"replace_data": {
"type": "object",
"title": "Vulnerability Replacements",
"description": "Detailed vulnerability replacements.",
"patternProperties": {
"^[0-9]+$": {
"type": "array",
"items": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": [
{ "type": "integer" },
{ "type": "integer" },
{ "type": "number", "minimum": 0, "maximum": 1 }
]
}
}
},
"additionalProperties": false
},
"replace_file": {
"type": "string",
"title": "Vulnerability Replacement File",
"description": "Path to a CSV file containing vulnerability data to be replaced."
}
},
"additionalProperties": false
},
"gul_output": {
"type": "boolean",
"title": "Produce GUL output",
Expand Down
126 changes: 126 additions & 0 deletions ods_tools/data/model_settings_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,86 @@
"options"
]
},
"vulnerability_set":{
"title":"Vulnerability set selector",
"description":"The 'id' field from options is used as a file suffix, e.g. vulnerability_<id>.bin, vulnerability_<id>.csv, vulnerability_<id>.parquet",
"type":"object",
"uniqueItems":false,
"additionalProperties": false,
"properties":{
"name":{
"type":"string",
"title":"UI Option",
"description":"UI name for selection",
"minLength":1
},
"desc":{
"type":"string",
"title":"Short description",
"description":"UI description for selection"
},
"used_for":{
"type":"string",
"title":"Where the setting is applied",
"description":"Set if this parameter is ONLY used at input 'generation' or for output 'losses'",
"enum":[
"all",
"generation",
"losses"
]
},
"tooltip":{
"type":"string",
"title":"UI tooltip",
"description":"Long description (optional)"
},
"default":{
"type":"string",
"title":"Default footprint set",
"description":"Initial setting for vulnerability set"
},
"options":{
"type":"array",
"title":"Selection options for footprint",
"description":"Array of possible vulnerability sets",
"items":{
"type":"object",
"title":"Selection option element",
"description":"Vulnerability set options",
"additionalProperties":false,
"properties":{
"id":{
"type":"string",
"title":"Vulnerability set suffix",
"description":"String value used to select a vulnerability set",
"minLength":1
},
"desc":{
"type":"string",
"title":"Vulnerability set description",
"description":"UI description for selection",
"minLength":1
},
"tooltip":{
"type":"string",
"title":"UI tooltip",
"description":"Long description (optional)"
}
},
"required":[
"id",
"desc"
]
}
}
},
"required":[
"name",
"desc",
"default",
"options"
]
},
"valid_output_perspectives":{
"type":"array",
"title":"Globally supported loss perspectives",
Expand Down Expand Up @@ -458,6 +538,52 @@
]
}
},
"vulnerability_adjustments": {
"type": "object",
"title": "Vulnerability Adjustments",
"description": "Object containing vulnerability adjustments and replacements.",
"properties": {
"adjustments": {
"type": "object",
"title": "Vulnerability Factor Adjustments",
"description": "Dictionary containing vulnerability adjustments with vulnerability ID as integer keys and adjustment factors as float values.",
"patternProperties": {
"^[0-9]+$": {
"type": "number",
"minimum": 0
}
},
"additionalProperties": false
},
"replace_data": {
"type": "object",
"title": "Vulnerability Replacements",
"description": "Detailed vulnerability replacements.",
"patternProperties": {
"^[0-9]+$": {
"type": "array",
"items": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": [
{ "type": "integer" },
{ "type": "integer" },
{ "type": "number", "minimum": 0, "maximum": 1 }
]
}
}
},
"additionalProperties": false
},
"replace_file": {
"type": "string",
"title": "Vulnerability Replacement File",
"description": "Path to a CSV file containing vulnerability data to be replaced."
}
},
"additionalProperties": false
},
"string_parameters":{
"title":"Single string paramters",
"type":"array",
Expand Down

0 comments on commit e63bf1a

Please sign in to comment.