Skip to content
This repository was archived by the owner on Nov 24, 2021. It is now read-only.

Commit 910ccce

Browse files
authored
Merge pull request #1 from covid-modeling/gorzell/only-pass-modelinput
api: Remove runner related infromation from ModelInput.
2 parents 7404475 + 5af7dbe commit 910ccce

27 files changed

+381
-327
lines changed

packages/api/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@covid-modeling/api",
3-
"version": "0.8.2",
3+
"version": "0.9.0",
44
"main": "dist/src/index",
55
"types": "dist/src/index.d.ts",
66
"scripts": {

packages/api/schema/input.json

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$ref": "#/definitions/RequestInput",
2+
"$ref": "#/definitions/ModelInput",
33
"$schema": "http://json-schema.org/draft-07/schema#",
44
"definitions": {
55
"ISODate": {
@@ -47,29 +47,10 @@
4747
],
4848
"type": "object"
4949
},
50-
"Model": {
51-
"additionalProperties": false,
52-
"properties": {
53-
"imageURL": {
54-
"type": "string"
55-
},
56-
"slug": {
57-
"$ref": "#/definitions/ModelSlug"
58-
}
59-
},
60-
"required": [
61-
"slug",
62-
"imageURL"
63-
],
64-
"type": "object"
65-
},
6650
"ModelInput": {
6751
"additionalProperties": false,
6852
"description": "A generalized description of the input to an epidemiological model.",
6953
"properties": {
70-
"model": {
71-
"$ref": "#/definitions/Model"
72-
},
7354
"parameters": {
7455
"$ref": "#/definitions/ModelParameters"
7556
},
@@ -81,7 +62,6 @@
8162
}
8263
},
8364
"required": [
84-
"model",
8565
"region",
8666
"parameters"
8767
],
@@ -125,47 +105,6 @@
125105
"interventionPeriods"
126106
],
127107
"type": "object"
128-
},
129-
"ModelSlug": {
130-
"enum": [
131-
"mrc-ide-covid-sim",
132-
"basel",
133-
"mc19"
134-
],
135-
"type": "string"
136-
},
137-
"RequestInput": {
138-
"additionalProperties": false,
139-
"properties": {
140-
"callbackURL": {
141-
"type": [
142-
"string",
143-
"null"
144-
]
145-
},
146-
"configuration": {
147-
"$ref": "#/definitions/ModelInput"
148-
},
149-
"id": {
150-
"type": [
151-
"string",
152-
"number"
153-
]
154-
},
155-
"models": {
156-
"items": {
157-
"$ref": "#/definitions/Model"
158-
},
159-
"type": "array"
160-
}
161-
},
162-
"required": [
163-
"id",
164-
"models",
165-
"configuration",
166-
"callbackURL"
167-
],
168-
"type": "object"
169108
}
170109
}
171110
}

