[PYTHON] The story of the student who developed the new coronavirus countermeasure site (Ishikawa version)

Finished product

https://covid19-ishikawa.com/

Self-introduction

Hello, it is intended to become a Toyo University information cooperation Faculty of new 4 years. iniad.jpeg

It's still a chick among chicks, so I hope you can see it with warm eyes. (Because it's M, it's OK even if it's tough!) It's been hard these days. I also entered spring break and the intern was temporarily closed. I'm sad because I don't have a salary ... If you have a job, please contact me! !!

Development history

I returned to Ishikawa prefecture to evacuate, but I'm not surprised. So it's always rumbling. .. .. One day, after two weeks of such days, some interesting activity ...

It's about the new coronavirus countermeasure site in Tokyo.

スクリーンショット 2020-03-28 4.44.15.png

I want to make it too! !! With that in mind, I decided to make it. I'm sorry for the shit

First of all?

I thought about how to make it. If you bring the source code, you can go! !!

https://github.com/tokyo-metropolitan-gov/covid19

To tell the truth, you can also put in a way to contribute.

https://qiita.com/FPC_COMMUNITY/items/b9cc072813dc2231b2b2

Then it's easy! !! !!

Actually, vue and nuxt are refreshing. But for the time being, I'll replace all the parts of Tokyo with Ishikawa prefecture. ogp? favicon? I also learned for the first time, but I will use adobe to make Ishikawa prefecture well.

It was replaced relatively easily

スクリーンショット 2020-03-28 4.44.23.png

what! It's easy! !! Margin Margin. .. .. .. You don't have the essential data! !! I have never regretted not having so much preparation and planning. Which is the data of coronavirus in Ishikawa prefecture? ?? There is it properly! !! Click ... スクリーンショット 2020-03-28 4.44.31.png

https://www.pref.ishikawa.lg.jp/kansen/coronakennai.html

Yes! Okay. I don't have any csv or excel data. (Sad) Still open data? !! Taking advantage of what I learned at university ...

Firmly scraping

I thought that python could do it, so I will format the data with bs4 and pandas. Well, I was able to write like this. (If you have redundant code, please let me know)

Postscript The corona information format has changed little by little between the original Ishikawa Prefecture homepage and the present. Therefore, I made many corrections. Later, the prefecture's information system contacted me and said that they would unify the format. There is no problem after that.

https://github.com/Retsuki/covid19-ishikawa-scraper/tree/master/src

Finally deploy?

How can I get it? ?? I've only used heroku, so ... Hmm, I was worried.

And the ray of light I found ~ Encounter with netlify ~

netlify.png

https://tech.moyashidaisuke.com/entry/covid19-netlify Is it so easy? !! I was impressed that it was a great time.

Alright! I was able to publish it! (April 23 screenshot)

スクリーンショット 2020-04-22 21.05.01.png

https://covid19-ishikawa.com/ Okay yeah! However! !! !! Another problem here is ... Is this a manual update of data? ??

~~ No, wait a minute, wait a minute, brother. .. .. Actually, I had experience using cron at the internship I immediately guessed! ~~

~~ I rented a server from Sakura-san ... ~~

sakuracloud.png

~~ It was a moment. If you email Sakura-san, please respond promptly. Maybe there is no server cost! Set up on the cloud server. Write an execution command in the shell ~~

~~ Regular execution with cron ~~

Changed to automatic update on Github Actions

For the contents, refer to the following article in Nagano prefecture, ... https://qiita.com/wataruoguchi/items/0f69f72777237674074b

Actual code https://github.com/Retsuki/covid19-ishikawa-scraper

It's completed! !!

Number of days taken

4 days? Day 1: Improve the site to Ishikawa version Day 2: Scraping data Day 3: I was sad, so I took a rest. Day 4: Automatic data update : I tweeted the situation on Twitter api at 6 am. Day 5: The scraping code was corrected again because the information disclosure on the coronavirus site in Ishikawa Prefecture changed. Day 20: Apply to netlify for unlimited use of the service as a corona countermeasure site (unlimited on the day) Day 20: Production deployment Day 21: url registration with google search console Day 22: Domain acquisition, domain change with netlify Day 24: Automatically updated on Github actions Day 24: Logo design change Day 24: Create a site map and send it with search console (SEO measures) Day 25: Display news of Corona, Ishikawa Prefecture (automatic update) Day 25: Added graph of infected people by place of residence

Try to work on

It was a lot of fun! !! It's almost plagiarism, but the people who made Tokyo are really great. It was all thanks to those people. This year, my goal was to achieve it, so Actually, it was a very happy day.

Ingenuity

Scraping

From the beginning, the format of the Ishikawa homepage of the original site has changed little by little. Since there was no uniformity, I made corrections each time to increase versatility.

Automatic tweets on Twitter

Local friends were used by SNS, so Changed to automatically tweet at 6 am on Twitter.

The top 6 links of the prefecture's corona news will also be released

The update of the original site is slower than the news, so In that case, I thought it would be better to show the latest news of the top 6 cases.

Bar graph of the number of infected people by place of residence

It is published as a table on the Ishikawa Prefecture homepage of the original site. スクリーンショット 2020-04-22 21.06.02.png

スクリーンショット 2020-04-22 23.01.38.png

However, I found it difficult to see because there are 19 cities, wards, towns and villages. Also, when I asked an acquaintance, there were some cities, wards, towns and villages where no infected person was confirmed. He said he didn't know how much they should refrain from going out. Therefore, I made it possible to see the infected person information in my area at a glance by making a bar graph.

To Japan

I don't say I'll do my best. If anyone is in trouble, help. I think that will make it a little more peaceful. Pray for peace in the world ... we can do it!!!

~~ # Ishikawa Corona Account ~~ ~~https://twitter.com/Ishikawa_Covid~~

Sites that were taken care of

[Tokyo New Coronavirus Countermeasure Site] https://stopcovid19.metro.tokyo.lg.jp/ [Procedure to fork the Tokyo Metropolitan Government New Coronavirus Infection Control Site and launch a dev environment with netlify] https://tech.moyashidaisuke.com/entry/covid19-netlify [Patient outbreaks of new coronavirus infections in the prefecture] https://www.pref.ishikawa.lg.jp/kansen/coronakennai.html [Sakura Cloud] https://cloud.sakura.ad.jp/ [My faculty] https://www.iniad.org/

Recommended Posts

The story of the student who developed the new coronavirus countermeasure site (Ishikawa version)
Plot the spread of the new coronavirus
Estimate the peak infectivity of the new coronavirus
The story of making the Mel Icon Generator version2
Factfulness of the new coronavirus seen in Splunk
GUI simulation of the new coronavirus (SEIR model)
Verify the effect of leave as a countermeasure against the new coronavirus with the SEIR model
Let's test the medical collapse hypothesis of the new coronavirus
The story of sys.path.append ()
Let's simulate the effect of introducing a contact tracking app as a countermeasure against the new coronavirus
Quantify the degree of self-restraint required to contain the new coronavirus
The story of downgrading the version of tensorflow in the demo of Mask R-CNN.
Align the version of chromedriver_binary
The story that the version of python 3.7.7 was not adapted to Heroku
The story of creating a site that lists the release dates of books