Commit 43faa37d authored by Chris Jewell's avatar Chris Jewell
Browse files

Switched to FNC TierData ingester.

parent 1d912c7a
......@@ -42,14 +42,10 @@ if __name__ == "__main__":
config = yaml.load(f, Loader=yaml.FullLoader)
inference_period = [
np.datetime64(x) for x in config["settings"]["inference_period"]
np.datetime64(x) for x in config["Global"]["inference_period"]
]
covar_data = model_spec.read_covariates(
config["data"],
date_low=inference_period[0],
date_high=inference_period[1],
)
covar_data = model_spec.read_covariates(config)
# We load in cases and impute missing infections first, since this sets the
# time epoch which we are analysing.
......
......@@ -19,7 +19,7 @@ XI_FREQ = 14 # baseline transmission changes every 14 days
NU = tf.constant(0.28, dtype=DTYPE) # E->I rate assumed known.
def read_covariates(paths, date_low, date_high):
def read_covariates(config):
"""Loads covariate data
:param paths: a dictionary of paths to data with keys {'mobility_matrix',
......@@ -27,6 +27,9 @@ def read_covariates(paths, date_low, date_high):
:returns: a dictionary of covariate information to be consumed by the model
{'C': commute_matrix, 'W': traffic_flow, 'N': population_size}
"""
paths = config["data"]
date_low = np.datetime64(config["Global"]["inference_period"][0])
date_high = np.datetime64(config["Global"]["inference_period"][1])
mobility = data.read_mobility(paths["mobility_matrix"])
popsize = data.read_population(paths["population_size"])
commute_volume = data.read_traffic_flow(
......@@ -35,11 +38,12 @@ def read_covariates(paths, date_low, date_high):
geo = gp.read_file(paths["geopackage"])
geo = geo.loc[geo["lad19cd"].str.startswith("E")]
tier_restriction = data.read_challen_tier_restriction(
paths["tier_restriction_csv"],
date_low,
date_high,
)
# tier_restriction = data.read_challen_tier_restriction(
# paths["tier_restriction_csv"],
# date_low,
# date_high,
# )
tier_restriction = data.TierData.process(config)[:, :, 2:]
weekday = pd.date_range(date_low, date_high).weekday < 5
return dict(
......
......@@ -27,6 +27,7 @@ ipython = "^7.18.1"
jupyter = "^1.0.0"
flake8 = "^3.8.4"
black = "^20.8b1"
pytest = "^6.2.1"
[tool.black]
line-length = 80
......
# Covid_ODE model configuration
# Covid stochastic model configuration
Global:
prependID: False
prependDate: False
inference_period:
- 2020-10-11
- 2021-01-04
time_step: 1.
GenerateOutput:
storeInputs: False
scrapedDataDir: scraped_data
storeProcessedInputs: False
data:
mobility_matrix: data/mergedflows.csv
population_size: data/c2019modagepop.csv
commute_volume: data/201211_OFF_SEN_COVID19_road_traffic_national_table.xlsx
reported_cases: data/Anonymised Combined Line List 20201109.csv
commute_volume: data/201231_OFF_SEN_COVID19_road_traffic_national_table.xlsx
reported_cases: data/Anonymised Combined Line List 20201231.csv
case_date_type: specimen
pillar: both
tier_restriction_csv: data/tidyLAD19Tiers.csv
geopackage: data/UK2019mod_pop.gpkg
parameter:
beta1: 0.291 # R0 2.4
beta2: 0.876 # Contact with commuters 1/3rd of the time
beta3: 1.0 # lockdown vs normal
omega: 1.0 # Non-linearity parameter for commuting volume
nu: 0.5 # E -> I transition rate
gamma: 0.45 # I -> R transition rate
xi:
- 2.07
- 0.15
- -1.08
- -0.78
- -0.73
- -0.51
settings:
inference_period:
- 2020-07-03
- 2020-09-29
time_step: 1.
prediction_period:
- 2020-02-19
- 2020-08-01
mcmc:
dmax: 84
......@@ -48,8 +39,23 @@ mcmc:
concentration: 2.0
rate: 4.0
output:
results_dir: $global_scratch/covid19/
results_dir: output/testing
posterior: posterior.hd5
national_rt: national_rt.xlsx
geopackage: prediction.gpkg
AreaCodeData:
input: json
address: "https://services1.arcgis.com/ESMARspQHYMw9BZ9/arcgis/rest/services/LAD_APR_2019_UK_NC/FeatureServer/0/query?where=1%3D1&outFields=LAD19CD,LAD19NM&returnGeometry=false&returnDistinctValues=true&orderByFields=LAD19CD&outSR=4326&f=json"
format: ons
output: processed_data/processed_lad19cd.csv
regions: ["E"]
TierData:
input: api
address: None
format: api
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment