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

[WIP] Add json schema experimentation #4

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
6 changes: 6 additions & 0 deletions json-schema/hubmeta-examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# `hubmeta` examples

The folder contains modified (for JSON parsing correctness & minor contents modification) of examples files in [`hub-infrastructure-experiments/metadata-format-examples`](https://github.com/reichlab/hub-infrastructure-experiments/tree/main/metadata-format-examples).

- **`simple-hubmeta.json`** is modified from [`hub-infrastructure-experiements/simple-example/model-task-metadata-proposal.json`](https://github.com/reichlab/hub-infrastructure-experiments/blob/main/metadata-format-examples/simple-example/model-task-metadata-proposal.json)
- **`complex-hubmeta.json`** is modified from [`hub-infrastructure-experiements/complex-example/model-task-metadata-proposal.json`](https://github.com/reichlab/hub-infrastructure-experiments/blob/main/metadata-format-examples/complex-example/model-task-metadata-proposal.json)
165 changes: 165 additions & 0 deletions json-schema/hubmeta-examples/complex-hubmeta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
{
"round-1": {
"model_tasks": [
{
"task_ids": {
"origin_date": {
"required": ["2022-09-03"],
"optional": null
},
"scenario_id": {
"required": [1],
"optional": null
},
"location": {
"required": {
"$ref": "#/$defs/task_ids/location/us_states"
},
"optional": ["US"]
},
"target": {
"required": null,
"optional": ["weekly rate"]
},
"horizon": {
"required": null,
"optional": [1, 2]
}
},
"output_types": {
"mean": {
"type_id": {
"required": null,
"optional": ["NA"]
},
"value": {
"type": "integer",
"minimum": 0
}
},
"quantile": {
"type_id": {
"required": [0.25, 0.5, 0.75],
"optional": [0.1, 0.2, 0.3, 0.4, 0.6, 0.7, 0.8, 0.9]
},
"value": {
"type": "integer",
"minimum": 0
}
},
"cdf": {
"type_id": {
"required": [10.0, 20.0],
"optional": null
},
"value": {
"type": "numeric",
"minimum": 0.0,
"maximum": 1.0
}
}
}
},
{
"task_ids": {
"origin_date": {
"required": ["2022-09-03"],
"optional": null
},
"scenario_id": {
"required": [1],
"optional": null
},
"location": {
"required": {
"$ref": "#/$defs/task_ids/location/us_states"
},
"optional": ["US"]
},
"target": {
"required": null,
"optional": ["peak week"]
},
"horizon": {
"required": null,
"optional": ["NA"]
}
},
"output_types": {
"cdf": {
"type_id": {
"required": ["EW202240", "EW202241", "EW202242", "EW202243", "EW202244", "EW202245", "EW202246", "EW202247", "EW202248", "EW202249", "EW202250", "EW202251", "EW202252", "EW202301", "EW202302", "EW202303", "EW202304", "EW202305", "EW202306", "EW202307", "EW202308", "EW202309", "EW202310", "EW2023011", "EW202312", "EW202313", "EW202314", "EW202315", "EW202316", "EW202317", "EW202318", "EW202319", "EW202320"],
"optional": null
},
"value": {
"type": "numeric",
"minimum": 0
}
}
}
}
],
"submissions_due": {
"start": "2022-09-01",
"end": "2022-09-05"
}
},
"round-2": {
"model_tasks": [
{
"task_ids": {
"origin_date": {
"required": ["2022-10-01"],
"optional": null
},
"scenario_id": {
"required": null,
"optional": [2, 3]
},
"location": {
"required": {
"$ref": "#/$defs/task_ids/location/us_states"
},
"optional": ["US"]
},
"target": {
"required": null,
"optional": ["weekly rate"]
},
"age_group": {
"required": null,
"optional": ["0-5", "6-18", "19-24", "25-64", "65+"]
},
"horizon": {
"required": null,
"optional": [1, 2]
}
},
"output_types": {
"quantile": {
"type_id": {
"required": [0.25, 0.5, 0.75],
"optional": [0.1, 0.2, 0.3, 0.4, 0.6, 0.7, 0.8, 0.9]
},
"value": {
"type": "integer",
"minimum": 0
}
}
}
}
],
"submissions_due": {
"start": "2022-09-28",
"end": "2022-10-01"
},
"last_data_date": "2022-09-30"
},
"$defs": {
"task_ids": {
"location": {
"us_states": ["01", "02", "04", "05", "06", "08", "09", "10", "11", "12", "13", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "44", "45", "46", "47", "48", "49", "50", "51", "53", "54", "55", "56"]
}
}
}
}
49 changes: 49 additions & 0 deletions json-schema/hubmeta-examples/simple-hubmeta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"round_id_from_variable": {
"model_tasks": [
{
"task_ids": {
"origin_date": {
"required": null,
"optional": ["2022-01-08", "2022-01-15", "2022-01-22", "2022-01-29", "2022-02-05", "2022-02-12", "2022-02-19", "2022-02-26", "2022-03-05", "2022-03-12", "2022-03-19", "2022-03-26", "2022-04-02", "2022-04-09", "2022-04-16", "2022-04-23", "2022-04-30", "2022-05-07", "2022-05-14", "2022-05-21", "2022-05-28", "2022-06-04", "2022-06-11", "2022-06-18"]},
"location": {
"required": null,
"optional": ["01", "02", "04", "05", "06", "08", "09", "10", "11", "12", "13", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "44", "45", "46", "47", "48", "49", "50", "51", "53", "54", "55", "56", "72", "78", "US"]
},
"horizon": {
"required": null,
"optional": [1, 2, 3, 4]
}
},
"output_types": {
"mean": {
"type_id": {
"required": null,
"optional": ["NA"]
},
"value": {
"type": "integer",
"minimum": 0
}
},
"quantile": {
"type_id": {
"required": null,
"optional": [0.01, 0.025, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 0.975, 0.99]
},
"value": {
"type": "integer",
"minimum": 0
}
}
}
}
],
"round_id_variable": "origin_date",
"submissions_due": {
"relative_to": "origin_date",
"start": -4,
"end": 2
}
}
}
19 changes: 19 additions & 0 deletions json-schema/hubmeta-schema-generated/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated `hubmeta` json schema examples

The folder contains json schema examples of files in [`hub-infrastructure-experiments/json-schema/modified-hubmeta-examples`](https://github.com/reichlab/hub-infrastructure-experiments/tree/main/json-schema/modified-hubmeta-examples), automatically generated from site <https://www.liquid-technologies.com/online-json-to-schema-converter>.

### Generator settings

- Array rules: List Validation
- [x] defaultAdditionalItems
- [x] defaultAdditionalProperties
- [x] Infer enum values
- [x] Make required
- Indent character: Space
- Indent depth: 2
- [x] Quote names
- Quote character: Double Quote (")


- **`simple-hubmeta-schema.json`** was generated from [`hub-infrastructure-experiements/json-schema/modified-hubmeta-examples/simple-hubmeta-mod.json`](https://github.com/reichlab/hub-infrastructure-experiments/blob/main/json-schema/modified-hubmeta-examples/simple-hubmeta-mod.json)
- **`complex-hubmeta-schema.json`** was generated from [`hub-infrastructure-experiements/json-schema/modified-hubmeta-examples/complex-hubmeta-mod.json`](https://github.com/reichlab/hub-infrastructure-experiments/blob/main/json-schema/json-schema/modified-hubmeta-examples/complex-hubmeta-mod.json)
Loading