Cov txheej txheem:
- Khoom siv
- Kauj Ruam 1: Nkag Siab Cov Txheej Txheem Backend (database)
- Kauj Ruam 2: Python Pob Ntawv/tsev qiv ntawv siv hauv Txoj Haujlwm
- Kauj Ruam 3: Teeb Koj Lub Tsav Tsheb, Siv Colab
- Kauj Ruam 4: Txheej txheem cej luam ntawm Txoj Haujlwm
- Kauj Ruam 5: COVID-19 Dashboard | Tshooj 1
- Kauj Ruam 6: COVID-19 Dashboard | Tshooj 2
- Kauj Ruam 7: COVID-19 Dashboard | Tshooj 3
- Kauj Ruam 8: COVID-19 Dashboard | Tshooj 4
- Kauj Ruam 9: COVID-19 Dashboard | Tshooj 5
- Kauj ruam 10: COVID-19 Dashboard | Tshooj 6
- Kauj Ruam 11: COVID-19 Dashboard | Tshooj 7
- Kauj Ruam 12: COVID-19 Dashboard | Tshooj 8
- Kauj Ruam 13: COVID-19 Dashboard | Tshooj 9
- Kauj Ruam 14: Cov Npe Ntawm Lub Tebchaws (Top10) los ntawm Tus Naj Npawb | COVID-19 Dashboard
- Kauj Ruam 15: Cov Ntaub Ntawv Tag Nrho ntawm Daim Ntawv Qhia Ntiaj Teb | COVID-19 Dashboard
- Kauj Ruam 16: Qhov tshwm sim
Video: COVID19 Dashboard ntawm Daim Ntawv Qhia Ntiaj Teb (siv Python): 16 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Kuv paub yuav luag txhua tus ntawm peb paub cov ntaub ntawv feem ntau txog COVID19.
Thiab cov lus qhia no yog hais txog kev tsim daim ntawv qhia npuas, txhawm rau txheeb xyuas cov ntaub ntawv ntawm lub sijhawm tiag (ntawm rooj plaub) ntawm daim ntawv qhia ntiaj teb.
Kom yooj yim dua, kuv tau ntxiv qhov program rau Github repository:
github.com/backshell/COVID19dashboard
Khoom siv
Tsis muaj cov khoom siv xav tau xws li thiab peb yuav ua tag nrho lub khoos phis tawj siv los ntawm GoogleColab Phau Ntawv. Yog li gmail tus account yuav tsum txaus los pib nrog.
Colab Notebooks / Colaboratory yog Google txoj haujlwm tshawb fawb tsim los pab tshaj tawm kev kawm tshuab thiab kev tshawb fawb. Nws yog Jupyter phau ntawv ib puag ncig uas tsis xav tau teeb tsa los siv thiab ua tiav hauv huab.
Thiab TSIS muaj qhov teeb tsa xav tau hauv koj lub tshuab.
Kauj Ruam 1: Nkag Siab Cov Txheej Txheem Backend (database)
Feem ntau ntawm txhua qhov software program khaws cov ntaub ntawv los ntawm cov backend thiab cov txiaj ntsig tau tsim tawm thiab luam tawm rau pem hauv ntej. Thiab rau qhov haujlwm tshwj xeeb no, peb yuav xav tau COVID19 cov ntaub ntawv tiag.
The G. W. C. Whiting Tsev Kawm Ntawv ntawm Engineering tau tshaj tawm COVID -19 txheeb cais los ntawm nws tus lej github:
github.com/CSSEGISandData
Txij thaum pib txog hnub tim, COVID19 lub teb chaws cov ntaub ntawv txheeb cais tau tshaj tawm hauv cov chaw cia khoom.
Yog li peb yuav siv. CSV cov ntaub ntawv ntawm lawv (segmented row-wise of countries) thiab npaj cov ntaub ntawv hauv ntiaj teb daim ntawv qhia.
Kauj Ruam 2: Python Pob Ntawv/tsev qiv ntawv siv hauv Txoj Haujlwm
Hauv qab no yog cov npe pob khoom nab hab sej, uas peb yuav siv. Cia kuv muab cov ntsiab lus ntawm txhua lub hom phiaj ntawm lawv.
numpy:
NumPy yog lub tsev qiv ntawv rau Python cov lus siv lus, ntxiv kev txhawb nqa rau cov chav loj, ntau qhov ntau thiab cov lej, nrog rau kev sau ntau ntawm cov lej qib siab ua haujlwm los ua haujlwm ntawm cov pawg no.
pandas:
pandas yog lub tsev qiv ntawv software sau rau Python programming lus rau kev tswj cov ntaub ntawv thiab tshuaj xyuas.
matplotlib.pyplot:
pyplot feem ntau yog npaj rau cov phiaj xwm sib tham thiab cov xwm txheej yooj yim ntawm cov phiaj xwm phiaj xwm tsim tawm
plotly.express:
Plotly Express yog qib tshiab Python kev pom lub tsev qiv ntawv. Cov syntax yooj yim rau cov kab kos nyuaj.
folium:
folium ua kom yooj yim rau pom cov ntaub ntawv uas tau siv hauv Python ntawm daim ntawv qhia sib tham sib tham
plotly.graph_objects:
Cov phiaj xwm sej Python muaj los tsim, tswj thiab ua cov duab nraaj (piv txwv li kab kos, cov phiaj xwm, daim duab qhia chaw thiab daim duab duab) sawv cev los ntawm cov ntaub ntawv teeb tsa kuj tseem hu ua cov duab.
seaborn:
Seaborn yog Python cov ntaub ntawv pom pom lub tsev qiv ntawv raws matplotlib. Nws muab cov qib siab sib cuam tshuam rau kev kos duab zoo nkauj thiab qhia paub cov duab nraaj.
ipywidgets: cov
ipywidgets yog sib tham sib HTML widgets rau Jupyter notebooks, JupyterLab thiab IPython kernel. Phau ntawv sau los muaj txoj sia thaum sib tham sib tham tau siv.
Txhim kho cov pob no tsis xav tau vim peb yuav ua haujlwm txoj haujlwm no tag nrho hauv Google Colab Phau Ntawv (cia nws khaws nws ua colab thoob plaws cov lus qhia no).
Kauj Ruam 3: Teeb Koj Lub Tsav Tsheb, Siv Colab
Hauv koj li Drive, Tsim ib daim nplaub tshev rau koj phau ntawv sau.
Hais lus thev naus laus zis, cov kauj ruam no tsis tas yuav tsum yog koj xav pib ua haujlwm hauv Colab. Txawm li cas los xij, txij li Colab tab tom ua haujlwm ntawm koj lub tsav, nws tsis yog lub tswv yim phem los qhia lub nplaub tshev uas koj xav ua haujlwm. Koj tuaj yeem ua li ntawd los ntawm kev mus rau koj li Google Drive thiab nyem "Tshiab" thiab tom qab ntawd tsim daim nplaub tshev tshiab.
Tom qab ntawd koj tuaj yeem xaiv los tsim colabnotebook ntawm no lossis pib ua haujlwm ncaj qha ua haujlwm hauv colab thiab txuas cov ntawv tais ceev tseg hauv tsav, uas yog tsim rau kev ua haujlwm colab.
Qhov no yog kev xyaum ua tau zoo, lwm qhov ntxiv cov colab peb tsim nws yuav zoo li tsis meej pem hauv peb txoj kev tsav.
Kauj Ruam 4: Txheej txheem cej luam ntawm Txoj Haujlwm
Hauv qhov haujlwm no/phau ntawv sau, peb yuav tsim cov hauv qab no rau COVID-19:
- Cov Npe Ntawm Lub Tebchaws los ntawm Tus Zauv Cov Ntaub Ntawv
- Cov Ntaub Ntawv Tag Nrho ntawm Daim Ntawv Qhia Ntiaj Teb
Kauj Ruam 5: COVID-19 Dashboard | Tshooj 1
Koj tuaj yeem siv yav tom ntej los pab txhawm rau xa koj cov cai los ntawm Python 2 mus rau Python 3 hnub no - thiab tseem muaj nws khiav ntawm Python 2.
Yog tias koj twb muaj Python 3 code, koj tuaj yeem siv yav tom ntej los muab Python 2 sib xws nrog yuav luag tsis muaj haujlwm ntxiv.
yav tom ntej txhawb cov txheej txheem kev rov txhim kho tsev qiv ntawv (PEP 3108) los ntawm ib qho ntawm ob peb lub tswv yim, tso cai feem ntau tau txav cov tsev qiv ntawv tus qauv nkag mus rau hauv lawv li Python 3 lub npe thiab chaw nyob hauv Python 2.
Kauj Ruam 6: COVID-19 Dashboard | Tshooj 2
Kev ua haujlwm sib cuam tshuam (ipywidgets.interact) cia li tsim cov neeg siv interface (UI) tswj rau kev tshawb nrhiav cov cai thiab cov ntaub ntawv sib cuam tshuam. Nws yog txoj hauv kev yooj yim tshaj plaws los pib siv IPython cov cuab yeej.
Kauj Ruam 7: COVID-19 Dashboard | Tshooj 3
display_html qhia txog HTML sawv cev ntawm ib yam khoom. Ntawd yog, nws saib mus rau npe tso saib cov txheej txheem, xws li _repr_html_, thiab hu lawv, tso tawm qhov tshwm sim, yog tias muaj.
Kauj Ruam 8: COVID-19 Dashboard | Tshooj 4
Cov npe ntawm pob khoom (raws li tau piav qhia hauv qib 2) tau txais cov khoom xa tuaj rau hauv qhov program.
Kauj Ruam 9: COVID-19 Dashboard | Tshooj 5
death_df = pd.read_csv ('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv')
confirm_df = pd.read_csv ('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv')
recovered_df = pd.read_csv ('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_recovered_global.csv')
country_df = pd.read_csv ('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/web-data/data/cases_country.csv')
Raws li tau piav qhia hauv qib 1, nyeem cov ntaub ntawv raws li.csv cov ntaub ntawv los ntawm lub chaw cia khoom.
Kauj ruam 10: COVID-19 Dashboard | Tshooj 6
Peb yuav hloov npe cov npe df rau cov ntawv me
Kauj Ruam 11: COVID-19 Dashboard | Tshooj 7
Peb yuav hloov lub xeev/xeev rau lub xeev thiab lub tebchaws/cheeb tsam mus rau lub tebchaws
Kauj Ruam 12: COVID-19 Dashboard | Tshooj 8
Peb yuav suav tag nrho cov naj npawb ntawm qhov tau lees paub, tuag thiab rov zoo.
Kauj Ruam 13: COVID-19 Dashboard | Tshooj 9
Peb yuav nthuav tawm tag nrho cov txheeb cais hauv HTML hom, raws li peb tau xa cov tsev qiv ntawv tshwj xeeb hauv qib 7 ua ntej raws li hauv qab no:
los ntawm IPython.core.display ntshuam zaub, HTML
Kauj Ruam 14: Cov Npe Ntawm Lub Tebchaws (Top10) los ntawm Tus Naj Npawb | COVID-19 Dashboard
fig = go. FigureWidget (txheej txheem = mus. Layout ())
FigureWidget muaj nuj nqi rov qab ib qho khoom tsis muaj FigureWidget nrog lub neej ntawd x thiab y axes. Jupyter sib tham sib widgets muaj tus cwj pwm txheej txheem nthuav tawm tus lej CSS cov khoom uas cuam tshuam li cas cov cuab yeej raug tso tawm.
pd. DataFrame
tsim dataframe siv phau ntawv txhais lus, nrog peb xim keeb kwm yav dhau los rau qhov tshwm sim kom muaj neeg nyob.
def show_latest_cases (TOP)
txheeb cov txiaj ntsig los ntawm kev lees paub nqis nqis.
sib tham (show_latest_cases, TOP = '10 ')
Kev ua haujlwm sib cuam tshuam (ipywidgets.interact) cia li tsim cov neeg siv interface (UI) tswj rau kev tshawb nrhiav cov cai thiab cov ntaub ntawv sib cuam tshuam.
ipywLayout = widgets. Layout (ciam teb = 'khoom 2px ntsuab')
tsim ciam teb nrog 2px dav kab ntawm cov xim ntsuab, rau qhov tshwm sim los tso saib.
Kauj Ruam 15: Cov Ntaub Ntawv Tag Nrho ntawm Daim Ntawv Qhia Ntiaj Teb | COVID-19 Dashboard
world_map = folium. Map (qhov chaw = [11, 0], vuas = "cartodbpositron", zoom_start = 2, max_zoom = 6, min_zoom = 2)
Folium yog cov cuab yeej uas ua rau koj zoo li daim duab qhia Vajtswv thaum txhua txoj haujlwm tau ua tiav nyob rau sab tom qab. Nws yog Python qhwv rau cov cuab yeej hu ua leaflet.js. Peb pib muab nws cov lus qhia tsawg kawg, JS ua haujlwm ntau nyob rau tom qab thiab peb tau txais qee daim duab qhia chaw zoo heev. Nws yog khoom zoo. Kom paub meej, daim ntawv qhia kev yog hu ua 'Leaflet Map'. Cov cuab yeej uas cia koj hu lawv hauv Python hu ua 'Folium'.
Folium ua kom yooj yim rau pom cov ntaub ntawv uas tau siv hauv Python ntawm daim ntawv qhia sib tham sib Leaflet. Nws ua rau ob qho kev khi ntawm cov ntaub ntawv rau hauv daim duab qhia chaw rau choropleth pom kev zoo ib yam li dhau Vincent/Vega pom kev zoo li cov cim ntawm daim duab qhia chaw.
rau kuv hauv ntau (0, len (confirm_df))
Hauv lub voj, peb yuav tau txais txhua qhov xwm txheej uas tau lees paub los ntawm qib 9 kev tsim qauv.
folium. Circle
Peb tsim daim ntawv qhia npuas los ntawm kev siv folium. Circle () kom rov ua haujlwm ntxiv.
qhov chaw = [tau lees paub_df.iloc ['lat'], lees paub_df.iloc ['ntev'], los ntawm kev lees paub_df ntawm cov xwm txheej tau lees paub los ntawm qib 5, peb rho tawm qhov latitude thiab longitude qhov tseem ceeb sib xws rau txhua qhov chaw/cov ntaub ntawv hauv tebchaws.
radius = (int ((np.log (confirm_df.iloc [i, -1] +1.00001))))+0.2)*50000, tsim cov khoom siv voos kheej kheej los npaj cov voj voos ntawm lub ntiaj teb daim ntawv qhia thoob plaws lub tebchaws.
xim = 'liab', fill_color = 'indigo', ua cov txheej txheem ntawm lub voj voog ua xim liab thiab thaj tsam sab hauv zoo li indigo.
thiab thaum kawg npaj lub voj voog ntawm lub ntiaj teb_map siv cov cuab yeej tooltip.
Kauj Ruam 16: Qhov tshwm sim
Cov ntawv txuas nrog:
- Cov Npe Ntawm Lub Tebchaws los ntawm Tus Zauv Cov Ntaub Ntawv
- Cov Ntaub Ntawv Tag Nrho ntawm Daim Ntawv Qhia Ntiaj Teb
Pom zoo:
Yuav Ua Li Cas Tsim Lub Ntiaj Teb Ntse Hauv Ntiaj Teb hauv 10 Hnub: 12 Kauj Ruam
Yuav Tsim Li Cas Lub Ntiaj Teb Ntse Hauv Ntiaj Teb hauv 10 Hnub: Kuv tab tom ua haujlwm uas coj cov tub ntxhais kawm los ntawm Tuam Tshoj, Philippines thiab Asmeskas ua ke ntawm pab pawg los sib tw hauv World Robot Olympiad hauv Long Beach, California. Lub ntsiab lus ntawm xyoo no yog Lub Nroog Ntse. Yog li peb tab tom tsim Lub Nroog Ntse los ntawm Ju
KEV TSHAWB TSEV KAWM NTAWV HAUV TSEV KAWM NTAWV (Tswj koj cov ntawv thov los ntawm ib tus neeg thoob ntiaj teb): 5 Kauj Ruam
KEV HLOOV TSHIAB (tswj koj cov ntawv thov los ntawm ib lub koom haum thoob ntiaj teb): Hauv cov lus qhia no kuv tau qhia yuav ua li cas koj tuaj yeem siv ESP8266 los tswj cov cuab yeej AC xws li Teeb, kiv cua, thiab lwm yam los ntawm thoob plaws ntiaj teb hauv Is Taws Nem ntawm Blynk app yog tias koj yog tshiab rau ESP8266 nco ntsoov txheeb xyuas cov lus qhia no:-Pib Pib Nrog NodeM
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: 6 Kauj Ruam
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: Cov lus qhia no piav qhia yuav ua li cas thiaj tsim tau Arduino Robot uas tuaj yeem txav mus raws qhov xav tau (Forward, Backward) , Sab laug, Txoj Cai, Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) xav tau Kev nrug deb hauv Centimeters siv lub suab hais kom ua. Neeg hlau kuj tseem tuaj yeem txav tau tus kheej
Kuv Me Me Whoop: Daim Ntawv Qhia Whoop + Cov Lus Qhia thiab Cov Lus Qhia: 8 Kauj Ruam
Kuv Me Me Whoop: Daim Ntawv Qhia Whoop + Cov Lus Qhia thiab Cov Lus Qhia: Kev Ceeb Toom: Tam sim no koj tab tom nkag mus rau kuv thawj qhov kev qhia, thiab koj yuav ntsib ntau yam kev ruam thiab tsis muaj phiaj xwm thiab/lossis txuj ci. Paub txog qhov no yog kuv tus kheej Tiny Whoop teeb tsa uas kuv siv txhua hnub, yog li kuv xav tias kuv yuav qhia nws. Nws yog phooj ywg mus ncig (tsis muaj
Yuav Ua Li Cas Txuas DeLorme Earthmate GPS LT-20 rau Koj Lub Ntiaj Teb Google rau Daim Ntawv Qhia GPS Zoo Tshaj: 5 Kauj Ruam
Yuav Ua Li Cas Txuas DeLorme Earthmate GPS LT-20 rau Koj Lub Ntiaj Teb Google rau Daim Ntawv Qhia GPS Zoo Tshaj Plaws: Kuv yuav qhia koj yuav ua li cas txuas lub cuab yeej GPS mus rau qhov kev pab cuam Google Earth nrov, tsis siv Google Earth Plus. Kuv tsis muaj peev nyiaj loj yog li kuv tuaj yeem lav tias qhov no yuav pheej yig li ua tau