hubverse-org / schemas

JSON schemas for modeling hubs
Creative Commons Zero v1.0 Universal
4 stars 3 forks source link

Encode point estimate output type IDs with null. #111

Closed annakrystalli closed 4 weeks ago

annakrystalli commented 4 weeks ago

Resolves #109

annakrystalli commented 4 weeks ago

/diff

github-actions[bot] commented 4 weeks ago

Here are your diffs for this pull request

admin-schema.json

--- v3.0.1/admin-schema.json    2024-10-25 07:55:06.600991849 +0000
+++ v4.0.0/admin-schema.json    2024-10-25 07:55:07.412990389 +0000
@@ -1,6 +1,6 @@
 {
     "$schema": "https://json-schema.org/draft/2020-12/schema",
-    "$id": "https://raw.githubusercontent.com/hubverse-org/schemas/main/v3.0.1/admin-schema.json",
+    "$id": "https://raw.githubusercontent.com/hubverse-org/schemas/main/v4.0.0/admin-schema.json",
     "title": "Schema for Modeling Hub administrative settings",
     "description": "This JSON file provides a schema for modeling hub administrative information.",
     "type": "object",
@@ -59,9 +59,11 @@
                     ]
                 },
                 "owner": {
+                    "description": "The hub repository owner (user or organisation).",
                     "type": "string"
                 },
                 "name": {
+                    "description": "The name of the hub repository.",
                     "type": "string"
                 }
             }

tasks-schema.json

