Git Product home page Git Product logo

covid19uk's People

Contributors

chrism0dwk avatar csuter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

covid19uk's Issues

Create Dockerfile

In order for the model to be used in the model runner, it needs to be containerized. Brief instructions are here. Here's an example for IDMs covasim:

FROM python:3

ARG COVASIM_VER=1.0.0
RUN pip install covasim==${COVASIM_VER} pandas

COPY . /app

CMD ["python", "/app/runsim.py", "/data/input/inputFile.json", "/data/output/data.json"]

Accept input and generate output for model runner

Models in the model runner take a JSON input and generate JSON output, which is validated using a JSON schema. The Typescript classes are a little easier to read:

Input
Output

It should be straightforward to take the minimal input and use it to modify a YAML template that you currently use. It doesn't look as though you use intervention data?

Porting the model in R

I am using the reticulate package that allows you call Python from R. This is how the first part of covid_ode.py looks like in R:

library(reticulate)
covid <- import("covid")
config <- yaml::read_yaml("ode_config.yaml")

# Load age mixing 
K_tt <- readRDS(config$data$age_mixing_matrix_term)

# Load age mixing holiday
K_hh <- readRDS(config$data$age_mixing_matrix_hol)

# Load mobility matrix 
Tmat <- readRDS(config$data$mobility_matrix)
diag(Tmat) <- 0 

N <- readRDS(config$data$population_size)
 
param <- config$parameter
settings <- covid$util$sanitise_settings(config$settings)


model <- covid$model$CovidUKODE(K_tt, K_hh, Tmat, N, 
                                settings$start, settings$end, settings$holiday,
                                settings$bg_max_time, 1)

Note that it won't run because there are no start and end settings in the ode_config.yaml.

A function like mcmc.py can be run from R as simply as:

source_python("mcmc.py")

It would be useful to have a chat to know what arguments would you like to have in a R wrapper for each of the main functions.

Problem with loading commute data

Function load_commute_volume in pydata.py doesn't work correctly.
The sort_index sorts by day not date so it ends up in the wrong order and commute.merge doesn't correctly match several dates.
Adding "commute_raw.index = pd.to_datetime(commute_raw.index, format = '%d/%m/%Y')" just after "commute_raw = pd.read_csv(filename, index_col='date')", changes the index to a datetime format, allowing the sorting and merging to work correctly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.