This release is a pre-release and may not be stable for production use.
datagovgr-datamodels
Datamodels created for handling the data from the https://data.gov.gr API.
The models are automatically generated from the unofficial API documentation,
using the datamodel-code-generator.
For more information regarding the related project, see https://github.com/KAUTH/govgr-opendata-api-schema.
Supported datamodels
- pydantic_v1.BaseModel
- pydantic_v2.BaseModel
Note: At this moment, the package focuses on the datamodels of the responses.
Quick Installation
To install datagovgr-datamodels:
- For
pydanticmodels:
$ pip install datagovgr-datamodels[pydantic]
Example Usage
Pydantic models
-
To test querying the API and using the
pydanticdata models, provide a valid token and run:
$ python3 examples/pydantic_v1_models.py -
Example directly using
pydanticv1 models:
from datagovgr_datamodels.pydantic_v1 import VaccinationData
data = {
'area': 'ΑΝΑΤΟΛΙΚΗΣ ΑΤΤΙΚΗΣ',
'areaid': 901,
'dailydose1': 45,
'dailydose2': 0,
'dailydose3': 0,
'daydiff': 0,
'daytotal': 45,
'referencedate': '2021-01-01T00:00:00',
'totaldistinctpersons': 276,
'totaldose1': 276,
'totaldose2': 0,
'totaldose3': 0,
'totalvaccinations': 276
}
vaccination = VaccinationData.parse_obj(data)
print(
f"Total vaccinations in '{vaccination.area}' "
f"for {vaccination.referencedate.date()}: "
f"{vaccination.totalvaccinations}."
)
- Example directly using
pydanticv2 models:
from datagovgr_datamodels.pydantic_v2 import VaccinationData
data = {
'area': 'ΑΝΑΤΟΛΙΚΗΣ ΑΤΤΙΚΗΣ',
'areaid': 901,
'dailydose1': 45,
'dailydose2': 0,
'dailydose3': 0,
'daydiff': 0,
'daytotal': 45,
'referencedate': '2021-01-01T00:00:00',
'totaldistinctpersons': 276,
'totaldose1': 276,
'totaldose2': 0,
'totaldose3': 0,
'totalvaccinations': 276
}
vaccination = VaccinationData.model_validate(data)
print(
f"Total vaccinations in '{vaccination.area}' "
f"for {vaccination.referencedate.date()}: "
f"{vaccination.totalvaccinations}."
)
Changelog
Changes to the datamodels are accompanied by a version update, documented in https://github.com/KAUTH/govgr-opendata-api-schema/blob/main/datamodels/python/CHANGELOG.md.
License
Metadata
Release files for datagovgr-datamodels 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datagovgr_datamodels-0.1.0a1.tar.gz | 16.2 kB | Without provenance | Details for datagovgr_datamodels-0.1.0a1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datagovgr_datamodels-0.1.0a1-py3-none-any.whl | Python 3 | none | any | Details for datagovgr_datamodels-0.1.0a1-py3-none-any.whl |
Total release size: 33.8 kB
Release files / datagovgr_datamodels-0.1.0a1.tar.gz
| Download URL | datagovgr_datamodels-0.1.0a1.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
29f7f5d9257ab9dbc60e73445bb11295386cc28d23a8297b355db67cfa158326
|
|
BLAKE2b-256 checksum How to use checksums |
c61792e0a789c71763229b10d542dc20ab827d8c20f846011725b94423724da8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Release files / datagovgr_datamodels-0.1.0a1-py3-none-any.whl
| Download URL | datagovgr_datamodels-0.1.0a1-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ebb83f9930b819cd226b8123c58114a77d5547a9534097319df9def108f86bed
|
|
BLAKE2b-256 checksum How to use checksums |
a6645fc88a4a0060811b85a96f99cf9fcd12c6dc87e9a41e4994d0c4985b2456
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Security for datagovgr-datamodels 0.1.0a1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.