Browse Source

initial commit

epsylon 4 years ago
parent
commit
22ca29fd9c

+ 20 - 0
.gitattributes

@@ -0,0 +1,20 @@
+*.conf text eol=lf
+*.md text eol=lf
+*.md5 text eol=lf
+*.py text eol=lf
+*.xml text eol=lf
+LICENSE text eol=lf
+COMMITMENT text eol=lf
+
+*_ binary
+*.dll binary
+*.pdf binary
+*.so binary
+*.wav binary
+*.zip binary
+*.x32 binary
+*.x64 binary
+*.exe binary
+*.sln binary
+*.vcproj binary
+

+ 47 - 0
.github/CODE_OF_CONDUCT.md

@@ -0,0 +1,47 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project leader at epsylon@riseup.net. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
+

File diff suppressed because it is too large
+ 36 - 0
.github/CONTRIBUTING.md


+ 36 - 0
.github/ISSUE_TEMPLATE/bug_report.md

@@ -0,0 +1,36 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: bug report
+assignees: ''
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+1. Run '...'
+2. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Running environment:**
+ - PandeMaths version [e.g. 0.1]
+ - Installation method [e.g. git]
+ - Operating system: [e.g. Debian 4.19.16-1~bpo9+1 (2019-02-07) ]
+ - Python version [e.g. 3.7]
+
+**Error details:**
+ - Relevant console output [if any]
+ - Exception traceback [if any]
+
+**Additional context**
+Add any other context about the problem here.
+
+---

+ 22 - 0
.github/ISSUE_TEMPLATE/feature_request.md

@@ -0,0 +1,22 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: feature request
+assignees: ''
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
+
+---

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+__pycache__/
+*.py[cod]

+ 44 - 2
README.md

@@ -1,3 +1,45 @@
-# pandemaths
 
