Metadata-Version: 2.1
Name: covid19-id
Version: 1.1.0
Summary: Python module for getting Indonesian covid19 data from covid19.go.id
Home-page: https://github.com/hexatester/covid19-id
License: MIT
Keywords: covid19,indonesia,api,covid-data
Author: hexatester
Author-email: hexatester@protonmail.com
Requires-Python: >=3.7,<4.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Scientific/Engineering
Provides-Extra: ujson
Requires-Dist: attrs (>=20.3.0,<21.0.0)
Requires-Dist: cattrs (>=1.3.0,<2.0.0)
Requires-Dist: python-dateutil (>=2.8.1,<3.0.0)
Requires-Dist: ujson (>=4.0.2,<5.0.0); extra == "ujson"
Project-URL: Repository, https://github.com/hexatester/covid19-id
Description-Content-Type: text/markdown

# covid19-id

[![covid19-id - PyPi](https://img.shields.io/pypi/v/covid19-id)](https://pypi.org/project/covid19-id/)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/covid19-id)](https://pypi.org/project/covid19-id/)
[![LICENSE](https://img.shields.io/github/license/hexatester/covid19-id)](https://github.com/hexatester/covid19-id/blob/main/LICENSE)
[![codecov](https://codecov.io/gh/hexatester/covid19-id/branch/main/graph/badge.svg)](https://codecov.io/gh/hexatester/covid19-id)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Mypy](https://img.shields.io/badge/Mypy-enabled-brightgreen)](https://github.com/python/mypy)

Python module for getting data from Indonesian government ([covid19.go.id](https://data.covid19.go.id/public/index.html))

[Readme Bahasa Indonesia](https://github.com/hexatester/covid19-id/blob/main/README.id.md)

## Install

You can install or upgrade covid19-id with:

```bash
pip install covid19-id --upgrade
```

## Optional Dependencies

covid19-id can be installed with optional [ujson](https://pypi.org/project/ujson/ "ujson - PyPi") dependency.

```bash
pip install covid19-id[ujson]
```

It will then be used for JSON decoding, which can bring speed up compared to the standard [json](https://docs.python.org/3/library/json.html "python json docs") library.

## Example

### Get Data

```python
import covid19_id

data = covid19_id.get_data()

print("View symptom data")
print(f"Recorded data {100-data.kasus.gejala.missing_data:.2f}%")
print(f"Unrecorded data {data.kasus.gejala.missing_data:.2f}%")

for gejala in data.kasus.gejala.list_data:
    print(f"{gejala.doc_count:.2f}% with symptoms {gejala.key.capitalize()}")

```

### Get Updates

```python
import covid19_id

all_update = covid19_id.get_update()

total = all_update.update.total

print(f"covid19; positive cases in Indonesia : {total.jumlah_positif}")
print(f"covid19; patients treated in Indonesia {total.jumlah_dirawat}")
print(f"covid19; patients recovered in Indonesia {total.jumlah_sembuh}")
print(f"covid19; patients died in Indonesia {total.jumlah_meninggal}")

```

### Provinsi

```python
import covid19_id

data_provinsi = covid19_id.get_prov()

for provinsi in data_provinsi.list_data:
    print(f"Province : {provinsi.key}")
    print(f"Cases {provinsi.jumlah_kasus}")
    print(f"Recovered {provinsi.jumlah_sembuh}")
    print(f"Died {provinsi.jumlah_meninggal}")
    for umur in provinsi.kelompok_umur:
        print(f"Age {umur.key} : {umur.doc_count}")
    penambahan = provinsi.penambahan
    print(f"Additional Positive Cases {penambahan.positif}")
    print(f"Additional Recovered {penambahan.sembuh}")
    print(f"Additional Died {penambahan.meninggal}")
    print("")

```

### Vaccinated

```python
import covid19_id


pemeriksaan_vaksinasi = covid19_id.get_pemeriksaan_vaksinasi()

vaksinasi_total = pemeriksaan_vaksinasi.vaksinasi.total

print(f"vaccinated population (first one) {vaksinasi_total.jumlah_vaksinasi_1}")
print(f"vaccinated population (second time) {vaksinasi_total.jumlah_vaksinasi_2}")

```

