Code Monkey home page Code Monkey logo

covid19-japan-web-api's Introduction

logo

COVID-19 Japan Web API

UpdateData LICENSE Tweet

Language

English🇺🇸 | Japanese🇯🇵

🦠 Web API to get COVID-19(coronavirus) information of each prefecture in Japan.

I created this API to help disseminate about the Japanese COVID-19 information. I am updating this API from time to time, so if you have an API you want to add, please let me know!

Table of Contents

Features

  • 🔁 Update data every 2 hours
  • 🚀 Provide REST API
  • 🇯🇵 Get info of each prefecture in Japan
  • ☕️ Simple data and simple to use
  • 📈 Predict for the next 30 days

Project using this API

If your project is not listed here, let us know!

Usage

We have published the Swagger API (https://covid19-japan-web-api.now.sh/apidocs).

You can see the documentation of this API and/or import it as a Postman collection using this link.


Prefectures

※ 2020/06/18 We have updated the response structure. Please make sure of the response.

Endpoint: https://covid19-japan-web-api.now.sh/api/v1/prefectures

Response
[
  {
    "id": 1,
    "name_ja": "北海道",
    "name_en": "Hokkaido",
    "lat": 43.46722222,
    "lng": 142.8277778,
    "population": 5248552,
    "last_updated": {
      "cases_date": 20200617,
      "deaths_date": 20200617,
      "pcr_date": 20200617,
      "hospitalize_date": 20200617,
      "severe_date": 20200617,
      "discharge_date": 20200617,
      "symptom_confirming_date": 20200617
    },
    "cases": 1176,
    "deaths": 91,
    "pcr": 17875,
    "hospitalize": 126,
    "severe": 10,
    "discharge": 959,
    "symptom_confirming": 0
  },
...

Total

※ 2020/06/18 We have updated the response structure. Please make sure of the response.

This API includes Quarantine staff data, FLIGHT data and SHIPMENT data.

Endpoint: https://covid19-japan-web-api.now.sh/api/v1/total

Response
{
  "date": 20200523,
  "pcr": 272095,
  "hospitalize": 2450,
  "positive": 17248,
  "severe": 178,
  "discharge": 13895,
  "death": 821,
  "symptom_confirming": 40
}

Total History

※ 2020/05/24 We have updated the response structure. Please make sure of the response.

This API includes Quarantine staff data, FLIGHT data and SHIPMENT data.

Endpoint: https://covid19-japan-web-api.now.sh/api/v1/total?history=true

Response
...
  {
    "date": 20200521,
    "pcr": 265190,
    "hospitalize": 2917,
    "positive": 17136,
    "severe": 199,
    "discharge": 13323,
    "death": 790,
    "symptomConfirming": 64
  },
  {
    "date": 20200522,
    "pcr": 269120,
    "hospitalize": 2652,
    "positive": 17225,
    "severe": 180,
    "discharge": 13656,
    "death": 809,
    "symptomConfirming": 66
  },
  {
    "date": 20200523,
    "pcr": 272095,
    "hospitalize": 2450,
    "positive": 17248,
    "severe": 178,
    "discharge": 13895,
    "death": 821,
    "symptomConfirming": 40
  }
]

Total Prediction

Predict for the next 30 days about the positive total and the death total.

This API includes Quarantine staff data, FLIGHT data and SHIPMENT data.

Endpoint: https://covid19-japan-web-api.now.sh/api/v1/total?predict=true

Response
[
  {
    "date": 20200413,
    "positive": 6960.103502394343,
    "death": 102.8839324261669
  },
  {
    "date": 20200414,
    "positive": 7652.287257933034,
    "death": 107.84568822992809
  },
  {
    "date": 20200415,
    "positive": 8413.308833378682,
    "death": 113.04673329952118
  },
  {
    "date": 20200416,
    "positive": 9250.01416438296,
    "death": 118.49860777416443
  },
  {
    "date": 20200417,
    "positive": 10169.930016336322,
    "death": 124.21340833627379
  },
  {
    "date": 20200418,
    "positive": 11181.33169302858,
    "death": 130.2038150517223
  },
  {
    "date": 20200419,
    "positive": 12293.317478949984,
    "death": 136.4831195045177
  },
  {
    "date": 20200420,
    "positive": 13515.89048489476,
    "death": 143.06525428832322
  },
...

Positives

Endpoint: https://covid19-japan-web-api.now.sh/api/v1/positives?prefecture=東京都

Query parameter

  • required: prefecture=(jp_name) : Filter by prefecture using jp_name
Response
[
  {
    "code": "",
    "announcement_date": "2020-01-24",
    "src": "https://www.metro.tokyo.lg.jp/tosei/hodohappyo/press/2020/01/24/20.html",
    "prefecture": "東京都",
    "residence_prefecture": "国外(武漢市)",
    "age": "40代",
    "gender": "男性",
    "attribute": "",
    "prefecture_number": "東京都1",
    "travel_or_contact": "渡航歴",
    "detail": "**(武漢)",
    "id": "ID130001",
    "diagnosis_date": "",
    "onset": "2020/01/14",
    "symptom": "1",
    "death_or_discharge_date": "",
    "comment": "",
    "outcome": "1",
    "outcome_src": "https://i.imgur.com/P185t7C.jpg"
  },
  {
    "code": "",
    "announcement_date": "2020-01-25",
    "src": "https://www.metro.tokyo.lg.jp/tosei/hodohappyo/press/2020/01/27/24.html",
    "prefecture": "東京都",
    "residence_prefecture": "国外(武漢市)",
    "age": "30代",
    "gender": "女性",
    "attribute": "",
    "prefecture_number": "東京都2",
    "travel_or_contact": "渡航歴",
    "detail": "**(武漢)",
    "id": "ID130002",
    "diagnosis_date": "",
    "onset": "2020/01/21",
    "symptom": "1",
    "death_or_discharge_date": "",
    "comment": "",
    "outcome": "1",
    "outcome_src": "https://i.imgur.com/P185t7C.jpg"
  },
...

Positives Statistics

This is a statistic of the positives API and does not include data that is not publicly available.

Endpoint: https://covid19-japan-web-api.now.sh/api/v1/statistics

Response
[
  {
    "name_ja": "北海道",
    "name_en": "Hokkaido",
    "total_count": 239,
    "male": {
      "count": 137,
      "generations_count": {
        "00s": 6,
        "10s": 1,
        "20s": 5,
        "30s": 8,
        "40s": 19,
        "50s": 35,
        "60s": 27,
        "70s": 19,
        "80s": 14,
        "90s": 2,
        "100s": 0,
        "unknown": 1
      }
    },
    "female": {
      "count": 100,
      "generations_count": {
        "00s": 1,
        "10s": 1,
        "20s": 14,
        "30s": 10,
        "40s": 12,
        "50s": 17,
        "60s": 15,
        "70s": 16,
        "80s": 8,
        "90s": 4,
        "100s": 0,
        "unknown": 2
      }
    },
    "unknown_gender": {
      "count": 2,
      "generations_count": {
        "00s": 0,
        "10s": 0,
        "20s": 0,
        "30s": 0,
        "40s": 0,
        "50s": 0,
        "60s": 0,
        "70s": 0,
        "80s": 0,
        "90s": 0,
        "100s": 0,
        "unknown": 2
      }
    }
  },
...

Contribution Guide

  • Please use flake8 as Lint
  • Please don't add /data directory to your commit
  • Please PullRequest to master because gitflow is not currently used

Contributers

Made with contributors-img.

Data Sources

This data was collected by volunteers and may be incorrect. Please refer to the reports of public organizations correctly.

LICENSE

MIT LICENSE

covid19-japan-web-api's People

Contributors

actions-user avatar arlemi avatar cateiru avatar dependabot[bot] avatar discombobulateddrag avatar kiyohome avatar miya avatar ryo-ma avatar tbnv999 avatar yakuri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

covid19-japan-web-api's Issues

Add percentage field to statistics api

Like this

[
  {
    "name_ja": "北海道",
    "name_en": "Hokkaido",
    "total_count": 239,
    "per_japan": 0.xxxx, // Add field
    "male": {
      "count": 137,
      "per_prefecture": 0.xxxx, // Add field
      "generations_count": {
        "00s": 6,
        "10s": 1,
        "20s": 5,
        "30s": 8,
        "40s": 19,
        "50s": 35,
        "60s": 27,
        "70s": 19,
        "80s": 14,
        "90s": 2,
        "100s": 0,
        "unknown": 1
      }
    },
    "female": {
      "count": 100,
      "per_prefecture": 0.xxxx, // Add field
      "generations_count": {
        "00s": 1,
        "10s": 1,
        "20s": 14,
        "30s": 10,
        "40s": 12,
        "50s": 17,
        "60s": 15,
        "70s": 16,
        "80s": 8,
        "90s": 4,
        "100s": 0,
        "unknown": 2
      }
    },
    "unkown_gender": {
      "count": 2,
      "per_prefecture": 0.xxxx, // Add field
      "generations_count": {
        "00s": 0,
        "10s": 0,
        "20s": 0,
        "30s": 0,
        "40s": 0,
        "50s": 0,
        "60s": 0,
        "70s": 0,
        "80s": 0,
        "90s": 0,
        "100s": 0,
        "unknown": 2
      }
    }
  },

Add testing

I think that it should add testing to this project.
Suspend deployment when source data format is changed.

API Updata

I noticed that the date of the total data of this API has not been updated for many days. Did the API stop updating?

Query prefecture with history

I would like to query the history of infections in a given prefecture, similar to the query for total infections. This would allow showing deltas day-to-day and drawing graphs. Is this possible to add?

Positives API returns 500 Internal Server Error

Steps to Reproduce
run debug.py and open url like this:
http://localhost:8080/api/v1/positives?prefecture=東京都

Version
python 3.8.1(pyenv, pyenv-virtualenv)

logs 127.0.0.1 - - [22/Jun/2020 22:09:13] "GET /api/v1/positives?prefecture=東京都 HTTP/1.1" 500 - Traceback (most recent call last): File "/home/nano/.pyenv/versions/3.8.1/envs/covid19/lib/python3.8/site-packages/flask/app.py", line 2464, in __call__ return self.wsgi_app(environ, start_response) File "/home/nano/.pyenv/versions/3.8.1/envs/covid19/lib/python3.8/site-packages/flask/app.py", line 2450, in wsgi_app response = self.handle_exception(e) File "/home/nano/.pyenv/versions/3.8.1/envs/covid19/lib/python3.8/site-packages/flask/app.py", line 1867, in handle_exception reraise(exc_type, exc_value, tb) File "/home/nano/.pyenv/versions/3.8.1/envs/covid19/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise raise value File "/home/nano/.pyenv/versions/3.8.1/envs/covid19/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "/home/nano/.pyenv/versions/3.8.1/envs/covid19/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/nano/.pyenv/versions/3.8.1/envs/covid19/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/nano/.pyenv/versions/3.8.1/envs/covid19/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise raise value File "/home/nano/.pyenv/versions/3.8.1/envs/covid19/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/home/nano/.pyenv/versions/3.8.1/envs/covid19/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/nano/.pyenv/versions/3.8.1/envs/covid19/lib/python3.8/site-packages/flask_cors/decorator.py", line 128, in wrapped_function resp = make_response(f(*args, **kwargs)) File "/home/nano/PycharmProjects/covid19-japan-web-api/index.py", line 78, in positives response_json = data_manager.get_positive_detail_json(prefecture) File "/home/nano/PycharmProjects/covid19-japan-web-api/src/data_manager.py", line 21, in get_positive_detail_json json_dict = [x for x in json.loads(self.positive_detail_json) if x['prefecture'] == prefecture] AttributeError: 'DataManager' object has no attribute 'positive_detail_json'

wrong API positives data

Details

output API data is wrong when running below positives command.

https://covid19-japan-web-api.now.sh/api/v1/positives

{
"date": "北海道",
"prefecture": "国外(武漢市)",
"residence_prefecture": "40代",
"age": "女性",
"gender": "来日観光客",
"attribute": "北海道1",
"prefecture_number": "渡航歴",
"travel_or_contact": "**(武漢)",
"detail": "",
"src": "https://www.mhlw.go.jp/stf/newpage_09158.html",
"onset": "2020/01/26",
"symptom": "1",
"death_or_discharge_date": "",
"comment1": "",
"outcome": "",
"outcome_src": "",
"comment2": ""
},
...

キーの値の意味について

prefectureslatdischargeなどの値の意味がわかりません。
他にもわからないキーが有るため全ての意味をドキュメントにまとめていただくことはできないでしょうか?

Total History APIのdeathが実際と乖離している

お世話になっております。
Total History APIで取得したところ、昨日の死者数が267となっていて、実際の死者数(400人超)と乖離があるようでした。
お時間のあるときにご確認いただけると幸いです。
お手数お掛けしますが、よろしくお願いいたします。

  {
    "date": 20200428,
    "pcr": 133578,
    "positive": 13422,
    "symptom": 8177,
    "symptomless": 848,
    "symptomConfirming": 4397,
    "hospitalize": 11252,
    "mild": 5577,
    "severe": 305,
    "confirming": 663,
    "waiting": 310,
    "discharge": 1903,
    "death": 267
  }

There are some errors in the dataset

First of all, thank you very much for your contribution to the fight against COVID. I found some errors when using this data

1 Total and Total history have different Numbers of deaths

2 Total history's number of PCR on 2020-03-19 and 2020-03-25, Because the number of these two days is less than the previous two days.

Postman template

Hey!

I found your project listed on the awesome-coronavirus list and thought it could be helpful to create a collection to make it easier for interested users to query your API, the collection is published here:
https://documenter.getpostman.com/view/9215231/SzYaWe6h?version=latest

We're currently gathering a list of APIs around Covid-19 and would love to add yours if you'd allow us, you can check the current list here: https://github.com/postmanlabs/covid-19-apis

Also for now the collection is published under my name but I would be very happy to give you ownership if you'd prefer!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.