Name | udata-hydra-csvapi JSON |
Version |
0.1.0.dev222
JSON |
| download |
home_page | |
Summary | API for CSV converted by udata-hydra |
upload_time | 2023-07-20 14:31:36 |
maintainer | |
docs_url | None |
author | Etalab |
requires_python | >=3.9,<4.0 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Api-tabular
This connects to [udata-hydra](https://github.com/etalab/udata-hydra) and serves the converted CSVs as an API.
## Run locally
Start [udata-hydra](https://github.com/etalab/udata-hydra) via `docker compose`.
Launch this project:
```shell
docker compose up
```
You can now access the raw postgrest API on http://localhost:8080.
Now you can launch the proxy (ie the app):
```
poetry install
poetry run adev runserver -p8005 api_tabular/app.py # Api related to apified CSV files by udata-hydra
poetry run adev runserver -p8005 api_tabular/metrics.py # Api related to udata's metrics
```
And query postgrest via the proxy using a `resource_id`, cf below. Test resource_id is `27d469ff-9908-4b7e-a2e0-9439bb38a395`
## API
### Meta informations on resource
```shell
curl http://localhost:8005/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/
```
```json
{
"created_at": "2023-02-11T11:44:03.875615+00:00",
"url": "https://data.toulouse-metropole.fr//explore/dataset/boulodromes/download?format=csv&timezone=Europe/Berlin&use_labels_for_header=false",
"links": [
{
"href": "/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/profile/",
"type": "GET",
"rel": "profile"
},
{
"href": "/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/data/",
"type": "GET",
"rel": "data"
}
]
}
```
### Profile (csv-detective output) for a resource
```shell
curl http://localhost:8005/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/profile/
```
```json
{
"profile": {
"header": [
"geo_point_2d",
"geo_shape",
"ins_nom",
"ins_complexe_nom_cplmt",
"ins_codepostal",
"secteur",
"..."
]
},
"...": "..."
}
```
### Data for a resource (ie resource API)
```shell
curl http://localhost:8005/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/data/
```
```json
{
"data": [
{
"__id": 1,
"geo_point_2d": "43.58061543292057,1.401751073689455",
"geo_shape": {
"coordinates": [
[
1.401751073689455,
43.58061543292057
]
],
"type": "MultiPoint"
},
"ins_nom": "BOULODROME LOU BOSC",
"ins_complexe_nom_cplmt": "COMPLEXE SPORTIF DU MIRAIL",
"ins_codepostal": 31100,
"secteur": "Toulouse Ouest",
"quartier": 6.3,
"acces_libre": null,
"ins_nb_equ": 1,
"ins_detail_equ": "",
"ins_complexe_nom": "",
"ins_adresse": "",
"ins_commune": "",
"acces_public_horaires": null,
"acces_club_scol": null,
"ins_nom_cplmt": "",
"ins_id_install": ""
}
],
"links": {
"next": "/api/resources/60963939-6ada-46bc-9a29-b288b16d969b/data/?page=2&page_size=1",
"prev": null,
"profile": "/api/resources/60963939-6ada-46bc-9a29-b288b16d969b/profile/"
},
"meta": {"page": 1, "page_size": 1, "total": 2}
}
```
This endpoint can be queried with the following operators as query string:
```
# sort by column
column_name__sort=asc
column_name__sort=desc
# contains
column_name__contains=word
# exacts
column_name__exact=word
# less
column_name__less=12
# greater
column_name__greater=12
```
Pagination is made throught queries with `page` `and page_size`:
```
curl http://localhost:8005/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/data/?page=2&page_size=30
```
Raw data
{
"_id": null,
"home_page": "",
"name": "udata-hydra-csvapi",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Etalab",
"author_email": "opendatateam@data.gouv.fr",
"download_url": "https://files.pythonhosted.org/packages/b8/5b/20afd8521f854b24822cc291cdb644c1af9c6d59f256a57527fefe4cf40a/udata_hydra_csvapi-0.1.0.dev222.tar.gz",
"platform": null,
"description": "# Api-tabular\n\nThis connects to [udata-hydra](https://github.com/etalab/udata-hydra) and serves the converted CSVs as an API.\n\n## Run locally\n\nStart [udata-hydra](https://github.com/etalab/udata-hydra) via `docker compose`.\n\nLaunch this project:\n\n```shell\ndocker compose up\n```\n\nYou can now access the raw postgrest API on http://localhost:8080.\n\nNow you can launch the proxy (ie the app):\n\n```\npoetry install\npoetry run adev runserver -p8005 api_tabular/app.py # Api related to apified CSV files by udata-hydra\npoetry run adev runserver -p8005 api_tabular/metrics.py # Api related to udata's metrics\n```\n\nAnd query postgrest via the proxy using a `resource_id`, cf below. Test resource_id is `27d469ff-9908-4b7e-a2e0-9439bb38a395`\n\n## API\n\n### Meta informations on resource\n\n```shell\ncurl http://localhost:8005/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/\n```\n\n```json\n{\n \"created_at\": \"2023-02-11T11:44:03.875615+00:00\",\n \"url\": \"https://data.toulouse-metropole.fr//explore/dataset/boulodromes/download?format=csv&timezone=Europe/Berlin&use_labels_for_header=false\",\n \"links\": [\n {\n \"href\": \"/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/profile/\",\n \"type\": \"GET\",\n \"rel\": \"profile\"\n },\n {\n \"href\": \"/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/data/\",\n \"type\": \"GET\",\n \"rel\": \"data\"\n }\n ]\n}\n```\n\n### Profile (csv-detective output) for a resource\n\n```shell\ncurl http://localhost:8005/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/profile/\n```\n\n```json\n{\n \"profile\": {\n \"header\": [\n \"geo_point_2d\",\n \"geo_shape\",\n \"ins_nom\",\n \"ins_complexe_nom_cplmt\",\n \"ins_codepostal\",\n \"secteur\",\n \"...\"\n ]\n },\n \"...\": \"...\"\n}\n```\n\n### Data for a resource (ie resource API)\n\n```shell\ncurl http://localhost:8005/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/data/\n```\n\n```json\n{\n \"data\": [\n {\n \"__id\": 1,\n \"geo_point_2d\": \"43.58061543292057,1.401751073689455\",\n \"geo_shape\": {\n \"coordinates\": [\n [\n 1.401751073689455,\n 43.58061543292057\n ]\n ],\n \"type\": \"MultiPoint\"\n },\n \"ins_nom\": \"BOULODROME LOU BOSC\",\n \"ins_complexe_nom_cplmt\": \"COMPLEXE SPORTIF DU MIRAIL\",\n \"ins_codepostal\": 31100,\n \"secteur\": \"Toulouse Ouest\",\n \"quartier\": 6.3,\n \"acces_libre\": null,\n \"ins_nb_equ\": 1,\n \"ins_detail_equ\": \"\",\n \"ins_complexe_nom\": \"\",\n \"ins_adresse\": \"\",\n \"ins_commune\": \"\",\n \"acces_public_horaires\": null,\n \"acces_club_scol\": null,\n \"ins_nom_cplmt\": \"\",\n \"ins_id_install\": \"\"\n }\n ],\n \"links\": {\n \"next\": \"/api/resources/60963939-6ada-46bc-9a29-b288b16d969b/data/?page=2&page_size=1\",\n \"prev\": null,\n \"profile\": \"/api/resources/60963939-6ada-46bc-9a29-b288b16d969b/profile/\"\n },\n \"meta\": {\"page\": 1, \"page_size\": 1, \"total\": 2}\n}\n```\n\nThis endpoint can be queried with the following operators as query string:\n\n```\n# sort by column\ncolumn_name__sort=asc\ncolumn_name__sort=desc\n\n# contains\ncolumn_name__contains=word\n\n# exacts\ncolumn_name__exact=word\n\n# less\ncolumn_name__less=12\n\n# greater\ncolumn_name__greater=12\n```\n\nPagination is made throught queries with `page` `and page_size`:\n```\ncurl http://localhost:8005/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/data/?page=2&page_size=30\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "API for CSV converted by udata-hydra",
"version": "0.1.0.dev222",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9e304198d9c83a708a9be2e7b80979e74e65711e54a6c49d7c7e7cfc1eef9617",
"md5": "ca55e78a5c20aef069abc06d3ecada45",
"sha256": "4d2c46070d98544cd1a0fc326392d6bb5e97a593f683c1694baf3d03fbf2822b"
},
"downloads": -1,
"filename": "udata_hydra_csvapi-0.1.0.dev222-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ca55e78a5c20aef069abc06d3ecada45",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 8312,
"upload_time": "2023-07-20T14:31:34",
"upload_time_iso_8601": "2023-07-20T14:31:34.944864Z",
"url": "https://files.pythonhosted.org/packages/9e/30/4198d9c83a708a9be2e7b80979e74e65711e54a6c49d7c7e7cfc1eef9617/udata_hydra_csvapi-0.1.0.dev222-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b85b20afd8521f854b24822cc291cdb644c1af9c6d59f256a57527fefe4cf40a",
"md5": "bf9f41c209f0d2cc312715b3a0bda36c",
"sha256": "69c720c1d40456a5d5939a5f6ce444dcec384fcafd4dd1d9b5265a4f49f2c7d3"
},
"downloads": -1,
"filename": "udata_hydra_csvapi-0.1.0.dev222.tar.gz",
"has_sig": false,
"md5_digest": "bf9f41c209f0d2cc312715b3a0bda36c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 7273,
"upload_time": "2023-07-20T14:31:36",
"upload_time_iso_8601": "2023-07-20T14:31:36.023818Z",
"url": "https://files.pythonhosted.org/packages/b8/5b/20afd8521f854b24822cc291cdb644c1af9c6d59f256a57527fefe4cf40a/udata_hydra_csvapi-0.1.0.dev222.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-20 14:31:36",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "udata-hydra-csvapi"
}