- PandeMaths is a free software tool that simulates a mathematical model of pandemics.
+![c](https://03c8.net/images/pandemaths_banner.png)
+
+----------
+
+#### Info:
+ 
+ PandeMaths is a free software tool that simulates a mathematical model of pandemics.
+
+#### Installing:
+
+ This tool runs on many platforms and it requires Python (3.x.y).
+
+#### Executing:
+  
+  python pandemaths.py (or python3 pandemaths.py)
+
+----------
+
+#### License:
+
+ PandeMaths is released under the GPLv3.
+
+#### Contact:
+
+      - psy (epsylon@riseup.net)
+
+#### Contribute: 
+
+ To make donations use the following hash:
+  
+     - Bitcoin: 19aXfJtoYJUoXEZtjNwsah2JKN9CK5Pcjw
+
+----------
+
+####  Screenshots:
+
+![c](https://03c8.net/images/pandemaths_model.png)
+
+![c](https://03c8.net/images/pandemaths_simulation.png)
+
+![c](https://03c8.net/images/pandemaths_simulation2.png)
+
+![c](https://03c8.net/images/pandemaths_simulation3.png)
+

+ 47 - 0
docs/AUTHOR

@@ -0,0 +1,47 @@
+========================
+
+ nick: psy (epsylon)
+  
+  <epsylon@riseup.net> 
+
+ web: https://03c8.net
+
+=======================
+
+ code:
+
+ - https://code.03c8.net/epsylon
+ - https://github.com/epsylon
+
+=======================
+
+ software/projects:
+
+ - Anarcha-Pragmatism: Intellectual model (and movement) based on the culture of the "action/reaction".
+ - AnonTwi: Tool for OAuth2 applications (such as: GNUSocial, Twitter) that provides different layers of privacy/encryption.
+ - BrAInStocker: Tool to predict (using Linear Regression) the next number within a series of random numbers.
+ - Bordercheck: Tool to visualize 'real-time' on a world map the geolocation of data when surfing the web.
+ - CIntruder: Tool to bypass captchas using OCR (Optical Character Recognition) bruteforcing methods.
+ - Collatz: Tool to simulate the Collatz's conjeture.
+ - DiaNA: Tool for the search and recognition of patterns in DNA sequences.
+ - DieKunstDerFuge: Video on different topics related to hacktivism recorded during 2013 from an intimate narrative perspective.
+ - ECOin: Decentralized key/value registration and transfer system based on Bitcoin technology (a cryptocurrency).
+ - Euler-Bricks: Tool to search for Euler's "bricks".
+ - Goldbach: Tool to simulate the Goldbach's conjeture.
+ - Lorea: Social networking autonomous project to build a distributed, encrypted and federated network. 
+ - Orb: Tool for massive footprinting.
+ - PandeMaths: Tool that simulates a mathematical model of pandemics.
+ - pArAnoIA-Browser: Tool designed to surf the Internet using some "paranoic" methods.
+ - Propagare: Tool for extraction, organization and semantic analysis of newspapers.
+ - PyAISnake: Tool to train AI models on solve spatial problems through the classic video game "snake".
+ - PyDog4Apache: Tool to sneak logs from Apache web server.
+ - UFONet: Denial of Service [DDoS & DoS attacks] Toolkit (a botnet of botnets).
+ - XSSer: Automatic -framework- to detect, exploit and report XSS vulnerabilities.
+
+=======================
+
+ BTC: 
+
+  19aXfJtoYJUoXEZtjNwsah2JKN9CK5Pcjw
+
+========================

+ 46 - 0
docs/COMMITMENT

@@ -0,0 +1,46 @@
+GPL Cooperation Commitment
+Version 1.0
+
+Before filing or continuing to prosecute any legal proceeding or claim
+(other than a Defensive Action) arising from termination of a Covered
+License, we commit to extend to the person or entity ('you') accused
+of violating the Covered License the following provisions regarding
+cure and reinstatement, taken from GPL version 3. As used here, the
+term 'this License' refers to the specific Covered License being
+enforced.
+
+    However, if you cease all violation of this License, then your
+    license from a particular copyright holder is reinstated (a)
+    provisionally, unless and until the copyright holder explicitly
+    and finally terminates your license, and (b) permanently, if the
+    copyright holder fails to notify you of the violation by some
+    reasonable means prior to 60 days after the cessation.
+
+    Moreover, your license from a particular copyright holder is
+    reinstated permanently if the copyright holder notifies you of the
+    violation by some reasonable means, this is the first time you
+    have received notice of violation of this License (for any work)
+    from that copyright holder, and you cure the violation prior to 30
+    days after your receipt of the notice.
+
+We intend this Commitment to be irrevocable, and binding and
+enforceable against us and assignees of or successors to our
+copyrights.
+
+Definitions
+
+'Covered License' means the GNU General Public License, version 2
+(GPLv2), the GNU Lesser General Public License, version 2.1
+(LGPLv2.1), or the GNU Library General Public License, version 2
+(LGPLv2), all as published by the Free Software Foundation.
+
+'Defensive Action' means a legal proceeding or claim that We bring
+against you in response to a prior proceeding or claim initiated by
+you or your affiliate.
+
+'We' means each contributor to this repository as of the date of
+inclusion of this file, including subsidiaries of a corporate
+contributor.
+
+This work is available under a Creative Commons Attribution-ShareAlike
+4.0 International license (https://creativecommons.org/licenses/by-sa/4.0/).

File diff suppressed because it is too large
+ 52 - 74
LICENSE


+ 19 - 0
model/extended.txt

@@ -0,0 +1,19 @@
+E:Exposed individuals
+δ:Average time of temporary immunity
+μ:Average death rate (probability of an infected individual dying from the disease)
+Ia:Asymptomatic infected individuals
+f:Average rate of loss of immunity in recovered individuals
+B:Average birth rate
+M:Infants with passive immunity
+δ:Average time of temporary immunity
+1/ε:Average incubation time
+Hp:Level of previous health status of the population
+rIm:Collective Immunity Ratio
+PoVp:Poverty level of the population
+Fakep:Level of media manipulation ("fake news") to which the population is subjected
+Edup:Educational level of the population
+Purp:Average rate of purchasing power of the population
+pPHS:Average rate of privatization of public health services
+PS:Level of political stability
+GDP:Gross Domestic Product
+CDL:Country Debt level

+ 9 - 0
model/pandemia.txt

@@ -0,0 +1,9 @@
+T:Total population
+S:Susceptible (healthy individuals who do not carry the disease, but who could be infected)
+I:Infected (individuals who carry the disease and can transmit it)
+A:Recovered (individuals who heal and become immunized)
+D:Deceased (individuals who have died)
+1/i:Average interaction between individuals
+1/γ:Average infection time (for a single individual)
+β:Rate of infection (probability of a person becoming ill when in contact with an infected person)
+r:Average recovery rate (for a single individual)

+ 430 - 0
pandemaths.py

@@ -0,0 +1,430 @@
+#!/usr/bin/env python 
+# -*- coding: utf-8 -*-"
+"""
+PandeMaths - 2020 - by psy (epsylon@riseup.net)
+
+You should have received a copy of the GNU General Public License along
+with PandeMaths; if not, write to the Free Software Foundation, Inc., 51
+Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+"""
+VERSION = "v0.1_beta"
+RELEASE = "25032020"
+SOURCE1 = "https://code.03c8.net/epsylon/pandemaths"
+SOURCE2 = "https://github.com/epsylon/pandemaths"
+CONTACT = "epsylon@riseup.net - (https://03c8.net)"
+
+pandemic_model_variables_path = "model/pandemia.txt" # pandemia variables file
+extended_model_variables_path = "model/extended.txt" # extended model variables file
+simulation_templates_path = "templates/" # templates files
+reports_path = "reports/" # reports files
+
+import json, datetime, os, random
+
+def model_maths():
+    print("[Info] Reviewing Model ...\n")
+    try:
+        print(" "+"-"*5+"\n")
+        f = open(pandemic_model_variables_path, "r")
+        model_variables = f.readlines()
+        f.close()
+        for v in model_variables:
+            print("   - "+str(v.replace("\n", "")))
+    except:
+        pass
+    try:
+        print("\n "+"-"*5+"\n")
+        f = open(extended_model_variables_path, "r")
+        extended_variables = f.readlines()
+        f.close()
+        for v in extended_variables:
+            print("   - "+str(v.replace("\n", "")))
+    except:
+        pass
+    print("\n "+"-"*5+"\n")
+
+def simulation():
+    print("[Info] Defining ecosystem ...\n")
+    total_population = input("   + Total population (default: 100000): ")
+    try:
+        total_population = int(total_population)
+    except:
+        total_population = 100000
+    if not total_population:
+        total_population = 100000
+    starting_population = total_population
+    infected_starting = input("   + Infected (at the beginning) population (default: 1): ")
+    try:
+        infected_starting = int(infected_starting)
+    except:
+        infected_starting = 1
+    if not infected_starting or infected_starting < 1:
+        infected_starting = 1
+    infected = infected_starting
+    print("\n "+"-"*5+"\n")
+    print("[Info] Establishing time units ...\n")
+    days = input("   + Number of days (default: 200): ")
+    try:
+        days = int(days)
+    except:
+        days = 200
+    if not days:
+        days = 200
+    daily_rate_interaction = input("   + Daily rate of interaction between individuals (default: 2.50): ")
+    try:
+        daily_rate_interaction = int(daily_rate_interaction)
+    except:
+        daily_rate_interaction = 2.50
+    if not daily_rate_interaction:
+        daily_rate_interaction = 2.50
+    print("\n "+"-"*5+"\n")
+    template = input("+ CHOOSE: (O)pen Simulation or (L)oad template: ").upper()
+    if template == "O": # New Simulation
+        average_rate_duration = None
+        probability_of_contagion = None
+        recovery_rate = None
+        simulation_name = "OPEN"
+        new_simulation(total_population, infected_starting, days, daily_rate_interaction, average_rate_duration, probability_of_contagion, recovery_rate, simulation_name, starting_population)
+    else: # Load template
+        load_template(total_population, infected_starting, days, daily_rate_interaction, starting_population)
+
+def load_template(total_population, infected_starting, days, daily_rate_interaction, starting_population):
+    print("\n "+"-"*5+"\n")
+    print("[Info] Generating templates ...\n")
+    import glob
+    templates = {}
+    i = 0
+    for file in glob.iglob(simulation_templates_path + '*', recursive=False):
+        if(file.endswith(".txt")): 
+            i = i +1
+            f=open(file, 'r')  
+            template =  f.read().replace('\n',' ')
+            templates[i] = file.replace("templates/",""), template.upper() # add template to main dict
+            f.close()
+    for k,v in templates.items():
+        print ("  ["+str(k)+"] - "+str(v[0].replace(".txt","")))
+    print("\n "+"-"*5+"\n")
+    template_set = input("+ CHOOSE: Number of template (ex: 1): ").upper()
+    try:
+        template_set = int(template_set)
+    except:
+        template_set = 1
+    if not template_set or template_set > len(templates) or template_set < 1:
+        template_set = 1
+    for k,v in templates.items():
+        if template_set == k:
+            simulation_name = v[0].replace(".txt","")
+            average_rate_duration = int(v[1].split("DURATION:")[1].split(" ")[0])
+            probability_of_contagion = int(v[1].split("CONTAGION:")[1].split(" ")[0])
+            recovery_rate = int(v[1].split("RECOV:")[1].split(" ")[0])
+            new_simulation(total_population, infected_starting, days, daily_rate_interaction, average_rate_duration, probability_of_contagion, recovery_rate, simulation_name, starting_population)
+
+def new_simulation(total_population, infected_starting, days, daily_rate_interaction, average_rate_duration, probability_of_contagion, recovery_rate, simulation_name, starting_population):
+    print("\n "+"-"*5+"\n")
+    print("[Info] Generating variables ...\n")
+    if average_rate_duration == None:
+        average_rate_duration = input("   + Average duration of illness (default: 12) (days): ")
+        try:
+            if average_rate_duration == 0:
+                pass
+            else:
+                average_rate_duration = int(average_rate_duration)
+        except:
+            average_rate_duration = 12
+        if average_rate_duration < 0 or average_rate_duration > 100:
+            average_rate_duration = 12
+    else:
+        print("   + Average duration of illness: "+str(average_rate_duration)+" days")
+    if probability_of_contagion == None:
+        probability_of_contagion = input("   + Infection rate (default: 14%): ")
+        try:
+            if probability_of_contagion == 0:
+                pass
+            else:
+                probability_of_contagion = int(probability_of_contagion)
+        except:
+            probability_of_contagion = 14
+        if probability_of_contagion < 0 or probability_of_contagion > 100:
+            probability_of_contagion = 14
+    else:
+        print("   + Infection rate: "+str(probability_of_contagion)+"%")
+    if recovery_rate == None:
+        recovery_rate = input("   + Recovery rate (default: 95%): ")
+        try:
+            if recovery_rate == 0:
+                pass
+            else:
+                recovery_rate = int(recovery_rate)
+        except:
+            recovery_rate = 95
+        if recovery_rate < 0 or recovery_rate > 100:
+            recovery_rate = 95
+    else:
+        print("   + Recovery rate: "+str(recovery_rate)+"%")
+    mortality = 100 - recovery_rate
+    print("\n "+"-"*5+"\n")
+    print("[Info] Building parameters ...\n")
+    print("   + Mortality rate: "+str(mortality)+"%")
+    mortality = mortality / 100
+    recovery_rate = recovery_rate / 100
+    probability_of_contagion = probability_of_contagion / 100
+    infected = infected_starting
+    susceptible_starting = int(total_population) - int(infected)
+    susceptible = susceptible_starting # susceptitble at start
+    print("   + Susceptible: "+str(susceptible))
+    recovered = 0 # recovered individuals at start
+    deceased = 0 # deceases individuals at start
+    print("   + Recovered: "+str(recovered))
+    print("   + Deceased: "+str(deceased))
+    print("\n"+"-"*15+"\n")
+    print("[Info] Launching Simulation: [ "+str(simulation_name)+" ] ...\n")
+    total_contagion = 0
+    recoveries = 0
+    current_time = datetime.datetime.now() # current datetime
+    if not os.path.exists(reports_path): # create folder for reports
+        os.makedirs(reports_path)
+    data = {
+      'METADATA': [
+        {
+        'Simulation Name': str(simulation_name),
+        'Datetime': str(current_time)
+        }
+      ],
+      'ECOSYSTEM': [
+        {
+        'Total Population': str(total_population),
+        'Infected (at the beginning)': str(infected_starting),
+        'Number of days': str(days),
+        'Daily rate of interaction between individuals': str(daily_rate_interaction),
+        'Average duration of illness': str(average_rate_duration),
+        'Infection rate': str(probability_of_contagion),
+        'Recovery rate': str(recovery_rate),
+        'Mortality': str(mortality),
+        'Susceptible': str(susceptible),
+        'Recovered': str(recovered),
+        'Deceased': str(deceased)
+        }
+      ],
+     'SIMULATION': [
+        {}
+      ]
+    }
+    entire_population_infected = 0
+    day_started = False
+    for i in range(0, days):
+        if i > 0:
+            status_rate = round(int(infected*100/total_population))
+            if status_rate < 11: # ENDEMIA (-11%)
+                status = "IMPACT LEVEL: ENDEMIC!"
+            elif status_rate > 10 and status_rate < 30: # EPIDEMIA (>10%<30%)
+                status = "IMPACT LEVEL: EPIDEMIC!"
+            else: # PANDEMIA (>30%)
+                status = "IMPACT LEVEL: PANDEMIC!"
+            sir = susceptible+infected+recovered # S-I-R model
+            contagion = round(infected*daily_rate_interaction*susceptible/sir*probability_of_contagion) # contagion rounded rate
+            recoveries = round(infected*recovery_rate/average_rate_duration) # recoveries rounded rate
+            deaths = round(infected*mortality/average_rate_duration) # deaths rounded rate
+            susceptible = susceptible - contagion + recoveries - deaths
+            infected = infected+contagion-recoveries-deaths
+            recovered =recovered + recoveries
+            deceased = deceased + deaths
+            total_contagion = total_contagion + contagion
+            total_recovered = recovered
+            total_deceased = total_deceased + deaths
+            total_population = starting_population - deceased
+            total_non_affected = susceptible_starting+infected_starting+0+0-total_contagion
+            day_started = True
+        else: # related to the first day
+            status = "STARTED!"
+            contagion = 0
+            recoveries = 0
+            deaths = 0
+            total_recovered = 0
+            total_deceased = 0
+            deceased = 0
+            susceptible = total_population - infected
+            recovered = 0
+            total_contagion = infected_starting
+            total_non_affected = susceptible
+        if total_population < 0:
+            total_population = 0
+        if total_contagion < total_contagion < 0:
+            total_contagion = 0
+        if contagion > susceptible: # more individuals than susceptible cannot be infected
+            contagion = susceptible
+        if contagion < 1:
+            contagion = 0
+        if total_non_affected < 1: # cannot be negative non affected individuals
+            total_non_affected = 0
+        if recoveries < 1:
+            recoveries = 0
+        if susceptible + infected + recovered + deceased > starting_population:
+            susceptible = int(starting_population - infected - recovered - deceased)
+            deaths = int(recovered + deceased - starting_population)
+        if deaths < 1:
+            deaths = 0
+        if deaths > total_population:
+            deaths = total_population
+        if deaths > infected:
+            deaths = infected
+            infected = 0
+        if susceptible < 1: # cannot be negative susceptible individuals
+            susceptible = 0
+        if susceptible == 0:
+            total_non_affected = 0
+        if day_started == True:
+            if int(contagion + recoveries + deaths) == 0: # infected final resolution phase solved by random results
+                if infected > 0:
+                    deaths = random.randrange(infected)
+                if deaths > infected:
+                    infected = deaths
+                if infected == 1: # random final against Existentialism!
+                    res = random.randrange(2)
+                    if res == 1: # survive!
+                        recoveries = recoveries + 1
+                    else: # die!
+                        deaths = deaths + 1
+                infected = infected+contagion-recoveries-deaths
+                recovered = recovered + recoveries
+                total_recovered = total_recovered + recoveries
+                deceased = deceased+deaths
+        if infected > starting_population:
+            infected = starting_population
+        if total_population > 0:
+            if infected > 0:
+                data['SIMULATION'][0]['DAY'] = str(i)
+                if total_non_affected > 0:
+                    if contagion > 0:
+                        print("  -> [DAY: "+str(i)+"]\n      Status: ("+str(status)+") -> [Contagion: ("+str(int(contagion))+") | Recoveries: ("+str(int(recoveries))+") | Deaths: ("+str(int(deaths))+")] - [Susceptible: ("+str(int(susceptible))+") | Infected: ("+str(int(infected))+") | Recovered: ("+str(int(recovered))+") | Deceased: ("+str(int(deceased))+")]")             
+                    else:
+                        print("  -> [DAY: "+str(i)+"]\n      Status: ("+str(status)+") -> [Contagion: ("+str(int(contagion))+") | Recoveries: ("+str(int(recoveries))+") | Deaths: ("+str(int(deaths))+")] - [Susceptible: ("+str(int(susceptible))+") | Infected: ("+str(int(infected))+") | Recovered: ("+str(int(recovered))+") | Deceased: ("+str(int(deceased))+")]")
+                else:
+                    if entire_population_infected == 0:
+                        total_contagion = starting_population
+                        susceptible = 0
+                        status = "ALL INFECTED!"
+                        print("  -> [DAY: "+str(i)+"] -> [The entire population has been infected! ...]\n      Status: ("+str(status)+") -> [Contagion: ("+str(int(contagion))+") | Recoveries: ("+str(int(recoveries))+") | Deaths: ("+str(int(deaths))+")] - [Susceptible: ("+str(int(susceptible))+") | Infected: ("+str(int(infected))+") | Recovered: ("+str(int(recovered))+") | Deceased: ("+str(int(deceased))+")]")
+                        entire_population_infected = entire_population_infected + 1
+                    else:
+                        print("  -> [DAY: "+str(i)+"]\n      Status: ("+str(status)+") -> [Contagion: ("+str(int(contagion))+") | Recoveries: ("+str(int(recoveries))+") | Deaths: ("+str(int(deaths))+")] - [Susceptible: ("+str(int(susceptible))+") | Infected: ("+str(int(infected))+") | Recovered: ("+str(int(recovered))+") | Deceased: ("+str(int(deceased))+")]")
+                print("      Total Population: ("+str(int(total_population))+"/"+str(int(starting_population))+") | Total Contagion: ("+str(int(total_contagion))+") | Total Recovered: (" +str(int(total_recovered))+") | Total Deceased: ("+str(int(total_deceased))+") | Total N/A: ("+str(int(total_non_affected))+")\n")
+                data['SIMULATION'][0]['Status'] = str(status)
+                data['SIMULATION'][0]['Contagion'] = str(int(contagion)) # generate json
+                data['SIMULATION'][0]['Recoveries'] = str(int(recoveries))
+                data['SIMULATION'][0]['Deaths'] = str(int(deaths))
+                data['SIMULATION'][0]['Susceptible'] = str(int(susceptible))
+                data['SIMULATION'][0]['Infected'] = str(int(infected))
+                data['SIMULATION'][0]['Recovered'] = str(int(recovered))
+                data['SIMULATION'][0]['Deceased'] = str(int(deceased))
+                data['SIMULATION'][0]['Total Population'] = str(int(total_population))
+                data['SIMULATION'][0]['Total Contagion'] = str(int(total_contagion))
+                data['SIMULATION'][0]['Total Recovered'] = str(int(recovered))
+                data['SIMULATION'][0]['Total Deceased'] = str(int(total_deceased))
+                data['SIMULATION'][0]['Total N/A'] = str(int(total_non_affected))
+                with open(reports_path+'PandeMaths-report_'+str(current_time)+'.json', 'a', encoding='utf-8') as f: # append simulation into json
+                    json.dump(data, f, ensure_ascii=False, sort_keys=False, indent=4)
+            else: # population has passed the pandemia
+                status = "VACCINED"
+                if entire_population_infected == 0:
+                    total_contagion = starting_population
+                print("  -> [DAY: "+str(i)+"] -> [ No more infected! ...]\n      Status: ("+str(status)+") -> [Contagion: ("+str(int(contagion))+") | Recoveries: ("+str(int(recoveries))+") | Deaths: ("+str(int(deaths))+")] - [Susceptible: ("+str(int(susceptible))+") | Infected: ("+str(int(infected))+") | Recovered: ("+str(int(recovered))+") | Deceased: ("+str(int(deceased))+")]")
+                print("      Total Population: ("+str(int(total_population))+"/"+str(int(starting_population))+") | Total Contagion: ("+str(int(total_contagion))+") | Total Recovered: (" +str(int(total_recovered))+") | Total Deceased: ("+str(int(total_deceased))+") | Total N/A: ("+str(int(total_non_affected))+")\n")
+                data['SIMULATION'][0]['DAY'] = str(i)
+                data['SIMULATION'][0]['Status'] = "[ No more infected! ... ]"
+                data['SIMULATION'][0]['Contagion'] = str(int(contagion)) # generate json
+                data['SIMULATION'][0]['Recoveries'] = str(int(recoveries))
+                data['SIMULATION'][0]['Deaths'] = str(int(deaths))
+                data['SIMULATION'][0]['Susceptible'] = str(int(susceptible))
+                data['SIMULATION'][0]['Infected'] = str(int(infected))
+                data['SIMULATION'][0]['Recovered'] = str(int(recovered))
+                data['SIMULATION'][0]['Deceased'] = str(int(deceased))
+                data['SIMULATION'][0]['Total Population'] = str(int(total_population))
+                data['SIMULATION'][0]['Total Contagion'] = str(int(total_contagion))
+                data['SIMULATION'][0]['Total Recovered'] = str(int(recovered))
+                data['SIMULATION'][0]['Total Deceased'] = str(int(total_deceased))
+                data['SIMULATION'][0]['Total N/A'] = str(int(total_non_affected))
+                with open(reports_path+'PandeMaths-report_'+str(current_time)+'.json', 'a', encoding='utf-8') as f: # append simulation into json
+                    json.dump(data, f, ensure_ascii=False, sort_keys=False, indent=4)
+                break
+        else: 
+            if total_deceased >= starting_population: # the entire population has died! [game over!]
+                status = "FATAL!"
+                contagion = 0
+                recoveries = 0
+                deaths = 0
+                susceptible = 0
+                total_population = 0
+                total_non_affected = 0
+                print("  -> [DAY: "+str(i)+"] -> [The entire population has died!...]\n      Status: ("+str(status)+") -> [Contagion: ("+str(int(contagion))+") | Recoveries: ("+str(int(recoveries))+") | Deaths: ("+str(int(deaths))+")] - [Susceptible: ("+str(int(susceptible))+") | Infected: ("+str(int(infected))+") | Recovered: ("+str(int(recovered))+") | Deceased: ("+str(int(deceased))+")]")
+                print("      Total Population: ("+str(int(total_population))+"/"+str(int(starting_population))+") | Total Contagion: ("+str(int(total_contagion))+") | Total Recovered: (" +str(int(total_recovered))+") | Total Deceased: ("+str(int(total_deceased))+") | Total N/A: ("+str(int(total_non_affected))+")\n")
+                data['SIMULATION'][0]['DAY'] = str(i)
+                data['SIMULATION'][0]['Status'] = "FATAL! [ The entire population has died! ... ]"
+                data['SIMULATION'][0]['Contagion'] = str(contagion)
+                data['SIMULATION'][0]['Recoveries'] = str(recoveries)
+                data['SIMULATION'][0]['Deaths'] = str(deaths)
+                data['SIMULATION'][0]['Susceptible'] = str(susceptible)
+                data['SIMULATION'][0]['Infected'] = str(infected)
+                data['SIMULATION'][0]['Recovered'] = str(recovered)
+                data['SIMULATION'][0]['Deceased'] = str(deceased)
+                data['SIMULATION'][0]['Total Population'] = str(total_population)
+                data['SIMULATION'][0]['Total Contagion'] = str(total_contagion)
+                data['SIMULATION'][0]['Total Recovered'] = str(total_recovered)
+                data['SIMULATION'][0]['Total Deceased'] = str(total_contagion)
+                data['SIMULATION'][0]['Total N/A'] = str(total_non_affected)
+                with open(reports_path+'PandeMaths-report_'+str(current_time)+'.json', 'a', encoding='utf-8') as f: # append simulation into json
+                    json.dump(data, f, ensure_ascii=False, sort_keys=False, indent=4)
+                break
+    status = "FINISHED!"
+    if infected == 0:
+        deaths = 0
+        recoveries = 0
+        contagion = 0
+    print("  -> [DAY: "+str(i)+"] -> [ SIMULATION END! ... ]\n      Status: ("+str(status)+") -> [Contagion: ("+str(int(contagion))+") | Recoveries: ("+str(int(recoveries))+") | Deaths: ("+str(int(deaths))+")] - [Susceptible: ("+str(int(susceptible))+") | Infected: ("+str(int(infected))+") | Recovered: ("+str(int(recovered))+") | Deceased: ("+str(int(deceased))+")]")
+    print("      Total Population: ("+str(int(total_population))+"/"+str(int(starting_population))+") | Total Contagion: ("+str(int(total_contagion))+") | Total Recovered: (" +str(int(total_recovered))+") | Total Deceased: ("+str(int(total_deceased))+") | Total N/A: ("+str(int(total_non_affected))+")\n")
+    data['SIMULATION'][0]['DAY'] = str(i)
+    data['SIMULATION'][0]['Status'] = str(status)
+    data['SIMULATION'][0]['Contagion'] = str(contagion)
+    data['SIMULATION'][0]['Recoveries'] = str(recoveries)
+    data['SIMULATION'][0]['Deaths'] = str(deaths)
+    data['SIMULATION'][0]['Susceptible'] = str(susceptible)
+    data['SIMULATION'][0]['Infected'] = str(infected)
+    data['SIMULATION'][0]['Recovered'] = str(recovered)
+    data['SIMULATION'][0]['Deceased'] = str(deceased)
+    data['SIMULATION'][0]['Total Population'] = str(total_population)
+    data['SIMULATION'][0]['Total Contagion'] = str(total_contagion)
+    data['SIMULATION'][0]['Total Recovered'] = str(total_recovered)
+    data['SIMULATION'][0]['Total Deceased'] = str(total_contagion)
+    data['SIMULATION'][0]['Total N/A'] = str(total_non_affected)
+    with open(reports_path+'PandeMaths-report_'+str(current_time)+'.json', 'a', encoding='utf-8') as f: # append simulation into json
+        json.dump(data, f, ensure_ascii=False, sort_keys=False, indent=4)
+    print("="*50 + "\n")
+    print ("[Info] Report [SAVED!] at: "+str(reports_path+'PandeMaths-report_'+str(current_time)+'.json')+"\n")
+
+def print_banner():
+    print("\n"+"="*50)
+    print(" ____                 _      __  __       _   _         ")
+    print("|  _ \ __ _ _ __   __| | ___|  \/  | __ _| |_| |__  ___ ")
+    print("| |_) / _` | '_ \ / _` |/ _ \ |\/| |/ _` | __| '_ \/ __|-2020")
+    print("|  __/ (_| | | | | (_| |  __/ |  | | (_| | |_| | | \__ /")
+    print("|_|   \__,_|_| |_|\__,_|\___|_|  |_|\__,_|\__|_| |_|___/-by psy")
+    print('\n"Pandemics Extensible Mathematical Model"')
+    print("\n"+"-"*15+"\n")
+    print(" * VERSION: ")
+    print("   + "+VERSION+" - (rev:"+RELEASE+")")
+    print("\n * SOURCES:")
+    print("   + "+SOURCE1)
+    print("   + "+SOURCE2)
+    print("\n * CONTACT: ")
+    print("   + "+CONTACT+"\n")
+    print("-"*15+"\n")
+    print("="*50)
+
+# sub_init #
+print_banner() # show banner
+option = input("\n+ CHOOSE: (M)odel or (S)imulation: ").upper()
+print("")
+print("="*50+"\n")
+if option == "S": # simulation
+    simulation()
+else: # model
+    model_maths()
+print ("="*50+"\n")

+ 3 - 0
templates/Ebola.txt

@@ -0,0 +1,3 @@
+duration:25
+contagion:91
+recov:9

+ 3 - 0
templates/Malaria.txt

@@ -0,0 +1,3 @@
+duration:21
+contagion:41
+recov:12

+ 3 - 0
templates/SARS-CoV2.txt

@@ -0,0 +1,3 @@
+duration:14
+contagion:85
+recov:95

+ 3 - 0
templates/Zika.txt

@@ -0,0 +1,3 @@
+duration:30
+contagion:41
+recov:12