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

Commit 4aa457c

Browse files
authored
Merge pull request #16 from covid-modeling/adityasharad/mc19-update
MC19 connector: Bring in line with latest model
2 parents 76919de + be1fc26 commit 4aa457c

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
MC19_VERSION=2fac86bf6
1+
MC19_VERSION=2e3044525

packages/modelingcovid-covidmodel/connector.wl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
the input/output schema used by the unified modelling UI. *)
55

66
(* Exit whenever an error message is raised. *)
7-
messageHandler = If[Last[#], Abort[]] &;
7+
messageHandler = If[Last[#], Exit[1]] &;
88
Internal`AddHandler["Message", messageHandler];
99

1010
(* Command-line arguments: <inputFile> <outputFile> *)
@@ -116,7 +116,7 @@ translateInput[modelInput_]:=Module[{
116116

117117
(* TODO: These are copied from modules in data.wl,
118118
and should be shared instead. *)
119-
smoothing = 3;
119+
smoothing = 7;
120120
SlowJoin := Fold[Module[{smoother},
121121
smoother=1-Exp[-Range[Length[#2]]/smoothing];
122122
Join[#1, Last[#1](1-smoother)+#2 smoother]]&];
@@ -128,6 +128,14 @@ translateInput[modelInput_]:=Module[{
128128
Assert[Length[fullDistancing] == Length[fullDays]];
129129
Off[Assert];
130130

131+
distancingDelay = 5;
132+
Which[
133+
distancingDelay>0,
134+
smoothedFullDistancing=Join[ConstantArray[1,distancingDelay], smoothedFullDistancing[[;;-distancingDelay-1]]];,
135+
distancingDelay<0,
136+
smoothedFullDistancing=Join[smoothedFullDistancing[[distancingDelay+1;;]], ConstantArray[1,Abs[distancingDelay]]];
137+
];
138+
131139
distancingFunction = Interpolation[
132140
Transpose[{
133141
fullDays,
@@ -241,11 +249,12 @@ Print["Running model"];
241249
CreateDirectory["public/json/"<>stateCode<>"/"<>scenario1["id"]];
242250
CreateDirectory["public/json/"<>stateCode<>"/"<>customScenario["id"]];
243251
CreateDirectory["tests"];
244-
data = GenerateModelExport[10, {stateCode}];
252+
data = GenerateModelExport[1, {stateCode}];
245253

246254
Print["Translating output for unified UI"];
247255
timeSeriesData = data[stateCode]["scenarios"][customScenario["id"]]["timeSeriesData"];
248256
modelOutput = translateOutput[modelInput, stateCode, timeSeriesData];
249257

250258
Print["Writing output for unified UI to ", outputFile];
251-
Export[outputFile, modelOutput];
259+
Export[DirectoryName[outputFile] <> "/rawTimeSeries.json", timeSeriesData];
260+
Export[outputFile, modelOutput];

packages/modelingcovid-covidmodel/test/test-job.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
{
2-
"model": {
3-
"slug": "mc19",
4-
"imageURL": "docker.pkg.github.com/covid-modeling/model-runner/modelingcovid-covidmodel-connector:latest"
5-
},
62
"region": "US",
73
"subregion": "US-NY",
84
"parameters": {

0 commit comments

Comments
 (0)