Goal setting

  1. Map the global distribution and thermal map of COVID-19 infections
  2. Map the distribution and thermal map of COVID-19 infected persons in various provinces and cities in China

solution

Data cleaning

  1. Data provided by the data of infection, through akshare access to netease, detailed reference: akshare. Readthedocs. IO/zh_CN/lates…
  2. Global location data: A relatively complete JSON file was found after multiple searches and screening on the Internet, which lacked some infected country data, which has been supplemented
  3. Chinese location data: the longitude and latitude of provinces and cities are obtained by calling the geocoding interface of Baidu API
  4. Data synthesis, infection data and location data synthesis into the required data, through FastAPI to create REST API interface for the front call

Infection with data

<! - after cleaning (global) -- - > {" Chinese ": {" confirm" : 80956, "dead" : 3162, "at heal:" 61574, "severe" : 4492, the "suspect" : 285}, "Japan" : { "confirm": 1277, "dead": 19, "heal": 427, "severe": 0, "suspect": 0 }, ... }Copy the code

Note: The domestic infection data are relatively complex, which can be divided into 4 categories: identified provinces and cities, unspecified provinces and cities, overseas exports, and people coming to Beijing, Tianjin and Shanghai from other places. Here, only identified provinces and cities are taken as examples

<! ' 'cityName' : 'Wuhan', 'currentConfirmedCount' :14438, 'confirmedCount' :49978, 'Basil Basil' :0, "CuredCount ":33117, "deadCount":2423, "locationId":420100, "provinceName":" Hubei"}, {"cityName":" filial ", "currentConfirmedCount":243, "confirmedCount":3518, "suspectedCount":0, "curedCount":3149, "deadCount":126, "ProvinceName ":" provinceName"},... }Copy the code

Sample global data

<! - global latitude and longitude data - > {" the republic of the Congo ": {" lat" : "3.956184", "says lon" : "15.438615"}, "Martinique" : {" lat ":" 14.625303 ", "says lon" : "61.055331"}, "Togo ":{" LAT ":"6.180834"," LON ":"1.226131"},... }Copy the code

Encapsulate the interface after data composition

Note: this interface is temporarily open, not guarantee stability, do not malicious use and attack

Interface address (global) : pandora128. Cn/fastapi/vir…

Interface address (Chinese) : pandora128. Cn/fastapi/vir…

Request method: POST

Request parameters: None

The self-built EOLINKER management interface is used here, and the test results are as follows:

Results show