Lewuathe / COVID19-SIR

COVID-19 SIR model estimation
https://www.lewuathe.com/covid-19-dynamics-with-sir-model.html
Apache License 2.0
131 stars 75 forks source link

Not to remove country with provinces #17

Closed gasilva closed 4 years ago

gasilva commented 4 years ago

As the current code exclude countries with provinces, you can not analyze Canada, Australia, France, United Kingdom and China.`

See below a code to sum the cases of the provinces in one country entry:

`

def sumCases_province(input_file, output_file):

   with open(input_file, "r") as read_obj, open(output_file,'w',newline='') as write_obj:
       csv_reader = reader(read_obj)
       csv_writer = writer(write_obj)

       lines=[]
       for line in csv_reader:
           lines.append(line)    
       i=0
       ix=0
       for i in range(0,len(lines[:])-1):
           if lines[i][1]==lines[i+1][1]:
               if ix==0:
                   ix=i
               lines[ix][4:] = np.asfarray(lines[ix][4:],float)+np.asfarray(lines[i+1][4:] ,float)
           else:
               if not ix==0:
                   csv_writer.writerow(lines[ix])
                   ix=0
               else:
                   csv_writer.writerow(lines[i])
           i+=1    

`

you can call remove_province of sumCases_province

bolinches commented 4 years ago

Hi cool, can you do a pull request also?

gasilva commented 4 years ago

OK. I will do it today.I am also tested odeint instead of solve_ivp.Really fast. Guilherme A. Lima da Silva,Dr.CEO fone:+55-11-4119-5549 celular:+55-11-982-088-565Av. Pompéia, 634 cj. 113 - São Paulo - SP - 05022-000

On Wed, Apr 1, 2020 6:37 AM, bolinches notifications@github.com wrote:

Hi cool, can you do a pull request also?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

gasilva commented 4 years ago

I submitted a modification today. It is up to you to approve

gasilva commented 4 years ago

I just did the pull request.

bolinches commented 4 years ago

I have no write permission

gasilva commented 4 years ago

I have no write permission

I gave you access to the fork. See the invitation. @bolinches

bolinches commented 4 years ago

Thanks

I guess this is solved on #22

I did not look into data with provinces but I guess there are many interested on those. Thanks for taking care of that

Lewuathe commented 4 years ago

Thanks. I'll close this.