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

Commit fadec00

Browse files
gorzellaeisenberg
authored andcommitted
mrc-ide-covidsim: Add support for Nigeria.
Add support of Nigeria. Since it has an alternate pre-params file, I added an optional field to to the admin mappings to support making this generally configurable.
1 parent cc5c480 commit fadec00

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

packages/mrc-ide-covidsim/src/admin-mappings.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ISO-3166
2-
export const EUROPE_COUNTRY_PARAMS_BY_ISO_CODE = {
2+
export const COUNTRY_PARAMS_BY_ISO_CODE = {
33
AT: {
44
adminFileName: 'Austria_admin.txt',
55
subregions: {},
@@ -166,6 +166,11 @@ export const EUROPE_COUNTRY_PARAMS_BY_ISO_CODE = {
166166
'GB-LND': 'London',
167167
},
168168
},
169+
NG: {
170+
adminFileName: 'Nigeria_admin.txt',
171+
preParamsFileName: 'preNGA_R0=2.0.txt',
172+
subregions: {},
173+
},
169174
}
170175

171176
// https://en.wikipedia.org/wiki/ISO_3166-2:US

packages/mrc-ide-covidsim/src/imperial.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import { convertOutput } from './convert-output'
66
import * as params from './imperial-params'
77
import { logger } from './logger'
88
import { RunnerModelInput, Model } from './model'
9-
import {
10-
EUROPE_COUNTRY_PARAMS_BY_ISO_CODE,
11-
US_SUBREGIONS,
12-
} from './admin-mappings'
9+
import { COUNTRY_PARAMS_BY_ISO_CODE, US_SUBREGIONS } from './admin-mappings'
1310

1411
// These are taken from the imperial model's regression test
1512
const SEEDS = ['98798150', '729101', '17389101', '4797132']
@@ -82,11 +79,8 @@ export class ImperialModel implements Model {
8279
'preUS_R0=2.0.txt'
8380
)
8481
subregionName = US_SUBREGIONS[input.subregion]
85-
}
86-
87-
// European countries differ only in their admin file.
88-
else if (EUROPE_COUNTRY_PARAMS_BY_ISO_CODE[input.region]) {
89-
const { adminFileName, subregions } = EUROPE_COUNTRY_PARAMS_BY_ISO_CODE[
82+
} else if (COUNTRY_PARAMS_BY_ISO_CODE[input.region]) {
83+
const { adminFileName, subregions } = COUNTRY_PARAMS_BY_ISO_CODE[
9084
input.region
9185
]
9286

@@ -96,10 +90,15 @@ export class ImperialModel implements Model {
9690
'populations',
9791
'wpop_eur.txt'
9892
)
93+
94+
const preParamsFileName =
95+
COUNTRY_PARAMS_BY_ISO_CODE[input.region].preParamsFileName ??
96+
'preUK_R0=2.0.txt'
97+
9998
preParametersTemplatePath = path.join(
10099
this.dataDir,
101100
'param_files',
102-
'preUK_R0=2.0.txt'
101+
preParamsFileName
103102
)
104103
subregionName = subregions[input.subregion]
105104
}
@@ -168,7 +167,7 @@ export class ImperialModel implements Model {
168167
`/P:${input.parametersFilePath}`,
169168
`/O:${this.outputDir}/result`,
170169
`/R:${r0 / 2.0}`,
171-
`/S:${this.outputDir}/${input.subregionName}-network.bin`,
170+
`/S:${this.outputDir}/${input.modelInput.region}-${input.subregionName}-network.bin`,
172171

173172
// TODO - cache the intermediate network files
174173
// '/S:NetworkUKN_32T_100th.bin',

0 commit comments

Comments
 (0)