Code Monkey home page Code Monkey logo

api's Introduction

covid19india

View our live patient database. If you'd like to collaborate, join the Telegram Group.

to run

git clone https://github.com/BetaTurtle/covid19india.git

Python3 : python -m http.server

Python2 : python -m SimpleHTTPServer

Open http://localhost:8000 in browser to test

to deploy

minify and add to docs directory

Install minify npm i minify -g

minify script.js > docs/script.js

minify index.html > docs/index.html

api's People

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  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

api's Issues

Add more documentation to the README

README can give more context regarding the details in the API

It can also mention a changelog as lot of data fields are getting added to the data.

Expose Factoid sheet as an API

The Google Sheet has a "Factoid" sheet. Please commit that along with the automatic action. (Maybe a separate website_data.json)?

Relationship Extraction API Info Addition

What works for relationship extraction API

Code is here: https://github.com/NirantK/coronaIndia/blob/master/relationship_server.py

Relationship

What works

"Family of P13"
"Son of P12 and Daughter of P12"
"Friend of P12, P12, 14 and son of P13"

What doesn't work : Relationship without word of

"Friend: P12"
"Friends with P12"
"Wife of p12" #Expected P12 (throws error with small p)

Travel Places

What works

Travelled from Wuhan
Travel history Italy, Pune, Mumbai
Travlled from South Korea via Mumbai

Nationality

What works

Indian student studying in wuhan
Italian tourise

What doesn't work

Indian travelling with Italian tourist
# Will return Indian and Italian

API Details

API URL : http://coronatravelhistory.pythonanywhere.com/

Example request :

curl --header "Content-Type: application/json" --request POST --data '{"patients":[{"patientId":"1","notes":"Travelled from Italy"}]}' http://coronatravelhistory.pythonanywhere.com/

Python Example Request :

import requests

headers = {
    'Content-Type': 'application/json',
}

data = '{
    "patients": [
        {
            "patientId": "1",
            "notes": "Indian Student Travelled from Italy, Family Member of P13 Friend with P12"
        }
    ]
}'

response = requests.post('http://coronatravelhistory.pythonanywhere.com/', headers=headers, data=data)

Input Data Example :

{
    "patients": [
        {
            "patientId": "1",
            "notes": "Indian Student Travelled from Italy, Family Member of P13 Friend of P12"
        }
    ]
}

Returns :

{
    "patients": [
        {
            "1": {
                "nationality": [
                    "Indian"
                ],
                "place_attributes": [
                    {
                        "is_foreign": true,
                        "place": "Italy"
                    }
                ],
                "relationship": [
                    {
                        "link": "Family Member",
                        "with": [
                            "P13"
                        ]
                    },
                    {
                        "link": "Friend",
                        "with": [
                            "P12"
                        ]
                    }
                ],
                "travel": [
                    "Italy"
                ]
            }
        }
    ]
}

Enhancement on data listing

Add codes to states like : "state_code" : "DL" so that we can filter the data out.
Also the structure should be :
{"state" : "Delhi",
"state_code" : "DL",
"data" : [{
"name" : "East Delhi",
"confirmed_Cases" : 30
.
.
.
},
{
}
..
]
}

Delta Not Consistent

Hello, we've just started consuming the API and everything was fine. From midnight, the delta has stopped showing. I saw the data.json and it turns out the statewise "total" delta is empty. Instead, now it's shown in "keyvalues". Why this change?

