Package: pyepidemics
pyepidemicsOpen-source epidemics modeling Python librarypyepidemicsis a Python library to easily manipulate epidemiological models (SIR, SEIR, COVID19), forecast, and test policy scenarios. Main features are:Creation of classical compartmental models (SIR, SEIR, SEIDR, etc...)Creation of COVID19 related model (with ICU and different levels of symptoms)Creation of custom compartmental modelEasy extend to compartmental model on different levels (by age, by region, by age and region, etc...)Implementation of contact matricesImplementation of policies (lockdown, tracing, testing, etc...)Calibration of epidemiological parameters on real-world data using Bayesian optimizationData helpers to get up-to-date data (cases, beds availability, population contact matrices) (NB as of today only for France cases)Simple curve fitting algorithmsEconomics modeling on consumption and productionThis library is under active development, please contactThÃ©o Alves Da Costaif you need more information and would like to contributeContributorsThe library has been initially developed byEkimetricsunder the coalition of French AI companies CoData ot help French government response to the COVID19 pandemics. Main contributors are:ThÃ©o Alves Da Costa, EkimetricsEmilie Rannou, EkimetricsLÃ©o Grosjean, EkimetricsPierre Carles, EkimetricsNicolas Chesneau, EkimetricsMarianne Chehade, EkimetricsJean-Baptiste RemyInstallationInstall using pipWe recommend to create a virtual environment first, then you can install the library using the commandpip install pyepidemicsThe repo is on PyPI athttps://pypi.org/project/pyepidemics/Install from sourceYou can also install the repository by cloning it locally and using it either locally or installing the wheel by calling firstpython setup.py sdist bdist_wheelDocumentationDocumentation is available athttps://collectif-codata.github.io/pyepidemicsFolder structure- pyepidemics/          --------- Python library centralizing source code
    - dataset/          --------- Helpers to get up-to-date COVID19 datasets
    - models/           --------- Compartmental models code
    - params/           --------- Epidemiological parameters calibration optimizers
    - policies/         --------- Scenarios implementation
    - visualization/    --------- Visualization helpers (chloropleth maps using pydeck)
- data/                 --------- Local datasets if needed
- docs/                 --------- Documentation and tutorial notebooks
- notebook/             --------- Development notebooks
- references/           --------- Reports and research papers
- scripts/              --------- Automation scripts on calibration
- requirements.txt      --------- Python requirementsQuickstartCreating a SIR model# Import libraryfrompyepidemics.modelsimportSIR# Let's take approximate parameters during COVID19 epidemicsN=67e6beta=3.3/4gamma=1/4# Instantiate model with epidemiological parameterssir=SIR(N,beta,gamma)# Solve for one infected case for 100 days starting from 2020-01-24states=sir.solve(1,n_days=100,start_date="2020-01-24")# Visualize epidemic curves using matplotlib (plotly available)states.show(plotly=False)Creating a custom compartmental modelHere is the example to create a model like the SIR described abovefrompyepidemics.modelsimportCompartmentalModelclassSIR(CompartmentalModel):def__init__(self,N,beta,gamma):# Define compartments name and numbercompartments=["S","I","R"]super().__init__(compartments)# Parametersself.N=N# Total populationself.beta=beta# How many person each person infects per dayself.gamma=gamma# Rate of infection, duration = 1/gamma# Add transitionself.add_transition("S","I",lambday,t:self.beta*y["S"]*y["I"]/self.N)self.add_transition("I","R",lambday,t:self.gamma*y["I"])Contribution guidelinesWIPReferenceshttps://towardsdatascience.com/infectious-disease-modelling-beyond-the-basic-sir-model-216369c584c4LicenseMIT License