{"id":19417172,"url":"https://github.com/mahmud-kandawala/simulating-covid-19-python-","last_synced_at":"2026-04-16T00:30:56.385Z","repository":{"id":176123444,"uuid":"580004861","full_name":"Mahmud-Kandawala/Simulating-COVID-19-Python-","owner":"Mahmud-Kandawala","description":"This repository contains a Python program that simulates the spread of COVID-19 using Numpy and Matplotlib for calculations and visualization. The simulation offers an interactive way to understand virus dynamics and the impact of epidemiological parameters.","archived":false,"fork":false,"pushed_at":"2024-05-25T18:41:45.000Z","size":108,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T03:31:40.645Z","etag":null,"topics":["matplotlib","numpy","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mahmud-Kandawala.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-19T13:37:22.000Z","updated_at":"2024-05-25T18:53:13.000Z","dependencies_parsed_at":"2025-02-25T03:29:35.143Z","dependency_job_id":"ab83d360-5724-4723-92cc-ae4e3eb69625","html_url":"https://github.com/Mahmud-Kandawala/Simulating-COVID-19-Python-","commit_stats":null,"previous_names":["mahmud-kandawala/simulating-covid-19-python-"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Mahmud-Kandawala/Simulating-COVID-19-Python-","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mahmud-Kandawala%2FSimulating-COVID-19-Python-","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mahmud-Kandawala%2FSimulating-COVID-19-Python-/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mahmud-Kandawala%2FSimulating-COVID-19-Python-/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mahmud-Kandawala%2FSimulating-COVID-19-Python-/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mahmud-Kandawala","download_url":"https://codeload.github.com/Mahmud-Kandawala/Simulating-COVID-19-Python-/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mahmud-Kandawala%2FSimulating-COVID-19-Python-/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31866177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["matplotlib","numpy","python"],"created_at":"2024-11-10T13:07:44.843Z","updated_at":"2026-04-16T00:30:56.373Z","avatar_url":"https://github.com/Mahmud-Kandawala.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Simulating COVID-19 Spread with Python\n\nThis repository contains a Python program that simulates the spread of a virus, using COVID-19 as an example. The simulation leverages Numpy and Matplotlib for mathematical calculations and data visualization.\n\n## Features\n\n- **Virus Simulation:** Models the spread of a virus using parameters such as reproduction number (R0), incubation period, recovery times, and fatality rates.\n- **Visualization:** Provides a polar plot animation visualizing the spread, recovery, and fatalities over time.\n- **Configurable Parameters:** Allows customization of virus parameters to simulate different scenarios.\n- **Dynamic Plotting:** Uses Matplotlib's animation capabilities to provide real-time updates of the simulation.\n\n## Installation\n\n### Prerequisites\n\n- Python 3.6+\n- Numpy\n- Matplotlib\n\n### Installing Dependencies\n\nTo install the necessary dependencies, run:\n\n```bash\npip install numpy matplotlib\n```\n\n## Usage\n\nClone the repository and run the simulation:\n\n```bash\ngit clone https://github.com/yourusername/simulating-covid-19-python.git\ncd simulating-covid-19-python\npython virus.py\n```\n\n## Simulation Parameters\n\nThe simulation uses the following parameters for COVID-19:\n\n```python\nCOVID19_PARAMS = {\n    \"r0\": 2.28,\n    \"incubation\": 5,\n    \"percent_mild\": 0.8,\n    \"mild_recovery\": (7, 14),\n    \"percent_severe\": 0.2,\n    \"severe_recovery\": (21, 42),\n    \"severe_death\": (14, 56),\n    \"fatality_rate\": 0.034,\n    \"serial_interval\": 7\n}\n```\n\n### Description of Parameters\n\n- **r0:** Basic reproduction number.\n- **incubation:** Incubation period in days.\n- **percent_mild:** Percentage of mild cases.\n- **mild_recovery:** Range of recovery time for mild cases in days.\n- **percent_severe:** Percentage of severe cases.\n- **severe_recovery:** Range of recovery time for severe cases in days.\n- **severe_death:** Range of time to death for severe cases in days.\n- **fatality_rate:** Fatality rate of the virus.\n- **serial_interval:** Average time between successive cases in a chain of transmission.\n\n## Code Structure\n\n- `virus.py`: Main script that runs the simulation.\n- `README.md`: Project documentation.\n- `requirements.txt`: List of dependencies.\n\n## Simulation Process\n\n1. **Initialization**: The `Virus` class initializes the plot and sets up the initial parameters for the simulation.\n2. **Simulation Loop**: The simulation updates the state of the population at each time step, recalculating the number of infected, recovered, and deceased individuals based on the virus parameters.\n3. **Visualization**: The current state of the simulation is visualized using Matplotlib, with annotations for the day count and the number of infected individuals.\n\n## Prioritization and Scope\n\n### Tackled\n\n- **Core Simulation Mechanics**: Focused on accurately simulating virus spread using key epidemiological parameters.\n- **Data Visualization**: Implemented clear and informative visualizations to track the progress of the simulation.\n\n### Not Tackled\n\n- **Advanced Epidemiological Models**: Did not include more complex models like SEIR (Susceptible-Exposed-Infected-Recovered) due to scope limitations.\n- **User Interface**: The current version uses a simple script-based interaction rather than a full-fledged GUI.\n\n## Lessons Learned\n\n- **Understanding Epidemiology**: Gained a deeper understanding of how viruses spread and the importance of different epidemiological parameters.\n- **Python and Matplotlib**: Improved skills in using Python for scientific computing and data visualization.\n\n## Challenges and Solutions\n\n- **Animation Performance**: Ensuring the animation runs smoothly was challenging. Optimized the plotting functions to handle large datasets efficiently.\n- **Parameter Sensitivity**: Finding the right balance of parameters to produce realistic simulations required extensive testing and validation.\n\n## Visualization\n\nVisualization of the virus spread:\n\n![Virus Spread Simulation](image/virus.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahmud-kandawala%2Fsimulating-covid-19-python-","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahmud-kandawala%2Fsimulating-covid-19-python-","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahmud-kandawala%2Fsimulating-covid-19-python-/lists"}