Skip to content

Commit

Permalink
Merge pull request #525 from imperialCHEPI/model-schemas
Browse files Browse the repository at this point in the history
Add schemas for model configs
  • Loading branch information
alexdewar authored Sep 23, 2024
2 parents 169d10a + 17869cd commit 88ef3ce
Show file tree
Hide file tree
Showing 10 changed files with 679 additions and 37 deletions.
40 changes: 40 additions & 0 deletions schemas/v1/config/csv_file.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/imperialCHEPI/healthgps/main/schemas/v1/config/csv_file.json",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"format": {
"const": "csv"
},
"delimiter": {
"const": ","
},
"encoding": {
"const": "ASCII"
},
"columns": {
"type": "object",
"additionalProperties": {
"anyOf": [
{
"const": "integer"
},
{
"const": "double"
}
]
}
}
},
"required": [
"name",
"format",
"delimiter",
"encoding",
"columns"
],
"additionalProperties": false
}
37 changes: 1 addition & 36 deletions schemas/v1/config/inputs.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,7 @@
"type": "object",
"properties": {
"dataset": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"format": {
"const": "csv"
},
"delimiter": {
"type": "string"
},
"encoding": {
"type": "string"
},
"columns": {
"type": "object",
"additionalProperties": {
"anyOf": [
{
"const": "integer"
},
{
"const": "double"
}
]
}
}
},
"required": [
"name",
"format",
"delimiter",
"encoding",
"columns"
],
"additionalProperties": false
"$ref": "csv_file.json"
},
"settings": {
"type": "object",
Expand Down
37 changes: 37 additions & 0 deletions schemas/v1/config/models/dummy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/imperialCHEPI/healthgps/main/schemas/v1/config/models/dummy.json",
"type": "object",
"properties": {
"$schema": {
"type": "string"
},
"ModelName": {
"const": "Dummy"
},
"ModelParameters": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"Value": {
"type": "number"
},
"Policy": {
"type": "number"
},
"PolicyStart": {
"type": "integer",
"minimum": 0
}
}
},
"minItems": 1
}
},
"required": [
"ModelName",
"ModelParameters"
],
"additionalProperties": false
}
15 changes: 15 additions & 0 deletions schemas/v1/config/models/dynamic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/imperialCHEPI/healthgps/main/schemas/v1/config/models/dynamic.json",
"anyOf": [
{
"$ref": "dummy.json"
},
{
"$ref": "ebhlm.json"
},
{
"$ref": "kevinhall.json"
}
]
}
119 changes: 119 additions & 0 deletions schemas/v1/config/models/ebhlm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/imperialCHEPI/healthgps/main/schemas/v1/config/models/ebhlm.json",
"type": "object",
"properties": {
"$schema": {
"type": "string"
},
"ModelName": {
"const": "EBHLM"
},
"Country": {
"type": "object",
"properties": {
"Code": {
"type": "integer"
},
"Name": {
"type": "string"
},
"Alpha2": {
"type": "string"
},
"Alpha3": {
"type": "string"
}
},
"required": [
"Code",
"Name",
"Alpha2",
"Alpha3"
],
"additionalProperties": false
},
"BoundaryPercentage": {
"type": "number",
"exclusiveMinimum": 0.0,
"exclusiveMaximum": 1.0
},
"Variables": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Factor": {
"type": "string"
}
},
"required": [
"Name",
"Factor"
],
"additionalProperties": false
},
"minItems": 1
},
"Equations": {
"type": "object",
"propertyNames": {
"pattern": "^[0-9]+\\-[0-9]+$"
},
"additionalProperties": {
"type": "object",
"propertyNames": {
"enum": [
"Male",
"Female"
]
},
"additionalProperties": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Coefficients": {
"type": "object",
"properties": {
"Intercept": {
"type": "number"
}
},
"additionalProperties": {
"type": "number"
},
"required": [
"Intercept"
]
},
"ResidualsStandardDeviation": {
"type": "number"
}
},
"required": [
"Name",
"Coefficients",
"ResidualsStandardDeviation"
],
"additionalProperties": false
}
}
}
}
},
"required": [
"ModelName",
"Country",
"BoundaryPercentage",
"Variables",
"Equations"
],
"additionalProperties": false
}
Loading

0 comments on commit 88ef3ce

Please sign in to comment.