InstituteforDiseaseModeling / covasim

COVID-19 Agent-based Simulator (Covasim): a model for exploring coronavirus dynamics and interventions
https://covasim.org
MIT License
250 stars 223 forks source link

Appling Aggregate patterns to people.py #338

Closed haoye123650 closed 2 years ago

haoye123650 commented 3 years ago

Introduction

This project "Covasim" is what I choose for our school project. I am learning and trying to apply aggregate pattern to the project.

The changes that I have made

I have made several changes to the people.py, but these major two changes are I have created two new classes that are "update_state" and "check_state".

The reason why I made those changes

I found there are some functions have the same purpose which is to update states and checking states. Since I am trying to apply aggregate pattern to this file. I put those functions into two different classes. For example, in class "update_state", it has three functions: "update_states_pre", "update_states_post", and "update_contacts". In class "check_state", it has nine functions: "check_inds", "check_infectious", "check_symptomatic", "check_severe", "check_critical", "check_recovery", "check_death", "check_diagnosed", and "check_quar". Basically, I just grouped those functions into two aggregate classes.