packages/api/schema/output.json

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,10 @@
4747
],
4848
"type": "object"
4949
},
50-
"Model": {
51-
"additionalProperties": false,
52-
"properties": {
53-
"imageURL": {
54-
"type": "string"
55-
},
56-
"slug": {
57-
"$ref": "#/definitions/ModelSlug"
58-
}
59-
},
60-
"required": [
61-
"slug",
62-
"imageURL"
63-
],
64-
"type": "object"
65-
},
6650
"ModelInput": {
6751
"additionalProperties": false,
6852
"description": "A generalized description of the input to an epidemiological model.",
6953
"properties": {
70-
"model": {
71-
"$ref": "#/definitions/Model"
72-
},
7354
"parameters": {
7455
"$ref": "#/definitions/ModelParameters"
7556
},
@@ -81,7 +62,6 @@
8162
}
8263
},
8364
"required": [
84-
"model",
8565
"region",
8666
"parameters"
8767
],
@@ -188,14 +168,6 @@
188168
],
189169
"type": "object"
190170
},
191-
"ModelSlug": {
192-
"enum": [
193-
"mrc-ide-covid-sim",
194-
"basel",
195-
"mc19"
196-
],
197-
"type": "string"
198-
},
199171
"SeverityMetrics": {
200172
"additionalProperties": false,
201173
"properties": {

packages/api/schema/runner.json

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
{
2+
"$ref": "#/definitions/RequestInput",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"definitions": {
5+
"ISODate": {
6+
"type": "string"
7+
},
8+
"Intensity": {
9+
"enum": [
10+
"mild",
11+
"moderate",
12+
"aggressive"
13+
],
14+
"type": "string"
15+
},
16+
"InterventionPeriod": {
17+
"additionalProperties": false,
18+
"properties": {
19+
"caseIsolation": {
20+
"$ref": "#/definitions/Intensity",
21+
"description": "The level to which individuals with symptoms self-isolate."
22+
},
23+
"reductionPopulationContact": {
24+
"description": "The estimated reduction in population contact resulting from\nall of the above interventions. Some models require this generalized\nparameter instead of the individual interventions.",
25+
"type": "number"
26+
},
27+
"schoolClosure": {
28+
"$ref": "#/definitions/Intensity",
29+
"description": "The level of school closure in the region."
30+
},
31+
"socialDistancing": {
32+
"$ref": "#/definitions/Intensity",
33+
"description": "The level of social distancing in the region."
34+
},
35+
"startDate": {
36+
"$ref": "#/definitions/ISODate",
37+
"description": "An ISO-8601 string encoding the date that these interventions begin."
38+
},
39+
"voluntaryHomeQuarantine": {
40+
"$ref": "#/definitions/Intensity",
41+
"description": "The level to which entire households self-isolate when one member\nof the household has symptoms."
42+
}
43+
},
44+
"required": [
45+
"startDate",
46+
"reductionPopulationContact"
47+
],
48+
"type": "object"
49+
},
50+
"Model": {
51+
"additionalProperties": false,
52+
"properties": {
53+
"imageURL": {
54+
"type": "string"
55+
},
56+
"slug": {
57+
"$ref": "#/definitions/ModelSlug"
58+
}
59+
},
60+
"required": [
61+
"slug",
62+
"imageURL"
63+
],
64+
"type": "object"
65+
},
66+
"ModelInput": {
67+
"additionalProperties": false,
68+
"description": "A generalized description of the input to an epidemiological model.",
69+
"properties": {
70+
"parameters": {
71+
"$ref": "#/definitions/ModelParameters"
72+
},
73+
"region": {
74+
"type": "string"
75+
},
76+
"subregion": {
77+
"type": "string"
78+
}
79+
},
80+
"required": [
81+
"region",
82+
"parameters"
83+
],
84+
"type": "object"
85+
},
86+
"ModelParameters": {
87+
"additionalProperties": false,
88+
"properties": {
89+
"calibrationCaseCount": {
90+
"description": "The total number of confirmed cases in the region before the calibration date.",
91+
"type": "number"
92+
},
93+
"calibrationDate": {
94+
"$ref": "#/definitions/ISODate",
95+
"description": "An ISO-8601 string encoding the date of the most recent case data in the region."
96+
},
97+
"calibrationDeathCount": {
98+
"description": "The total number of deaths in the region before the calibration date.",
99+
"type": "number"
100+
},
101+
"interventionPeriods": {
102+
"description": "A list of time periods, each with a different set of interventions.",
103+
"items": {
104+
"$ref": "#/definitions/InterventionPeriod"
105+
},
106+
"type": "array"
107+
},
108+
"r0": {
109+
"description": "The assumed reproduction number for the virus. If this is null, then each\nmodel will use its own default value.",
110+
"type": [
111+
"number",
112+
"null"
113+
]
114+
}
115+
},
116+
"required": [
117+
"calibrationDate",
118+
"calibrationCaseCount",
119+
"calibrationDeathCount",
120+
"r0",
121+
"interventionPeriods"
122+
],
123+
"type": "object"
124+
},
125+
"ModelSlug": {
126+
"enum": [
127+
"mrc-ide-covid-sim",
128+
"basel",
129+
"mc19"
130+
],
131+
"type": "string"
132+
},
133+
"RequestInput": {
134+
"additionalProperties": false,
135+
"properties": {
136+
"callbackURL": {
137+
"type": [
138+
"string",
139+
"null"
140+
]
141+
},
142+
"configuration": {
143+
"$ref": "#/definitions/ModelInput"
144+
},
145+
"id": {
146+
"type": [
147+
"string",
148+
"number"
149+
]
150+
},
151+
"models": {
152+
"items": {
153+
"$ref": "#/definitions/Model"
154+
},
155+
"type": "array"
156+
}
157+
},
158+
"required": [
159+
"id",
160+
"models",
161+
"configuration",
162+
"callbackURL"
163+
],
164+
"type": "object"
165+
}
166+
}
167+
}

packages/api/script/generate-schema

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
set -e
44

5+
echo Generating runner schema
6+
ts-json-schema-generator --path src/index.ts --type RequestInput --out schema/runner.json
7+
58
echo Generating input schema
6-
ts-json-schema-generator --path src/index.ts --type RequestInput --out schema/input.json
9+
ts-json-schema-generator --path src/index.ts --type ModelInput --out schema/input.json
710

811
echo Generating output schema
912
ts-json-schema-generator --path src/index.ts --type ModelOutput --out schema/output.json

packages/api/src/model-input.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
import { Model } from './index'
2-
31
/**
42
* A generalized description of the input to an epidemiological model.
53
*/
64
export interface ModelInput {
7-
model: Model
85
region: string
96
subregion?: string
107
parameters: ModelParameters

packages/model-runner/Makefile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ build: format
2323

2424
.PHONY: test
2525
test: build
26-
# FIXME: uncomment this when there are some actual tests
27-
#npm run test
26+
npm run test
2827

2928
.PHONY: integration-test
3029
integration-test: build
31-
# FIXME: uncomment this when there are some actual tests
32-
#npm run integration-test
30+
npm run integration-test
3331

3432
.PHONY: release
3533
release:
@@ -44,6 +42,4 @@ run-local: build
4442

4543
.PHONY: run-remote
4644
run-remote:
47-
./bin/submit-run ~/.github/covid_pat.json test/test-job-mrc-ide-covidsim.json
48-
./bin/submit-run ~/.github/covid_pat.json test/test-job-basel.json
49-
./bin/submit-run ~/.github/covid_pat.json test/test-job-mc19.json
45+
./bin/submit-run ~/.github/covid_pat.json test/test-job-matrix.json

packages/model-runner/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@covid-modeling/model-runner",
3-
"version": "0.8.0",
3+
"version": "1.1.0",
44
"main": "dist/index.js",
55
"scripts": {
66
"test": "PATH=$PATH:../../node_modules/.bin && mocha --debug-brk --ui tdd -r ts-node/register test/unit/*-test.ts",
@@ -19,7 +19,7 @@
1919
"dependencies": {
2020
"@azure/identity": "^1.1.0-preview1",
2121
"@azure/storage-blob": "^12.1.1",
22-
"@covid-modeling/api": "0.8.*",
22+
"@covid-modeling/api": "0.9.*",
2323
"archiver": "^4.0.1",
2424
"d3": "^5.15.0",
2525
"dockerode": "^3.2.0",

0 commit comments

Comments
 (0)