--- v3.0.1/tasks-schema.json    2024-10-25 07:55:06.600991849 +0000
+++ v4.0.0/tasks-schema.json    2024-10-25 07:55:07.412990389 +0000
@@ -1,6 +1,6 @@
 {
     "$schema": "https://json-schema.org/draft/2020-12/schema",
-    "$id": "https://raw.githubusercontent.com/hubverse-org/schemas/main/v3.0.1/tasks-schema.json",
+    "$id": "https://raw.githubusercontent.com/hubverse-org/schemas/main/v4.0.0/tasks-schema.json",
     "title": "Schema for Modeling Hub model task definitions",
     "description": "This is the schema of the tasks.json configuration file that defines the tasks within a modeling hub.",
     "type": "object",
@@ -200,7 +200,9 @@
                                             "description": "An object containing arrays of required and optional unique identifiers for each valid location, e.g. country codes, FIPS state or county level code etc.",
                                             "examples": [
                                                 {
-                                                    "required": "US",
+                                                    "required": [
+                                                        "US"
+                                                    ],
                                                     "optional": [
                                                         "01",
                                                         "02",
@@ -650,59 +652,21 @@
                                             "description": "Object defining the mean of the predictive distribution output type.",
                                             "properties": {
                                                 "output_type_id": {
-                                                    "description": "output_type_id is not meaningful for a mean output_type. The property is primarily used to determine whether mean is a required or optional output type through properties required and optional. If mean is a required output type, the required property must be an array containing the single string element 'NA' and the optional property must be set to null. If mean is an optional output type, the optional property must be an array containing the single string element 'NA' and the required property must be set to null",
+                                                    "description": "output_type_id is not meaningful for a point estimate output_type. Must be null",
                                                     "examples": [
                                                         {
-                                                            "required": [
-                                                                "NA"
-                                                            ],
-                                                            "optional": null
-                                                        },
-                                                        {
-                                                            "required": null,
-                                                            "optional": [
-                                                                "NA"
-                                                            ]
+                                                            "required": null
                                                         }
                                                     ],
                                                     "type": "object",
-                                                    "oneOf": [
-                                                        {
-                                                            "properties": {
-                                                                "required": {
-                                                                    "description": "When mean is required, property set to single element 'NA' array",
-                                                                    "type": "array",
-                                                                    "items": {
-                                                                        "const": "NA",
-                                                                        "maxItems": 1
-                                                                    }
-                                                                },
-                                                                "optional": {
-                                                                    "description": "When mean is required, property set to null",
-                                                                    "type": "null"
-                                                                }
-                                                            }
-                                                        },
-                                                        {
-                                                            "properties": {
-                                                                "required": {
-                                                                    "description": "When mean is optional, property set to null",
-                                                                    "type": "null"
-                                                                },
-                                                                "optional": {
-                                                                    "description": "When mean is optional, property set to single element 'NA' array",
-                                                                    "type": "array",
-                                                                    "items": {
-                                                                        "const": "NA",
-                                                                        "maxItems": 1
-                                                                    }
-                                                                }
-                                                            }
+                                                    "properties": {
+                                                        "required": {
+                                                            "description": "Not relevant for point estimate output types. Must be null.",
+                                                            "type": "null"
                                                         }
-                                                    ],
+                                                    },
                                                     "required": [
-                                                        "required",
-                                                        "optional"
+                                                        "required"
                                                     ]
                                                 },
                                                 "value": {
@@ -741,11 +705,24 @@
                                                     "required": [
                                                         "type"
                                                     ]
+                                                },
+                                                "is_required": {
+                                                    "description": "Is output type required? When required, property should be set to 'true'. If output type is optional, set to 'false'.",
+                                                    "examples": [
+                                                        {
+                                                            "is_required": true
+                                                        },
+                                                        {
+                                                            "is_required": false
+                                                        }
+                                                    ],
+                                                    "type": "boolean"
                                                 }
                                             },
                                             "required": [
                                                 "output_type_id",
-                                                "value"
+                                                "value",
+                                                "is_required"
                                             ]
                                         },
                                         "median": {
@@ -753,64 +730,26 @@
                                             "description": "Object defining the median of the predictive distribution output type",
                                             "properties": {
                                                 "output_type_id": {
-                                                    "description": "output_type_id is not meaningful for a median output_type. The property is primarily used to determine whether median is a required or optional output type through properties required and optional. If median is a required output type, the required property must be an array containing the single string element 'NA' and the optional property must be set to null. If median is an optional output type, the optional property must be an array containing the single string element 'NA' and the required property must be set to null",
+                                                    "description": "output_type_id is not meaningful for a point estimate output_type. Must be null",
                                                     "examples": [
                                                         {
-                                                            "required": [
-                                                                "NA"
-                                                            ],
-                                                            "optional": null
-                                                        },
-                                                        {
-                                                            "required": null,
-                                                            "optional": [
-                                                                "NA"
-                                                            ]
+                                                            "required": null
                                                         }
                                                     ],
                                                     "type": "object",
-                                                    "oneOf": [
-                                                        {
-                                                            "properties": {
-                                                                "required": {
-                                                                    "description": "When median is required, property set to single element 'NA' array",
-                                                                    "type": "array",
-                                                                    "items": {
-                                                                        "const": "NA",
-                                                                        "maxItems": 1
-                                                                    }
-                                                                },
-                                                                "optional": {
-                                                                    "description": "When median is required, property set to null",
-                                                                    "type": "null"
-                                                                }
-                                                            }
-                                                        },
-                                                        {
-                                                            "properties": {
-                                                                "required": {
-                                                                    "description": "When median is optional, property set to null",
-                                                                    "type": "null"
-                                                                },
-                                                                "optional": {
-                                                                    "description": "When median is optional, property set to single element 'NA' array",
-                                                                    "type": "array",
-                                                                    "items": {
-                                                                        "const": "NA",
-                                                                        "maxItems": 1
-                                                                    }
-                                                                }
-                                                            }
+                                                    "properties": {
+                                                        "required": {
+                                                            "description": "Not relevant for point estimate output types. Must be null.",
+                                                            "type": "null"
                                                         }
-                                                    ],
+                                                    },
                                                     "required": [
-                                                        "required",
-                                                        "optional"
+                                                        "required"
                                                     ]
                                                 },
                                                 "value": {
                                                     "type": "object",
-                                                    "description": "Object defining the characteristics of valid median values",
+                                                    "description": "Object defining the characteristics of valid median values.",
                                                     "examples": [
                                                         {
                                                             "type": "double",
@@ -819,7 +758,7 @@
                                                     ],
                                                     "properties": {
                                                         "type": {
-                                                            "description": "Data type of median values",
+                                                            "description": "Data type of median values.",
                                                             "type": "string",
                                                             "enum": [
                                                                 "double",
@@ -844,11 +783,24 @@
                                                     "required": [
                                                         "type"
                                                     ]
+                                                },
+                                                "is_required": {
+                                                    "description": "Is output type required? When required, property should be set to 'true'. If output type is optional, set to 'false'.",
+                                                    "examples": [
+                                                        {
+                                                            "is_required": true
+                                                        },
+                                                        {
+                                                            "is_required": false
+                                                        }
+                                                    ],
+                                                    "type": "boolean"
                                                 }
                                             },
                                             "required": [
                                                 "output_type_id",
-                                                "value"
+                                                "value",
+                                                "is_required"
                                             ]
                                         },
                                         "quantile": {
@@ -856,21 +808,19 @@
                                             "type": "object",
                                             "properties": {
                                                 "output_type_id": {
-                                                    "description": "Object containing required and optional arrays defining the probability levels at which quantiles of the predictive distribution will be recorded.",
+                                                    "description": "Object containing arrays of required probability levels at which quantiles of the predictive distribution will be recorded.",
                                                     "examples": [
                                                         {
                                                             "required": [
-                                                                0.25,
-                                                                0.5,
-                                                                0.75
-                                                            ],
-                                                            "optional": [
                                                                 0.1,
                                                                 0.2,
+                                                                0.25,
                                                                 0.3,
                                                                 0.4,
+                                                                0.5,
                                                                 0.6,
                                                                 0.7,
+                                                                0.75,
                                                                 0.8,
                                                                 0.9
                                                             ]
@@ -879,24 +829,8 @@
                                                     "type": "object",
                                                     "properties": {
                                                         "required": {
-                                                            "description": "Array of unique probability levels between 0 and 1 that must be present for submission to be valid. Can be null if no probability levels are required and all valid probability levels are specified in the optional property.",
-                                                            "type": [
-                                                                "array",
-                                                                "null"
-                                                            ],
-                                                            "uniqueItems": true,
-                                                            "items": {
-                                                                "type": "number",
-                                                                "minimum": 0,
-                                                                "maximum": 1
-                                                            }
-                                                        },
-                                                        "optional": {
-                                                            "description": "Array of valid but not required unique probability levels. Can be null if all probability levels are required and are specified in the required property.",
-                                                            "type": [
-                                                                "array",
-                                                                "null"
-                                                            ],
+                                                            "description": "Array of unique probability levels between 0 and 1 inclusive that must be present for submission to be valid.",
+                                                            "type": "array",
                                                             "uniqueItems": true,
                                                             "items": {
                                                                 "type": "number",
@@ -906,8 +840,7 @@
                                                         }
                                                     },
                                                     "required": [
-                                                        "required",
-                                                        "optional"
+                                                        "required"
                                                     ]
                                                 },
                                                 "value": {
@@ -946,11 +879,24 @@
                                                     "required": [
                                                         "type"
                                                     ]
+                                                },
+                                                "is_required": {
+                                                    "description": "Is output type required? When required, property should be set to 'true'. If output type is optional, set to 'false'.",
+                                                    "examples": [
+                                                        {
+                                                            "is_required": true
+                                                        },
+                                                        {
+                                                            "is_required": false
+                                                        }
+                                                    ],
+                                                    "type": "boolean"
                                                 }
                                             },
                                             "required": [
                                                 "output_type_id",
-                                                "value"
+                                                "value",
+                                                "is_required"
                                             ]
                                         },
                                         "cdf": {
@@ -958,14 +904,13 @@
                                             "type": "object",
                                             "properties": {
                                                 "output_type_id": {
-                                                    "description": "Object containing required and optional arrays defining possible values of the target variable at which values of the cumulative distribution function of the predictive distribution will be recorded. These should be listed in order from low to high.",
+                                                    "description": "Object containing required arrays defining possible values of the target variable at which values of the cumulative distribution function of the predictive distribution will be recorded. These should be listed in order from low to high.",
                                                     "examples": [
                                                         {
                                                             "required": [
                                                                 10,
                                                                 20
-                                                            ],
-                                                            "optional": null
+                                                            ]
                                                         },
                                                         {
                                                             "required": [
@@ -977,40 +922,14 @@
                                                                 "EW202245",
                                                                 "EW202246",
                                                                 "EW202247"
-                                                            ],
-                                                            "optional": null
+                                                            ]
                                                         }
                                                     ],
                                                     "type": "object",
                                                     "properties": {
                                                         "required": {
-                                                            "description": "Array of unique target values that must be present for submission to be valid. Can be null if no target values are required and all valid target values are specified in the optional property.",
-                                                            "type": [
-                                                                "array",
-                                                                "null"
-                                                            ],
-                                                            "uniqueItems": true,
-                                                            "items": {
-                                                                "oneOf": [
-                                                                    {
-                                                                        "type": [
-                                                                            "number",
-                                                                            "integer"
-                                                                        ],
-                                                                        "minimum": 0
-                                                                    },
-                                                                    {
-                                                                        "type": "string"
-                                                                    }
-                                                                ]
-                                                            }
-                                                        },
-                                                        "optional": {
-                                                            "description": "Array of valid but not required unique target values. Can be null if all target values are required and are specified in the required property.",
-                                                            "type": [
-                                                                "array",
-                                                                "null"
-                                                            ],
+                                                            "description": "Array of unique target values that must be present for submission to be valid.",
+                                                            "type": "array",
                                                             "uniqueItems": true,
                                                             "items": {
                                                                 "oneOf": [
@@ -1029,8 +948,7 @@
                                                         }
                                                     },
                                                     "required": [
-                                                        "required",
-                                                        "optional"
+                                                        "required"
                                                     ]
                                                 },
                                                 "value": {
@@ -1058,11 +976,24 @@
                                                         "minimum",
                                                         "maximum"
                                                     ]
+                                                },
+                                                "is_required": {
+                                                    "description": "Is output type required? When required, property should be set to 'true'. If output type is optional, set to 'false'.",
+                                                    "examples": [
+                                                        {
+                                                            "is_required": true
+                                                        },
+                                                        {
+                                                            "is_required": false
+                                                        }
+                                                    ],
+                                                    "type": "boolean"
                                                 }
                                             },
                                             "required": [
                                                 "output_type_id",
-                                                "value"
+                                                "value",
+                                                "is_required"
                                             ]
                                         },
                                         "pmf": {
@@ -1070,11 +1001,10 @@
                                             "type": "object",
                                             "properties": {
                                                 "output_type_id": {
-                                                    "description": "Object containing required and optional arrays specifying valid categories of a discrete variable. Note that for ordinal variables, the category levels should be listed in order from low to high.",
+                                                    "description": "Object containing arrays of required values specifying valid categories of a discrete variable. Note that for ordinal variables, the category levels should be listed in order from low to high.",
                                                     "examples": [
                                                         {
-                                                            "required": null,
-                                                            "optional": [
+                                                            "required": [
                                                                 "low",
                                                                 "moderate",
                                                                 "high",
@@ -1085,22 +1015,8 @@
                                                     "type": "object",
                                                     "properties": {
                                                         "required": {
-                                                            "description": "Array of unique categories of a discrete variable that must be present for submission to be valid. Can be null if no categories are required and all valid categories are specified in the optional property.",
-                                                            "type": [
-                                                                "array",
-                                                                "null"
-                                                            ],
-                                                            "uniqueItems": true,
-                                                            "items": {
-                                                                "type": "string"
-                                                            }
-                                                        },
-                                                        "optional": {
-                                                            "description": "Array of valid but not required unique categories of a discrete variable. Can be null if all categories are required and are specified in the required property.",
-                                                            "type": [
-                                                                "array",
-                                                                "null"
-                                                            ],
+                                                            "description": "Array of unique categories of a discrete variable that must be present for submission to be valid.",
+                                                            "type": "array",
                                                             "uniqueItems": true,
                                                             "items": {
                                                                 "type": "string"
@@ -1108,8 +1024,7 @@
                                                         }
                                                     },
                                                     "required": [
-                                                        "required",
-                                                        "optional"
+                                                        "required"
                                                     ]
                                                 },
                                                 "value": {
@@ -1141,11 +1056,24 @@
                                                         "minimum",
                                                         "maximum"
                                                     ]
+                                                },
+                                                "is_required": {
+                                                    "description": "Is output type required? When required, property should be set to 'true'. If output type is optional, set to 'false'.",
+                                                    "examples": [
+                                                        {
+                                                            "is_required": true
+                                                        },
+                                                        {
+                                                            "is_required": false
+                                                        }
+                                                    ],
+                                                    "type": "boolean"
                                                 }
                                             },
                                             "required": [
                                                 "output_type_id",
-                                                "value"
+                                                "value",
+                                                "is_required"
                                             ]
                                         },
                                         "sample": {
@@ -1157,7 +1085,6 @@
                                                     "examples": [
                                                         {
                                                             "output_type_id_params": {
-                                                                "is_required": true,
                                                                 "type": "integer",
                                                                 "min_samples_per_task": 100,
                                                                 "max_samples_per_task": 100
@@ -1165,7 +1092,6 @@
                                                         },
                                                         {
                                                             "output_type_id_params": {
-                                                                "is_required": false,
                                                                 "type": "character",
                                                                 "max_length": 6,
                                                                 "min_samples_per_task": 100,
@@ -1181,10 +1107,6 @@
                                                     ],
                                                     "type": "object",
                                                     "properties": {
-                                                        "is_required": {
-                                                            "description": "Boolean. Whether inclusion of samples is required for the submission to be valid",
-                                                            "type": "boolean"
-                                                        },
                                                         "type": {
                                                             "description": "Data type of sample indices.",
                                                             "type": "string",
@@ -1220,7 +1142,6 @@
                                                         }
                                                     },
                                                     "required": [
-                                                        "is_required",
                                                         "type",
                                                         "min_samples_per_task",
                                                         "max_samples_per_task"
@@ -1273,11 +1194,24 @@
                                                     "required": [
                                                         "type"
                                                     ]
+                                                },
+                                                "is_required": {
+                                                    "description": "Is output type required? When required, property should be set to 'true'. If output type is optional, set to 'false'.",
+                                                    "examples": [
+                                                        {
+                                                            "is_required": true
+                                                        },
+                                                        {
+                                                            "is_required": false
+                                                        }
+                                                    ],
+                                                    "type": "boolean"
                                                 }
                                             },
                                             "required": [
                                                 "output_type_id_params",
-                                                "value"
+                                                "value",
+                                                "is_required"
                                             ]
                                         }
                                     },
@@ -1340,7 +1274,10 @@
                                                 "type": [
                                                     "object",
                                                     "null"
-                                                ]
+                                                ],
+                                                "additionalProperties": {
+                                                    "type": "string"
+                                                }
                                             },
                                             "description": {
                                                 "description": "a verbose description of the target that might include information such as the target_measure above, or definitions of a 'rate' or similar.",
@@ -1503,6 +1440,22 @@
                                 "arrow"
                             ]
                         }
+                    },
+                    "derived_task_ids": {
+                        "description": "Names of derived task IDs, i.e. task IDs whose values are derived from (and therefore dependent on) the values of other variables. Use this property to override the global setting for a specific round.",
+                        "examples": [
+                            [
+                                "target_end_date"
+                            ]
+                        ],
+                        "type": [
+                            "array",
+                            "null"
+                        ],
+                        "uniqueItems": true,
+                        "items": {
+                            "type": "string"
+                        }
                     }
                 },
                 "required": [
@@ -1529,6 +1482,22 @@
                 "logical",
                 "Date"
             ]
+        },
+        "derived_task_ids": {
+            "description": "Names of derived task IDs, i.e. task IDs whose values are derived from (and therefore dependent on) the values of other variables.",
+            "examples": [
+                [
+                    "target_end_date"
+                ]
+            ],
+            "type": [
+                "array",
+                "null"
+            ],
+            "uniqueItems": true,
+            "items": {
+                "type": "string"
+            }
         }
     },
     "required": [
annakrystalli commented 4 weeks ago

Thanks @zkamvar .

None of the proposed schema changes work yet because the functionality to support it hasn't been developed yet.

The usual development process is to queue up the new version in schema repo br-newversion branch and then build the new functionality against it. All we need to concern ourselves in this PR is the correctecness of the schema. The rest will be developed in the individual packages affected. I have plans for each that are separate for this.