"key_values": [
		{
			"confirmeddelta": "0",
			"counterforautotimeupdate": "645",
			"deceaseddelta": "1",
			"lastupdatedtime": "31/03/2020 09:07:24",
			"recovereddelta": "1",
			"statesdelta": "0"
		}
	],
	"statewise": [
		{
			"active": "1165",
			"confirmed": "1347",
			"deaths": "44",
			"delta": {
				"active": 0, 
				"confirmed": 0, 
				"deaths": 0, 
				"recovered": 0 
			},
			"lastupdatedtime": "31/03/2020 09:07:24",
			"recovered": "138",
			"state": "Total"
		},

Data refresh strategy

I see a lot of data update commits.
What's the process ?? After the moderators confirm the reported case is correct, someone executes "pushthejson" script and then all the JSON are updated ??
If my understanding is correct here, may I help to improve this process if you guys feel that is needed?

District names in API do not reflect actual districts in the Map

Refer to Issue #26 for such a similar case.
A similar trend is observed in other states as well.

As you can see below, the district name is "SHAHID BHAGAT SINGH NAGAR" in API as well as the left drop down of the state wise distribution. While the actual mapping on the Map does not have any district with this name, instead the actual district "SHAHEED BHAGAT SINGH NAGAR" on the map shoes 0 confirmed cases, which is not correct as per the API and latest data.

Can we find a way to improve the mapping system from API to the actual Map on the website?
Either by giving them unique IDs and keeping optional reference names as they arrive so that the actual ID and mapping does not change even after the API changes.

Screenshot from 2020-03-29 21-28-57

Is the API open ?

Can we use the data from api by giving proper credits to covid19india.org.

updating the /v2/state_district_wise.json format

Can we use the following json format :-
{
"Kerala": {
"districtData": {
"Thrissur": {
"confirmed": 12,
"active": 10, // new addition
"deaths": 0, // new addition
"recovered": 2, // new addition
"lastupdatedtime": "",
"delta": {
"confirmed": 0,
"active": 0, // new addition
"deaths": 0, // new addition
"recovered": 0 // new addition
}
}
}
This can help us track the number of active and recovered cases per city. We can display this info on the website.

Reflect the new logic to calculate delta values into the API

Initial logic to calculate recovered and deceased delta from the raw data failed as the number of cases increased and it was getting tough to assign the aggregate number to individual patients.
We revoked that calculation and made those values 0.

#61
#45

We made changes in the process and logic and the correct daily delta for recovered and deaths are now available in the StateWise sheet. This need to the updated in the delta dictionary as before.

Delta calculation not correct as it assumes all delta's are positive

  let currentStatus = row.currentstatus;
  if (currentStatus) {
    stat.confirmed += 1;
    switch (currentStatus) {
      case "Hospitalized":
        stat.active += 1;
        break;
      case "Recovered":
        stat.recovered += 1;
        break;
      case "Deceased":
        stat.deaths += 1;
        break;
    }

Eg: Total active cases in a state can go down, if no new case and more than one recovered case. Delta for "active" should be negative in this case and UI should show down arrow.

Right now its using "current status" value to increment each delta.

Data mismatch with regarding statesv2

Data in main statesv2 api is different than that of maindashboard a new values of unknown states is getting processed including the unknown districts compared with data.json,raw_data for cities and statesv2 for daily deltas of districts

image

even when using single table same result while processing the api

image

in api url also same representation

image

state_district_wise.json format update -> JSON array

I propose updating the JSON format to have a JSON array to make it simpler to parse it easily in a dynamic manner.

Current JSON format

{
	"Kerala": {
		"districtData": {
			"Thrissur": {
				"confirmed": 7,
				"lastupdatedtime": "",
				"delta": {
					"confirmed": 0
				}
			},
			"Alappuzha": {
				"confirmed": 2,
				"lastupdatedtime": "",
				"delta": {
					"confirmed": 0
				}
			}
		}
	},
	"Maharashtra": {
		"districtData": {
			"Pune": {
				"confirmed": 42,
				"lastupdatedtime": "",
				"delta": {
					"confirmed": 5
				}
			},
			"Mumbai": {
				"confirmed": 75,
				"lastupdatedtime": "",
				"delta": {
					"confirmed": 3
				}
			}
		}
	},
	"Unknown": {
		"districtData": {
			"Unknown": {
				"confirmed": 284,
				"lastupdatedtime": "",
				"delta": {
					"confirmed": 0
				}
			}
		}
	}
}

Proposed JSON format

{
	"districtWise": [
		{
			"state": "Maharashtra",
			"districtData": [
				{
					"districtName": "Pune",
					"confirmed": 42,
					"lastupdatedtime": "",
					"delta": {
					  "confirmed": 5
					}
				},
				{
					"districtName": "Mumbai",
					"confirmed": 75,
					"lastupdatedtime": "",
					"delta": {
					  "confirmed": 3
					}
				}
			]
		},
		{
			"state": "Kerala",
			"districtData": [
				{
					"districtName": "Thrissur",
					"confirmed": 7,
					"lastupdatedtime": "",
					"delta": {
					  "confirmed": 0
					}
				},
				{
					"districtName": "Alappuzha",
					"confirmed": 2,
					"lastupdatedtime": "",
					"delta": {
					  "confirmed": 0
					}
				}
			]
		},
		{
			"state": "Unknown",
			"districtData": [
				{
					"districtName": "Unknown",
					"confirmed": 284,
					"lastupdatedtime": "",
					"delta": {
					  "confirmed": 0
					}
				}
			]
		}
	]
}

Link to latest update source from each state

This issue is linked to covid19india/covid19india-react#558

Is your feature request related to a problem? Please describe.
No. It is a new feature which would help people like me who would like to know more about the update.

Describe the solution you'd like
In recent days, we see that each state government is mostly giving one update per day. It would be good if we could the link to the source of this update.

In Rajasthan state there is a district "Pratapgarh" which is displayed like "Pratapgarh ".

Due to this, there is a problem in the live site. for details, please see the below points.
Describe the bug
In map patient count is not reflecting on 'Pratapgarh' district of Rajasthan

To Reproduce
Steps to reproduce the behavior:

Go to 'Rajasthan map and expand it'
Click on 'Pratapgarh district'
Scroll down to 'Rajasthan' under column State\UT
See the patient count
Expected behavior
A clear and concise description of what you expected to happen.

Map color of Pratapgarh should be changed (slight red)
It should show count as 2.

77844006-0a60d880-71c0-11ea-8170-1a6057470520

iOS Application based on this API

Hi Team,

I would like to create an iOS App using this API. I am seeking your permission to use this API for the app. I am willing to create it as part of covid19india project.

Add Death_And_Recovery sheet as an API

Currently, details in the raw_data for death and recovery won't match the exact numbers because, most of the time we won't have the exact details which patient the news or bulletin is referring to.

So, we have created a separate sheet where this details are added.

It would be great if this sheet is provided as an API separately or as part of raw_data.

need help to use this api in a IOT display

I am trying to create a LED matrix and a 2line Display that will display the live data using ESP8266 microcontroller, Is there any way to just only get the total data like - total confirmed case, total recovered, etc via the API, cause it will be hard to decode that much data using small microcontrollers.

Found Typo

There are Kasaragod and Kasargod in Kerala data in state_district_wise.json
You can ignore Kasargod.

Invalid district "Vellorer" in Tamilnadu

Duplicate entry for the district "Vellore" is present and the name is given as Vellorer.

@JunaidBabu - From your previous comment, saw that the corresponding google sheet has to be corrected by removing this data. Thanks.

File: state_district_wise.json, Line: 508

The API response does not look like properly formatted JSON data?

There are no square brackets. Nor is this data properly iterable in JS via "key in" or any other method. I'm talking about state_district_wise. Not being able to access the keys numerically, say data[0] instead of typing data['Kerala'] is a problem when there is even more nested data, and no state-wise summary is available - in which case I would have reluctantly hard-coded the 28 values..

Or maybe I'm not knowledgeable enough, will appreciate some help.

Problem with /v2/state_district_wise.json

Can the format of state_district_wise be changed to the format same as in statewise to make it simpler to parse it easily in a dynamic manner.

Current Format

[
{
"state": "Kerala",
"districtData": [
{
"district": "Thrissur",
"confirmed": 12,
"lastupdatedtime": "",
"delta": {
"confirmed": 0
}
},
{
"district": "Alappuzha",
"confirmed": 3,
"lastupdatedtime": "",
"delta": {
"confirmed": 0
}
},

proposed format

{
"state": "Kerala",
"districtData": [
{
"district": "Thrissur",
"confirmed": 12,
"lastupdatedtime": "",
"delta": {
"confirmed": 0
}
},
{
"district": "Alappuzha",
"confirmed": 3,
"lastupdatedtime": "",
"delta": {
"confirmed": 0
}
},
{
"district": "Kasaragod",
"confirmed": 143,
"lastupdatedtime": "",
"delta": {
"confirmed": 0
}
},

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.