Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vulnerability adjustments field to schema #81

Merged
merged 4 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -389,6 +389,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 @@ -449,6 +529,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