API for CSV converted by udata-hydra
Project description
udata-hydra-csvapi
This connects to udata-hydra and serves the converted CSVs as an API.
Run locally
Start udata-hydra via docker compose
.
Launch this project:
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 udata_hydra_csvapi/app.py
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
curl http://localhost:8005/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/
{
"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
curl http://localhost:8005/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/profile/
{
"profile": {
"header": [
"geo_point_2d",
"geo_shape",
"ins_nom",
"ins_complexe_nom_cplmt",
"ins_codepostal",
"secteur",
"..."
]
},
"...": "..."
}
Data for a resource (ie resource API)
curl http://localhost:8005/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/data/?limit=1
[
{
"__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": ""
}
]
On this endpoint you can use every neat stuff postgrest provides. Here we only want the ins_nom
column where it icontains "maurice":
curl "http://localhost:8005/api/resources/27d469ff-9908-4b7e-a2e0-9439bb38a395/data/?select=ins_nom&ins_nom=ilike.*maurice*"
[
{
"ins_nom": "BOULODROME MAURICE BECANNE"
}
]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for udata_hydra_csvapi-0.1.0.dev33.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 759711e73856c4ec77edc05faad5f5ec140a75a574accde48cae4b2fdcf95899 |
|
MD5 | 09f14a7f781839dbb977885296ca4a1a |
|
BLAKE2b-256 | 6140921e619614993bd0551bba21fad8400f5e91af7480c3dca78ac8d443aaff |
Close
Hashes for udata_hydra_csvapi-0.1.0.dev33-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dba006895f3c47edbb46f956843a4b91bfa9f4b8517a4620f287e8c1f8829668 |
|
MD5 | a39d05051cd2476945b5d3acd6d1c906 |
|
BLAKE2b-256 | c0a4e7fb557592dd093186685409c3c990aa023224a88cd626398b52def18a76 |